Skip to main content
search

© 2021 Excellerate. All Rights Reserved

If you’re an android developer and have published apps in the Google Play store, then creating and delivering an app is no-brainer for you. But imagine you aren’t a developer, and you have a fantastic idea for an app like Instagram or Whatsapp. You’ve already started designing the workflow and are motivated to start working on it, but now comes the difficult part: you have no knowledge of how to create the backend, let alone scale it to support a large number of users.
AWS-logoUntil now, your main option was to hire a backend developer (or ask a friend), which is not always cost effective. But if you’re eager to keep costs down and follow a DIY (Do It Yourself) approach, there’s finally a solution for you through Amazon Web Services (AWS).  AWS offers reliable, scalable, and inexpensive cloud computing services for app development. Using AWS, you can create tables to store data, write code that will fetch data from the database or execute code at the backend (such as comparing user credentials), and store user profile pictures. You can do that all for free for a year, provided you fall into their Free Tier Plan.
There are many more services provided by AWS but we will focus on the bare minimum that are generally required for creating any app, including:

  1. S3 (For storing profile pictures and other files)
  2. DynamoDB (For storing data)
  3. Lambda (For fetching / writing data to Dynamo DB)

To learn more about all AWS services, visit AWS Products.

1. Setup S3:

“S3 has a simple web services interface that you can use to store and retrieve any amount of data, at any time, from anywhere on the web. It gives any developer access to the same highly scalable, reliable, fast, inexpensive data storage infrastructure that Amazon uses to run its own global network of web sites. The service aims to maximize benefits of scale and to pass those benefits onto developers.”
What this means for your app is that you can store images like user profile pictures on S3. Think of S3 as hard drive but it is not present on your computer. It is on a virtual machine which is accessible across any device that is connected to internet. To upload/download images (or any file) from S3, AWS provides you Android SDK that can be integrated with your Android project. Since it’s scalable, you don’t have to worry about how many users at a given time are uploading/downloading their profile pics, all this traffic is handled by AWS. To learn more, visit Store and Retrieve Files with Amazon S3.

2. Configure DynamoDB:

DynamoDB is a NoSQL database provided by AWS that can be used to store data required by your app. NoSQL is a new form of database which stores data in the form of key-value pair. If you are new to NoSQL then I suggest reading this article. AWS also provides UI console to view tables and data inside the tables (just like phpMyAdmin for MySQL). Another advantage of using DynamoDB is that you don’t have to worry about scalability of the database as you can scale up or scale down your tables’ throughput capacity, without downtime or performance degradation, and use the AWS Management Console to monitor resource utilization and performance metrics.
To start with basics of AWS DynamoDB, visit DynamoDB introduction. To jump in with creating tables, visit Creating Tables and Loading Sample Data. Amazon has also provided step by step guide of integrating DynamoDB with android app which can be found here.

3. Deploy code to AWS Lambda:

The ability to deploy code to AWS Lambda is the most exciting service of AWS. Many times, apps require some of the processing to be done on server side instead of the client side. For example, if the user is trying to login to your app, then the username and password are fetched from the database and are verified with the credentials provided by the user in your app. For this type of requirement, you would normally need to install a server (like Apache / Tomcat), write code that fetches data from the database, and provide the result to the app by exposing an API. This entire process is troublesome, especially if you don’t have experience maintaining a server.
This is where AWS Lambda comes into picture. Using Eclipse and AWS Java SDK, you can write code in Java to fetch data from DynamoDB and can deploy this code on AWS Lambda. There is no need to install any server or worry about its scalability since it can be easily done using AWS Lambda management console. To read more about AWS Lambda, visit What Is AWS Lambda.
You can deploy JAR to Lambda or you can directly upload code from eclipse to Lambda and trigger this Lambda using AWS Android SDK from your app. Now whenever the user clicks on the login button, AWS Lambda will fetch credentials from DynamoDB and send the result after comparing the user-provided credentials. If you’re already an Android developer, writing the above code in Java can be done by following Programming Model for Authoring Lambda Functions in Java and AWS Lambda Update — Run Java Code in Response to Events.
Now you can create a highly scalable backend with the help of AWS, a bit of Java knowledge, and a Free Tier plan. I wish you Best of Luck for your next big app!