Amazon AWS Certified SysOps Administrator Associate Topic: Elastic Beanstalk for SysOps
December 20, 2022

1. Beanstalk Overview

Okay, so let’s go ahead and learn what Elastic Beanstalk is about. So we have seen before that we have a typical three-tier web app architecture in which we have a load balancer. We had a private subnet that had our Easy2 instances in an auto-scaling group, and they were maybe talking to Amazon RDS for the database and Elastic Cage to cage some information. So how can we safely reproduce this architecture very quickly? The solution is beanstalks. So when you’re a developer on AWS, you need to do a lot of things. You must manage the infrastructure, deploy your code, configure all of the databases and load balancers, and do everything else required to auto scale. So you have scaling concerns, but at the end of the day, all these apps share the same architecture. For example, you would have an application advancer and an auto-scaling group, for example. And as a developer, all you want to do is run your code, and you don’t want to worry too much about the rest. So perhaps you want to do this across different applications, environments, and programming languages. So this is where Elastic Beanstalk comes in. So Elastic Beanstalk is a platform as a service, and it’s a developer-centric view of deploying an application on AWS.

So the beautiful thing is that Elastic Beanstalk is just a layer, but it uses all the components we’ve seen before. This includes your EC2 instances, auto-scaling group, load balancers, RDS database, and so on. But the cool thing is that in the UI, it’s going to be one view, and it’s very easy to make sense of. And we still have full control over the overall configuration of the previous elements. So Beanstalk is, all in all, free. You do not pay for Beanstalk, but you do pay for the underlying resources that you use. For example, if you use an easy-two instance or a load balancer on the RDS database, you’re going to pay for those but not for Beanstalk itself. Okay, so what is a beanstalk? It’s a managed service, and it will perform for you the instance configuration and the operating system configuration, which are all handled by Beanstalk. It will give you a deployment strategy and a deployment mechanism, and we’ll see how we can configure them. But this deployment is going to be performed by Beanstalk. So we have a full lecture dedicated to this.

So the only thing that’s your responsibility is your application code. And then you need to figure out how to configure Beanstalk, obviously, but that’s very simple. So there are three architecture models on Beanstalk. The first one is a single instance deployment, which is good for development. The second one is a more production-like setup that leverages a load balancer and an auto scaling group, which is great when you have to have pre-production or production web applications. And then finally, there’s something called a “worker tier.” We’ll see this as well in this section, which is using only an auto-scaling group. So no lengthy response. And this is great when you want to process some messages in a queue. Okay, back into bin stock. So Beanstalk has three different components. The first one is that you have an application, and this is your code. Then you have the application versions, and each deployment will get assigned a version. Finally, the name of the environment So it could be a beta test or a prod. It’s up to you to name it however you want. And so you’re going to deploy your application versions to environments, and then you can promote application versions to the next environment.

And the cool thing about Beanstalk is that it can do some deployment, but it can also do some rollback, so we can roll back to the previous application version. So we have this, and we have full control over the lifecycle of the environments. So in a diagram, we create an application, and we create the environments together. We’re going to upload the version and create an alias, and then we’re going to release this into our Beanstalk environment. As soon as we get our hands on it, everything should make sense. So what languages are supported by Elastic Beanstalk? Well, it has support for many platforms. Golan, Java, Java with Tomcat, Net, Nodes, PHP, Python, Ruby, Packer Builder, single docker container, multicontainer Docker, and that uses ECS and preconfigured docker are some examples. And if your platform is not there, you can write your own custom platform, which is more advanced. So Beanstalk does support a wide array of use cases. And what we’re going to do right now is go ahead and practice them, and we’re going to create our first Beanstalk application. So I hope you’re excited, and I will see you in the next lecture.

2. [SAA/DVA] Beanstalk Overview

