Hello, Better you come here after finishing my previous post A Docker Tutorial for Beginners . Otherwise, It will be no use to go through this blog post. In the previous post, I gave you an introduction to docker and we also made small flask application that can run with docker on your local machine. Elastic Beanstalk is just a platform to run that docker image in the cloud, Ready to serve as many users as you want.

I will start off by giving you an introduction to elastic beanstalk and then I will provide the small tutorial to run the same flask image on AWS platform.

What is Elastic Beanstalk?

AWS Elastic Beanstalk is an orchestration service offered from Amazon Web Services for deploying infrastructure which orchestrates various AWS services, including EC2, S3, Simple Notification Service (SNS), CloudWatch, autoscaling, and Elastic Load Balancers. Elastic Beanstalk provides an additional layer of abstraction over the bare server and OS. users instead see a pre-built combination of OS and platform, such as “64bit Amazon Linux 2014.03 v1.1.0 running python 2.7”. Deployment requires a number of components to be defined: an ‘application’ as a logical container for the project, a ‘version’ which is a deployable build of the application executable, a ‘configuration template’ that contains configuration information for both the Beanstalk environment and for the product. Finally, an ‘environment’ combines a ‘version’ with a ‘configuration’ and deploys them. Executables themselves are uploaded as archive files to S3 beforehand and the ‘version’ is just a pointer to this. – wikipedia

Yeah, That was from Wikipedia and it really explains what is the use of elastic beanstalk. Elastic Beanstalk really comes with the easy dashboard which will help you managing server, load balancing, upscale and downscale on an event or for a certain time period, logs, cloud watch which gives you overall information about current usage. You can also limit the number of servers a time with just a few clicks.

You can also hold a version of your deployments. So, You will be able to roll back to the previous version when you face issue with the new deployment. And that is so awesome! 😉

The advantage of running docker and elastic beanstalk together is you can really free up your self from managing cloud infrastructure and concentrate on only on development.

Supported applications and software stacks include:

  • Ruby, PHP and Python applications on Apache HTTP Server
  • .NET Framework applications on IIS 7.5
  • Java applications on Apache Tomcat
  • Node.js applications
  • Docker containers

Supported deployment methods include:

  • Zip files
  • Java Web Application Archive (.WAR file)
  • Docker containers 
  • Git

starter …

To start first you have to create AWS account  https://console.aws.amazon.com. We are going to use free instance provide by Elastic Beanstalk but make sure that you destroy everything you are running otherwise you will get charged.

what you really need to understand is once you run docker container in local successfully. Following is just a steps to run it on the cloud. You can also assign that to URL with aws route53 service.

After, login you will need to install awscli by running following command.

$ sudo pip install awscli

Now, go to AWS dashboard and generate credentials to provide awscli. So, You can manage everything about AWS from the command line.  Go to My Security Credentials opening the drop-down menu available at top-right corner.

You will find option name access keys, Open it and generate new credentials. Better you keep it private because it can be easily used for any purpose. You will find something like shown in the following image.

Now, open up your terminal and run following command to provide credentials to awscli to manage aws cloud services from the command line.

$ aws configure

Let’s deploy our app on Elastic Beanstalk

Open up terminal and cd to the directory we previously created and run the following command. I sharing images with you. So, You can choose the same option I choose.

  • first It will ask you to choose the region you want to deploy the docker.

  • Then it will prompt you to choose an application.

  • Then it will ask you which the version wants to pick from.

That’s it. We successfully initialized the elastic beanstalk app.

Create and Deploy phase

Now, To create the environment, Run the following command inside the directory.

$ eb create

It will prompt you to ask as following questions and provide the answers as I did. It will ask you about env name, Load balancer type etc.

After providing that it will automatically deploy the application on cloud. On the dashboard, you will find the URLs.

You can open that you are after it turns grey colour into green. That’s all. We successfully deployed our first flask application on AWS Elastic Beanstalk if you are receiving the same response we received while running it on local.

reference: https://en.wikipedia.org/wiki/AWS_Elastic_Beanstalk



Aniket Patel

Bright, Breezy and comartist.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: