AWS Elastic Beanstalk for faster application deployment
Cloud Computing has become a fundamental part of today's tech stack, with it being widely selected over the previous hosting and storage solutions. The cloud as we know is continuously evolving and being diversified. Every sector today is dependent on the cloud. Healthcare, Education, Finance, Art, and Government organizations.
There are various cloud providers out there, that provide different offerings, and also differ in the price of services. But for the purpose of this article, I would concentrate on AWS. Amazon Web Service or (AWS) has dominated this industry for the past few years and has a huge collection of services ranging from simple hosting to creating ML models and visualizing them.
Fast and easy deployment is all that a developer looks for today. Deploying a solution onto the cloud requires a rudimentary understanding of the cloud architecture, how it communicates in the development environment, and the various layers present. Depending on the developer's requirements they can choose their configurations to set up their architecture, deployment environment for their instances, and Network protocols among many others.
With the onset of digitalization, most businesses are turning online, thus the need for flawless and smooth transitioning web applications is the need of the hour.
A developer has multiple options to deploy their developed software on AWS, the easiest and fastest is Elastic BeanStalk. Elastic beanstalk is a platform as a service.
As we can see the number of services we need to manage and set up decreases to just our data and application, which gives us the time to focus on development and application quality, rather than setting up the infrastructure.
Beanstalk API calls and communications
Client makes the request for the deployed service. It sends a GET request to the web server. The web server is identified by the base URL of the entered web URL. Firstly the requested link is compared with the local DNS and the destination address is obtained. The request package is then sent to the destination address through the routers, using different routing protocols.
The server on receiving it passes it to the AWS SQS — its a fully managed message queing for microservices, serverless application and distributed systems. SQS is a message queue that can be used to store messages while the computer isn't ready to process them. It helps us to store and receive messages between components without losing them.
The SQS then further sends a POST message to the worker environment. Worker environments run a daemon process provided by Elastic Beanstalk. This daemon is updated regularly to add features and fix bugs. If all the builds are successful the work environment returns back a 200 Ok response. And thus renders the developed application.
Elastic Beanstalk benefits
- Fast and Direct deployment
- Easy to use and setup
- Cost-effective
- Customizable
- No need to handle storage, infrastructure, network protocols
- Avoids management setup, load balancing, and scaling.
Elastic Beanstalk Supported languages
- Python
- java
- .NET
- PHP
- Node.js
- Ruby
- Go
AWS BeanStalk Architecture
Breaking down the internal workflow of how the service runs internally and interacts with the various other AWS-offered services.
- Elastic Load Balancer: Elastic Load Balancing automatically distributes your incoming traffic across multiple targets, such as EC2 instances, containers, and IP addresses, in one or more Availability Zones. It monitors the health of its registered targets and routes traffic only to the healthy targets
- EC2 (Elastic Compute): Working with EC2, requires developers to create an account on Amazon’s AWS website. We can make use of the AWS Management Console, the AWS Command Line Tools (CLI), or AWS Software Developer Kits to manage EC2. Then we need to select EC2 from the AWS Services dashboard and ‘launch instance’ in the EC2 console. Now we can either choose an Amazon Machine Image (AMI) template or create an AMI containing an operating system, application programs, and configuration settings. The AMI is then uploaded to the Amazon S3 and registered with Amazon EC2, creating an AMI identifier. The developer needs to select the compute resources, the OS and its version along with other details, and finally it's ready for use.
S3 Bucket: Elastic Beanstalk creates an Amazon S3 bucket named elasticbeanstalk-region-acount-id for each region in which you create environments. Elastic Beanstalk uses this bucket to store objects, for example, temporary configuration files, that are required for the proper operation of your application.
Service Charges
Kindly be careful while creating your instances or using paid services. In order to calculate the charges you will incur, please use the metrics estimation and price calculation link below.
Points to remember that can help you prevent unnecessary expenditure
- Pause your service when not using it.
- AWS enables scalability so don't assign high compute or storage initially.
- Put your services to sleep when traffic is not present.
- Select regions and zones that are less expensive.
Steps to Deploy your website on AWS Beanstalk
- Login to the AWS account as a root user or signup.
2. In the search bar type “ Elastic Beanstalk”
3. Create an Application
4. a)Give it a name (unique to your previous deployments)
b) For the platform, select according to which it was developed. (For me I selected PHP)
c) Select upload your code and select the folder by uploading it, it should be a .zip file. With index.php as your main file.
d) select create an application
- Finally, your application is ready and you can share the shareable link.
- The overall process will take 3 to 5 mins depending on the size of your application.
- Please do note, the service charges that will be incurred for running these services. My suggestion is to create billing alerts and other metric-bound alerts, to know when your cost incurred crosses your threshold set.