top of page
  • Writer's pictureTaylor Etheredge

Implementation of a Scalable Web Application using the services of AWS

Updated: Nov 10, 2023


In this project based on a real-world scenario, I was responsible for implementing an application that needs to support the high demand of a large number of users accessing it simultaneously. This application has been used in a large conference that had more than 10,000 people, in-person and online, with participants from all over the world.

This event was broadcast online and in person and 10 vouchers were drawn for 3 Cloud certifications. At that moment, more than 10,000 people in the audience registered their e-mails to guarantee their participation in the raffle.

We used in AWS, Elastic Beanstalk services to deploy the web application, DynamoDB to store emails, CloudFront to cache static and dynamic files in an Edge Location close to the user.


First we created the DynamoDB as stated to store all the emails used for the raffle. This type of database was chosen for it's high performance and reliability to store that many emails with a very quick lookup speed. This DynamoDB is not part of the Elastic Beanstalk configuration as it is already scalable in nature. The table name was users and the Partition key or Primary key was email.


The second overall thing configured was the Elastic Beanstalk environment. This consists of the Elastic Load Balancer (ELB), Auto Scaling Group and the EC2 instances. The Elastic Beanstalk configuration includes everything that is needed to run the application in several instances with the load balancer setup to handle the load between them. The Auto Scaling Group allows you to specify the parameters for when an new instance should be spun up or be spun down based on CPU utilization. You can choose from numerous different criteria to base it on, I chose to use CPU utilization, since there would be so many users at once accessing the application. The EC2 instances were setup on Amazon Linux architecture. The app itself was a Python web app to allow the users to enter their email address and then store it in the DynamoDB instance.


The way to configure the Elastic Beanstalk is by the following:

Configure the environment:

1) Set the environment to web tier.

2) Set the application name to whatever you like

3) Set the platform to Python in this case, change it to what your app is.

4) Under the application code section I set it to upload and pasted in the S3 bucket url to the zip file that contains all the web app code.

5) Under presets, I set the configuration preset to high availability, since I wanted the multiple EC2 instances.


Configure service access:

1) Create a new service role called aws-elasticbeanstalk-service-role.

2) Make sure the following permissions are attached:

- AWSElasticBeanstalkEnhancedHealth

- AWSElasticBeanstalkManagedUpdatesCustomerRolePolicy

3) For the EC2 instances create a new role called, aws-elasticbeanstalk-ec2-role

4) Make sure the following permissions are attached:

- AWSElasticBeanstalkWebTier

- AWSElasticBeanstalkWorkerTier

- AWSElasticBeanstalkMulticontainerDocker

- AmazonDynamoDBFullAccess


Configure the networking, database and tags:

1) Set the VPC to North Virginia or your choosing

2) Set the instance settings to have public IP's

3) Set the availability zone to us-east-1a

* Select only one zone, we will change the instance size in the next step. Then, we will come back to this step to select all zones. If you select all zones, you’ll get an error because the shapes are not available.


Configure instance traffic and scaling:

1) Set the root volume type to your liking

2) Set the volume size to your liking

3) Set the capacity settings to have an auto scaling group, with a load balancer

4) Set the min, max and instance type for your instances to spin up on demand

* The instance type is important, select a type that is available in all availability zones if possible. Then go back to step 3 of Configure the networking, database and tags and then select all the availability zones that the instance type allows for and check them.

5) Set the scaling triggers that are appropriate for your environment, this is where I chose CPU utilization

6) Set the load balancer network settings to have public IP's and check all the subnets


Configure the Environment Variable:

1) Set the Environment variable named AWS_REGION to the region your VPC is in, in my case it was us-east-1

The next thing that was configured was the CloudFront service, which allows you store the static and dynamic content of the web app to the Edge locations. This is so that users from all over the world, which it was in this case, can access the app from a closer location than trying to access it from the USA. This service also provides a HTTPS connection to your application for you. The way you configure the CloudFront is:


1) Click on Create CloudFront Distribution

2) Set the origin domain to the ELB created in Elastic Beanstalk

3) Protocol should be HTTP only

4) Set the allowed HTTP methods to be, GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE

5) Set the Cache key and origin requests to:

(*) Cache policy and origin request policy (recommended)

6) Set the cache policy to CachingOptimized

7) Set the WAF to Enable security protections

8) Then click on Create Distribution


You will now be able to view the application by clicking on the Distribution Domain Name, within the CloudFront instance.


Here is a diagram of the solution:


Hope you found this to be insightful and helpful in regards to setting up a scalable web app in AWS using DynamoDB, Elastic Beanstalk and CloudFront.

25 views0 comments

Comments


bottom of page