Why AWS Elastic Beanstalk is a better platform decision
Tags: cloud, aws, paas
Published: 2021-10-09 10:32:27

Amazon Web Services (AWS) is a collection of over one hundred services, each service provides different capabilities. However, managing infrastructure can be challenging to figure out which services to use and how to provision them. If your development team is small, then it is extremely difficult to manage the infrastructure.

Elastic Beanstalk is a Platform as a Service or PaaS service within AWS. Platform as a Service is a type of service where the vendor handles all of the infrastructures with you and you just provide the code of your application. So you provide the application code and Elastic Beanstalk handles the infrastructure environment to be built around that application. 

###How AWS Elastic Beanstalk is different from Cloudformation?###

Cloudformation gives you complete control over your infrastructure. You have to plan, code, and maintain it. It is infrastructure written in code. It is great to have complete control but sometimes it becomes overkill and the entire process to write the code for the infrastructure is time taking. Elastic Beanstalk takes the developer's application code and executes it within AWS without paying much attention to the infrastructure that underlies that application.

###Services Used By AWS Elastic Beanstalk###

AWS Elastic Beanstalk uses core AWS services such as Amazon EC2, Amazon Elastic Container Service (Amazon ECS), Auto Scaling, and Elastic Load Balancing and it creates and manages all of those services using CloudFormation. So development team can simply focus on coding and application and then beanstalk can manage the provisioning of the infrastructure which that application requires

###Platforms and languages###
AWS Elastic Beanstalk offers managed platforms for running web applications written in a variety of programming languages, frameworks, and web containers.

#####Natively supported languages#####

AWS Elastic Beanstalk supports web applications written in many popular languages and frameworks. It requires no or minimal code changes to go from the development machine to the cloud. You can choose from a variety of application platforms such as Java, .NET, Node.js, PHP, Ruby, Python, Go, and Docker to deploy your web applications.

#####Docker Options#####

Single container Docker and Multicontainer Docker are supported by AWS Elastic Beanstalk. If you only want to host a single containerized application, Beanstalk allows you to put a Docker image on a repository and download it directly into Elastic Beanstalk. Multicontainer can be used if you have an application that uses multiple containers. AWS Elastic Beanstalk uses ECS behind the scenes to coordinate between containers.

AWS Beanstalk also provides Preconfigured Docker images and  Custom Runtime implemented with Packer, if your application is implemented with the programming language which is not natively available within the Beanstalk. 

###Elastic Beanstalk Application & Environments###

An application within Elastic Beanstalk serves as a wrapper for the environments that run your web app, along with versions of your web app's source code, saved configurations, logs, and other artifacts that you create while using Elastic Beanstalk.

Environment is the core component in Elastic Beanstalk. Elastic Beanstalk allocates the resources needed to run your application when you create an environment. Beanstalk provides two types of environments:

#####Web Server Environments#####

![AWS Elastic Beanstalk - Web Server Environments](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iex1rg1c2a6lduf2au4q.png)
Web Server Environments are meant to be created when your application is required to interact directly with the users. AWS resources created for an environment include one elastic load balancer (ELB in the diagram), an Auto Scaling group, and one or more Amazon Elastic Compute Cloud (Amazon EC2) instances.

#####Worker Environments#####

![AWS Elastic Beanstalk - Worker Environments](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ogm8f5jdt3822n5m3bqt.png)
Worker environments do not directly respond to the users. They just execute the long-running tasks or I/O bound tasks from the web server environment. Both the environments interact with each other via SQS. When your web instance needs to spawn a background job, it posts a message to the shared queue with the job details. A process running on the worker instance reads the item and performs the task.

###Deployment Options###
You can deploy your code to AWS Elastic Beanstalk using the AWS Management Console, the Elastic Beanstalk Command Line Interface, Visual Studio, or Eclipse. You can choose between several deployment policies, including all at once, rolling, rolling with an additional batch, immutable, and blue/green. These policy options allow you to prioritise the speed and security of application deployment while reducing administrative burden.

###Pricing###

AWS Elastic Beanstalk comes at no extra cost. You are only charged for the AWS resources such as EC2 instance or Load Balancer that you create to run your application. There are no minimum fees or upfront commitments; you only pay for what you use, as you use it.