Okay, so now let’s talk about Elastic Beanstalk. So far in this course, when we’ve been deploying an application, we’ve had the same architecture. So we have a load balancer that takes all the requests from our users. And then we have an auto scanning group with multiple availability zones. And in each AZ, there will be some easy-to-deploy instances there. And then, in the back end, we have maybe some data subnets. So we have an RDS database to take the reads and writes; maybe we have some replicas; and so on. Then, if we combine the caching layer, we must consider elastic cache. Okay? So if there are so many applications for us to deploy and they follow the same architecture, it may be a pain to recreate it every single time.

So as a developer, it’s complicated to manage infrastructure to deploy code. We don’t want to be configuring all the databases, the load balancer, et cetera, et cetera. And, of course, everything should be scaled. So as we can see, most of the web applications will have the same architecture with a load balancer and a Nodal scanning group. And as a developer, all I want is for my code to run. I kind of don’t want to worry about everything else. So also, if I develop in different programming languages and have different applications and environments, I may want a single way of deploying my application. And this is where Beanstalk comes into play. So Beanstalk gives a developer-centric view of deploying an application on AWS. The idea is that from one single interface, it’s going to reuse all the components we’ve seen before, such as EC Two, ASG, ELB, and RDS. But it’s going to be a managed service that will deploy all these things for you. So it will handle the capacity provisioning, the configuration, the balancer, the scaling, the application health monitoring, the instance configuration, and so on.

And the only responsibility for you as a developer is going to be the code itself. Okay? You still have full control over the configuration of each component, but at least they come bundled into one single interface in Beanstalk. And the idea that Beanstalk also has a really cool way of updating applications So the Beanstalk service is free on its own, but you’ll have to pay for the underlying instances that will be leveraged by bin stock, your ASG, or your ELB, and so on. So components of Beanstalk consist of an application, which is a collection of binary stock components such as environments, versions, and configurations. A version of the application itself is an iteration of your application code. So you could have Version 1, Version 2, Version 3, and so on. Then an environment is simply a collection of your resources that are running the particular application version. So you can only have one application version at a time in an environment where, as we can see, we can actually update an application version within an environment from version one to version two. We have tiers, so we can have two different tiers in the Beanstalk.

We have the web server environment here and the worker environment here. We’ll see this very quickly. And we can also create multiple environments in Beanstalk, such as development, test, and production, or whatever environment you have in mind really. So the process is to create an application, then we upload a version, then we’re going to launch an environment, and then we’re going to manage the environment’s lifecycle. And if you wanted to iterate on that, we could update the version by uploading a new version, and then deploy that new version again in our environment to update our application stack. So Bitstock supports many programming languages, such as Go, Java, SD, and Java with Come to Cat. Net core on Linux, net core on Windows Server, NodeJS, PHP, Python, Ruby, Packer Builder, single-docker container, multi-docker container, preconfigured Docker, and if your programming language is not here, you can create your own custom platform, which is advanced. So the idea is that with intel, you should be able to deploy pretty much anything. Now to finish, what do I mean by “server tier” and “workers” here? Well, the web tier is looking like this. This is a traditional architecture that we know, where we have a load balancer and then it’s sending traffic to an auto-scaling group that has multiple ECs. Your web server will consist of two instances. This is architecture number one with Beanstalk, and architecture number two with Beanstalk is going to be around a worker environment.

So this time there are no clients accessing your EC directly. In two instances, we’re going to use an SQSQ, which is a message queue, and the message will be sent into the SQSQ. And the EC’s two instances are going to be workers because they’re going to pull messages from the Sass to process them. And in this case, the worker environment is going to scale based on the number of SQS messages. As a result, the more messages there are, the easier it is to create instances. And then the cool thing is that you can put the web environment and the worker environment together by having the web environment push some messages into the SQS queue of the worker environment. So that’s it for an overview of Beanstalk. I’ll see you in the next lecture for some practice. 

3. [SAA] Beanstalk Hands On

So let’s have a look at the Beanstalk service. And for the Solutions Architect Exam, you don’t need to know Elastic Beanstalk in depth; you just need to know what it does at a high level. If you go into the developer exam, there’s a whole section on how to use Beanstalk properly because it is quite a complete service. But let’s go ahead and quickly deploy our first application with Elastic Beanstalk. So I’m going to scroll down, and we have to create an application named Socket, demo Beanstalk, then tags. We won’t need to specify them. Next, we need to choose a platform. So what do we want to run on Beanstalk? And as you can see, we have a lot of choices. Is it programming languages, or is it Docker? And for this example, I’m just going to use NodeJS.

