AWS Elastic Beanstalk usage and Difference with other services

Elman Badalov
10 min readJan 12, 2023

Today we will check with you in detail the use of Elastic Beanstalk and the difference between it and other services. In order to make the process more understandable and readable, we will proceed under the headings. If you’re ready, let’s start 🙂.

AWS Elastic Beanstalk

What is Elastic Beanstalk?

Elastic Beanstalk is a platform within AWS that is used for deploying and scaling web applications. In simple terms this platform as a service (PaaS) takes your application code and deploys it while provisioning the supporting architecture and compute resources required for your code to run. Elastic Beanstalk also fully manages the patching and security updates for those provisioned resources.

What are the Elastic Beanstalk Advantages?

We can summarize the advantages of Elastic Beanstalk under a few headings. The key advantages of Elastic Beanstalk include one-touch application deployment without any additional installation, time-saving server configuration, customizability and cost-effectiveness. If we look in more detail, we can see the advantages of Elastic Beanstalk in detail in the following headings.

Easy and fast application deployment by providing specific configuration:

First of all, we can deploy an application in the infrastructure we want by using the general configuration provided by the service in the Elastic Beanstalk installation. But if we do not want to prefer this, then we can set up a specific configuration and provide deployment in a structure we want. Especially in this case, we will need to enter ELB, ASG, RDS, EC2 instances preconfigured (or custom) platforms, Monitoring, In-place and Blue/Green deployment methodologies, Security (Rotates Passwords), Docker environments services and structures that we will use easily. Afterwards, we will deploy the .zip version of our application and start the deployment process with one click. In a short time, the deployment will be completed and we will be able to access our application through the endpoint provided by AWS Elastic Beanstalk with specific installations. If we don’t want to deploy manually, we can automate the process with CI/CD Pipeline. I will talk about this subject under the title of “Example Pipeline”. AWS Elastic Beanstalk supports Java, .NET, PHP, Node.js, Python, Ruby, Go and Docker web applications.

Having a reliable structure:

It provides communication of the services it contains over Elastic Beanstalk Security Groups. In this way, the servers will only be able to access each other from certain ports and ips. At the same time, the user and password information used in the Database are kept under the ENV structure and can only be seen by authorized persons. For this, it will be sufficient to set the authorizations of the people over IAM.

Managing the update by AWS:

We need to open a separate parenthesis here. As you know, the installations in each service or server remain in the old version over time and create security weaknesses. At this point, Elastic Beanstalk regularly performs version control to remove these vulnerabilities for us, and also provides version updates when necessary. There is no need for us to do anything additional for this. At the same time, automatic upgrade processes allow the performance of the application to increase. This process is completely managed by AWS.

Provides Powerful Customization:

Keeping everything under control becomes even simpler with Elastic Beanstalk. Everything created is in the AWS layer so you can look at EC2, flexibly control the scale structure with new servers and connect to them via ssh or SSM. You can update your database configuration file. You can update the security group for all machines so that you can only access the application from the specific IP address you specified.

Provide Price and Flexibility:

Elastic Beanstalk’s price and flexibility really surprises. There is no charge for the platform itself, only for the additional AWS Services you use. You can also easily match your server needs to your service load, as you can choose your instance size and easily add more servers to the load balancer. Elastic Beanstalk even has built-in autoscaling functionality that we’ve never used, but it would be a great way to save money for larger applications by bringing in extra servers only when needed. In summary, it is possible to deploy the application you want, using any number of servers and other services, at an affordable price.

At the same time, it is worth noting that the entire structure is managed by AWS. In other words, it is one of the biggest advantages for us that it provides this opportunity and manages it with reasonable fees.

In addition, AWS EB provides us with metrics in the use of the relevant service and dashboards to monitor the general status of our application on AWS Cloudwatch on these metrics. I will talk about this part in more detail in the “Monitoring” section.

What are the Disadvantages of Elastic Beanstalk?

Under this title, I will talk about the disadvantages of the AWS EB service. The biggest shortcomings of Elastic Beanstalk are its deployment speed and stack updates. Let’s examine it in more detail.

Deployment Speed:

For some applications, especially for e-commerce sites, critical findings need to be fixed and deployed immediately. However, deployments on AWS EB can be deployed in 5 minutes at the earliest and 10–15 minutes at the latest. Especially if you are getting very high traffic and at the same time if you are using more servers, this time may increase even more. In e-commerce sites, this process can be troublesome. That’s why AWS itself states that using Elastic Beanstalk would be more ideal for Dev and Test environments.

Stack Updates:

Elastic Beanstalk is always coming out with new stack versions. If the version control is not done correctly, then these version patches may add the application. Although the update does not cause problems for a long time, it may affect the application at critical points.

In summary, these problems are of the solvable type. In order to prevent these from happening, attention should be paid to the correct operation of the best practice deployment concept, the rollback scenario, and the version of the applications or stack structure.

What is the difference with EKS, EC2, Lambda services?

Now let’s talk about the difference by examining the equivalents of Elastic Beanstalk. As you know, there are multiple methods and multiple services for application deployment in the AWS environment. Examples of these are EKS, EC2 and Lambda services. In this article, I will not describe the services I have given as examples in detail. I will talk about the differences between Elastic Beanstalk and other services through the main headings in the appendix.

Management:

If we look at all services in general under this article, of course, Elastic Beanstalk will be preferred among them. Being managed by AWS makes it easy for us. Since the management on EC2 , EKS and Lambda is entirely up to us, convenience cannot be provided here.

