In this tutorial, we are going to learn how to get started with Elastic Beanstalk.
Amazon Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications created with java, .NET, Python, Golang, PHP, Node.js, and Ruby. You can quickly deploy and manage applications in the AWS cloud without worrying about the infrastructure that runs the application.
Benefits of using Amazon Elastic Beanstalk
- It reduces management complexity. You are only required to upload your app and Elastic Beanstalk automatically handles the details of provisioning, creating a load balancer, scaling, and health monitoring via CloudWatch.
- Every app is fully scalable because Elastic Beanstalk automatically scales every app smoothly depending on the resources allocated in every instance.
- Developers have complete infrastructure control.
- It’s fast and simple to deploy apps using Amazon Elastic Beanstalk.
- It supports apps written in Go, Java, .NET, Node.js, PHP, Python, and Ruby. This shows that Elastic Beanstalk supports a large base of programming languages.
- Elastic Beanstalk has a console where you can easily interact with the environment easily.
Getting started with Elastic Beanstalk.
To start deploying your application, follow the following steps.
Sign into your account and choose the region you will like to host your application. On the dashboard search for the Elastic Beanstalk. Click create, this will take you to Elastic Beanstalk getting started page. Input the application name, choose the platform to use, choose the way to create your application and finally click create application. Give it a few minutes for the application to be created.
As an example, we can create an Amazon Elastic Beanstalk using starter by following this link. https://console.aws.amazon.com/elasticbeanstalk/home#/gettingStarted?applicationName=getting-started-app
During creation, the following is created in the process.
- An Amazon Elastic Compute Cloud instance is created (EC2)
- Amazon EC2 Security group is created.
- An Amazon S3 bucket is created.
- Amazon CloudWatch alarms
- Amazon CloudFormation stack
- A domain name
If you are successful you will see something like the image below.
If your installation passes all the health checks, then if you click on the link saying getting started it will take you to the following page.
Deploying a new version of the application
Let’s say you have added some features to your application and you want to upgrade the running version on the AWS. This is how you can synchronize changes in your environment.
- Download the application that matches the platform you use at the beginning. To get those sample apps use this link https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/GettingStarted.DeployApp.html. In my case, I am using the go platform.
- Go to the Elastic Beanstalk console and choose Environment and select your environment. In my case, the name of the environment is called Gettingstartedapp-env.
- Click the name of your environment and click on the upload and deploy. Choose the file to upload and click deploy
Running a configuration change
Whenever you feel like you are not satisfied with the way the application is running, for example maybe your web application is compute intensive and you would like to reduce the resources, Elastic Beanstalk has to update its environment for changes to take effect.
Changes being made will depend, some will require you to delete the application and recreate while others will effect the changes immediately.
- Open Elastic Beanstalk console and click on the environments in order to locate your created
- Click Configuration and choose what you will like to edit, for my case let me edit capacity
- Choose what you will like to change and click apply.
Terminating the environment
When you are done with the environment, always terminate to avoid extra charges being billed. To delete follow the following.
- Go to Applications and choose the name of the app to delete.
- In the navigation, pane choose Application versions
- When on the Applications versions choose the version you will like to delete.
- Choose Actions and then delete
- Select Delete versions from Amazon S3
- Click delete and wait for it to complete
- Then we also need to terminate the environment by going to environment actions and choosing terminate, Confirm that you will like to terminate the instance and click terminate.
- Lastly is to delete the app. On the navigation, pane choose the name of the app, choose Actions and Delete Application, confirm that you will like to delete and click on delete button.
Congrats, we have successfully learned how to create, configure, and lastly terminate Amazon Elastic Beanstalk.