But you can choose whatever you want, and the default versions are fine as well. Then, for the application code, you could upload your own code, but it’s quite complicated. And again, this is not something we want to do at the Solutions Architecture Associate level, but we’ll just use a simple application. Now I want to click on “Configurable Options.” just to show you the types of options you can specify with Elastic Beanstalk. So, scrolling back up, we have presets. And these presets are the method for carrying out some type of solution architecture. On top of Elastic Beanstalk, for example, we can use Single Instance, which is free tier eligible, and that means that we will have one instance, and there will be an Elastic IP attached to it, and that will be it. Or you can run a single instance using spot instances, which are not T eligible. You can run High Availability, which is going to use an application load balancer and an auto-scaling group.

And you can also do the same high availability, but this time using Spot or a mix of Spot and On Demand instances. So if you select one of these presets, what this will do is modify the settings that are outlined. All right, here. Okay, so I’m just going to use Single Instance to make it free-tier eligible. And we have this platform node, JS 12. Okay, now, for the software, you can specify all these things. You can specify the type of instance you want. For example, we have on-demand instances here that are only two micro. Because we’re using a single instance, we don’t have a needle balancer, and so on. So all these things can be modified.

And as you can see, there are a lot of options if you need to know Beanstalk in depth. But for our own purposes, we just want to click on Single Instance and then click on Create App. So this is going to create our “Beanstalk” environment. And this will take a few minutes to get started. So what I will be doing is waiting a few minutes and then getting back to you. Okay, so we can see now that the environment has been successfully launched. And so if I click on Environment here and click on this to be a bit more quick, I’ll remove these prompts. As you can see, the application is running, the health is okay, and everything is green.

So what I can do is see this application that has been deployed by clicking on this URL right here. And this is showing that, yes, congratulations. Your first Beanstalk node JS application has been deployed on the cloud. So this is cool. But the more important stuff to see is what has happened and what has been deployed by Elastic Beanstalk. So if we go into the ECTwo service, we can see what happens.

So obviously, if we go to instances, we can see that one instance is currently running and that this instance right here has been launched. If we look at the tags, we can see that there is a confirmation tag, there is an elastic beanstalk tag, and also the name of the EC2 instance has an auto-scaling Scaling Group. So that means that this EC2 instance, which is a T2 micro, is somehow managed by an auto-scaling group. So if I go on the left hand side and click on “Auto Scaling Group,” as we can see, yes, an ASG has been created. And if I click on this ASG, we can see that the desired capacity is one. The maximum and minimum capacities are also the same. And if I go into instance management, we can find our easy-to-instance right here.

So this is also great because this is a Beanstalk three-tier eligible environment with a single instance. If I go to Elastic IPS, I should be able to find the Elastic IP that has been created for this. And if I go to security groups, for example, I should be able to see a security group that has been created. So this is the case. And as we can see, the inbound rules allow HTTP on port 80, which is allowing us to access our application right here in Elastic Beanstalk.

So that’s it. If we had created load balancers, they would be under the load balancer section. But we chose a very simple deployment. We don’t have any load balancers. But, now that we’re done, this was just a quick demo to show you what would have been created if we had chosen a highly available environment. We can just wrap up and terminate the environment. So to do so, you just need to enter the name of the environment. So I’ll copy this and paste it, terminate it, and then we’re done. So that’s it. I hope you liked this Beanstalk demo, and I will see you in the next.

Leave a Reply

How It Works

img
Step 1. Choose Exam
on ExamLabs
Download IT Exams Questions & Answers
img
Step 2. Open Exam with
Avanset Exam Simulator
Press here to download VCE Exam Simulator that simulates real exam environment
img
Step 3. Study
& Pass
IT Exams Anywhere, Anytime!