Scalability:

The most commonly used service under this heading is of course EKS and AWS EB services. Because it has an automatically scalable structure. Of course, this provides us with great benefits as the building is scaled immediately at the time of high traffic. For this process to happen on EC2, we will need to use the Auto Scaling Group (ASG) structure. But at this point, we will need to create our servers via the Launch Template. On Lambda, it is impossible to provide this structure. Because Lambda has Serverless Architecture. So it works without a server.

High availability:

This hood is a critical point for high-traffic and non-disruptive environments. Here, too, EKS and AWS EB take precedence. Because we can give 3 AZ for these structures at the Network layer. In EC2 this is not possible. Because EC2 can only work on 1 AZ and is in a network structure suitable for interruptions. Lambda, on the other hand, works without a server, so I separate it from this part.

Setup:

This topic is especially important for those who will deploy applications on AWS for the first time. The most prominent service here will of course be the AWS EB service. With its easy installation and immediate deploy feature, it is selected from other services and provides great convenience to users. The EKS service is referred to as a service that requires more detailed information on this subject. EC2 and Lambda are other services that are very simple to install. But let’s not forget that if the application deployment step is also in this process, then the AWS EB service can make a difference to the others.

Details:

Of course, setting up each service requires some details. Especially if you are going to set up an environment with a more specific structure, the details increase even more. In fact, Lambda is the most prominent service in the logic of adding the code that does not require any details here. It is requesting details as other services have server dependencies.

Flexibility:

This title will help us especially at the Network layer. Structures that do not have server dependencies, of course, have a flexible working system. However, single-instance environments such as EC2, where this is not the case, may not be flexible. As I mentioned before, EKS and AWS EB are very flexible structures.

Traceability:

Nowadays, traceability has become much easier. With the help of the Cloudwatch service in the AWS environment, we can now easily get metrics from all structures and monitor them.

Updates:

Of course, as I mentioned the advantages of AWS EB at the beginning, these distinguish themselves from all the services mentioned, and the update processes are completely managed by AWS.

CI/CD Flexibility and Reliability:

No matter how successful all services are in terms of CI/CD flexibility, EKS is one step ahead in terms of reliability. The important thing here is to provide reliable and fast deployment. For this, the EKS structure is more suitable.

High traffic performance:

Our choice here should definitely be EKS. Because other services can be down during high traffic. The reason why it is EKS is due to the flexibility of the K8S structure and its ability to easily handle traffic.

How to prepare a deployment in accordance with Best Practices?

Paying attention to Best Practices will allow the AWS EB we will set up for us to run smoothly. For example, when we set up AWS EB in the first step, we need to write the e-mail address in the Notification section to provide continuous information. Or if there are different tools we use, we can provide settings to inform from there.

In the network part, we can use the default VPC provided by AWS. However, paying attention to the dependencies of our application, we should not skip using the database subnet for Database, private subnets for servers, and public subnet for Load Balancer.

If you do not make any installation in the Database layer, then AWS EB creates a Database for you. But here, I suggest you to open Database via RDS and enter the information here.

When installed, you need to activate patch and security updates in the Managed Updates section to keep your resources provided by Beanstalk up-to-date, and you can specify when you want these updates to be made here.

We need to forget to create an SSL certificate for the installation time application in the Load Balancer pane. In this way, we can receive incoming traffic over HTTPS.

In the ASG section, we should not skip determining the min and max server number for the application. Otherwise, it may affect the flexibility of the application. In high traffic, this adjustment needs to be done correctly for ASG to upscale or downscale servers.

We need to set Application Deployment in Rolling Updates And Deployments pane. With the help of this, we can decide how the application deployment will be. Especially by choosing Deployment Policy, Traffic Split and Eveluation time values, we can ensure that the application is deployed in accordance with better practices.

How to prepare Example Pipeline?

In this step, I will share a sample pipeline for AWS Elastic Beanstalk Stack deployment for you. We need to prepare similar Pipelines to provide automatic deployment. First we will need Iam User with S3 bucket and Programmatic access to automate the deployment process. We will have our application on the S3 bucket and deploy the application on Elastic Beanstalk using Programmatic Iam user. Example Pipeline is as attached:

- step:
name: "CI/CD Pipeline for Elastic Beanstalk"
script:
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.5.0
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
APPLICATION_NAME: 'application-test'
COMMAND: 'upload-only'
ZIP_FILE: 'application.zip'
S3_BUCKET: '$S3_BUCKET_NAME'
VERSION_LABEL: 'deploy-$BITBUCKET_BUILD_NUMBER'

Monitoring

We can access the metrics of the AWS Elastic Beanstalk structure through Cloudwatch. Here we can set alarms over metrics or create Dashboards using metrics. Here we can track EC2, ALB and Database using the relevant metrics. At the same time, if we create alarms to receive notification from Elastic Beanstalk about the deploy step and give our e-mail address here, we can easily be informed about all processes. We need to monitor important alarms such as CPU/Memory/Disk on EC2. On the ALB, we need to monitor important alarms such as 5xx, 4xx and make sure that the traffic is successfully provided. On the database, we need to create alarms such as CPU / Freeable Memory / Db Connection and make sure that there is no lock status on the DB.

Today, we have examined the Elastic Beanstalk service in detail with you. We talked about the advantages, disadvantages and differences with other services. In addition, we touched on how to write a best practice pipeline. I hope it has been an article that you will like and benefit from reading.

Happy reading everyone. See you in my next articles… 😊

--

--