How To Deploy Docker Container On AWS Using Elastic Beanstalk


How To Deploy Docker Containers On AWS

Cloud computing has become the way to go for hosting of different web services today. It is cost friendly, more secure and more dependable than the usual hosting services common some years back.  With Amazon Web Services, the already great idea of cloud computing has definitely gotten better and easier to use. Amazon is a reliable company, so anybody would feel at rest having them handle the hosting of their web applications.  For you to be reading this article, I would assume that you have an idea of what cloud computing is, what Amazon Web Services(AWS) does and also what docker is. Well, just in case you do not have a much of an idea about what they are, let’s go through a quick introduction.

Firstly, Cloud computing.

Cloud computing simply involves the delivery of on-demand computing resources. This involves everything from applications to data and other IT resources over the internet with a pay-as-you-go pricing.  So you do not necessarily have to pay for resources you do not get to use, when it comes to cloud computing.

Secondly, Amazon Web Services (AWS).

“Amazon Web Services is a secure cloud services platform, offering compute power, database storage, content delivery and other functionality to help businesses scale and grow.” That simple explanation is as quoted from the official website (Amazonwebsite).  Basically, AWS helps improve flexibility, scalability and reliability of web applications.

Thirdly, Docker Container.

A Docker container can be described as an open source application development platform. It basically packages the applications into containers enabling them to be easily movable or portable on any Linux operating system.  Thats all for the quick summary of what cloud computing is, what AWS does and what a docker container is, a full explanation of those concepts is beyond the scope of this article.

So, we are going to be working with the Amazon Elastic Beanstalk service which is the Amazon Web Service we would use to run docker applications. It is an easy to use service for deploying and scaling web applications and services.  We are going to take things step by step, as we may have to reference to a previously taken step for some explanation. Let’s get into the thick of things.

Step 1

We get to visit the official website of Amazon Beanstalk. Firstly visit the Amazon Web Services website and ensure that you are logged in, then navigate your way to the Beanstalk section by checking out the services. If you have difficulty finding that section, you can quickly get it by visiting this link.

Step 2

 It would load up the Beanstalk section, and you would find be able to create a new application. However before we get to do that, ensure that Beanstalk is indicating the right geographical location which you can find at the top right hand corner of the webpage.

When you get to confirm your location, you can click on “Create New Application” which is directly below the part of the page where you got to change your location.

Step 3

It then gets to load a new webpage, where you get to input details before creating a new application. You are expected to see a form with two sections:

  • Application name
  • Description

Let’s give our application the name “ca-web-server”. You can give it any name you want, however you have to be careful through out this article. It is advisable you simply follow through, and do things the way you would like there after.

The description could be left empty, as it is optional. That’s exactly what we are going to do, we would leave it empty.

Then you click on “Next”

Step 4

It then comes up with a new page, and you can see your application’s name at the top left hand corner of the webpage.

On this page, we have to setup the environment type.

We have a form with three sections:

  • Environment Tier
  • Predefined Configuration
  • Environment Type

We simply want the application to be a web server, so you click on the “Environment tier” and on the drop down menu, we select “Web Server”.

We then click on the “Predefined Configuration” and on the drop down menu, we select “Docker”.

We click on the “Environment type” and on the drop down menu, we select “Single Instance”.

Then you click “Next”.

Step 5

You are then directed to the Application Version page. You select the “Upload Your Own” button, if you already have a docker file. When uploaded, we click on “Next”.

Step 6

Then we get a webpage showing environment information.

Here, we have the “Environment name” prefilled, and the “Environment URL” prefilled. Then you click on “Check Availability”. This then checks the availability of the chosen url, that is the chosen name earlier is merged with

If the “Environment URL” turns green, when we are ready to proceed.

Then you click “Next”.

Step 7

You then get a page asking you to select “Additional Resources”. We don’t need this, so we could skip. However, overtime you would get to know the usefulness of the additional resources and would be able to pick according to your requirements.

So, click next.

Step 8

It comes up with a configuration page. You can leave the “Instance type” at the default selection which should be “t1 micro”. This creates the process as an EC2 instance.

Then you can select on the “EC2 key pair” which comes with a drop down selection, you can then select the available pairing which is associated with your Amazon Web Service account.

You can then type in your email in the email address section, you can decide to leave it empty if you wish to. Amazon would send any information about any important events associated with the account to this email address.

The instance profile should be left at its default selection.

Then you click “Next”.

Step 9

This comes up with a section called “Environment Tags” which helps with improving the security.

It has a key and a value. Where the key can be any character and the value could also have any character also, the combination of both helps with securing the connection processes.

However, that is not needed right now, so you click “Next”.

Step 10

This comes up with a review information of the service and the configuration settings. It’s time to get the environment out there, so you click “Launch”.

It launches it, and comes up with a window showing the steps being taken as the container is being processed. This would take some time.

That’s it, your Docker container has been deployed to the AWS cloud.

Step 11

Return to the dashboard where you can get access to all of Amazon Web Services. Then click on “EC2”.

Click on “Instances”, here you would see the current process showing a “running” status if everything went well. Tick the process, and further information on the process is going to be displayed.

You would see something called “public dns” copy the information there, we would need it to access the instance from the terminal.

You can then access the docker using:

ssh -i <path-ssh-key> docker@<ssh-host>


<path-ssh-key> is the key-pair that we chose to use. Should be replaced with “mykey.pem” since we left it empty.

docker is the ec2-user name.

<ssh-host> is the public dns copied earlier.

Hit the enter key, type “y” for yes and hit the enter key once again and we are in.


So, these steps would help take your custom built Docker container and have it launched and run on AWS using the Elastic Beanstalk service. Docker and AWS have come together to make it easier than ever to deploy a docker container on Amazon’s EC2 infrastructure.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Install AWS Command Line Interface (CLI) on Ubuntu 18.04 LTS

AWS CLI or Amazon Web Service Command Line Interface is a command line tool for managing and administering your Amazon...

Installing and Using AWS CLI on Ubuntu

AWS offers an enormous range of services and to launch even the simplest of these services require numerous steps. You...

What is Serverless? Understanding AWS Lambda and other similar FaaS infrastructure.

In order to understand serverless, AWS Lamda and similar Function-as-a-Service offerings, we will start with a history...
Bài Viết

Bài Viết Mới Cập Nhật

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh

Mua proxy Onet uy tín tại

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1

Thuê địa chỉ IPv4 IPv6 trọn gói ở đâu chất lượng, giá RẺ nhất?