Deploy your docker container on Amazon EC2 Elastic Container Service.

In a previous post I deployed my SpringBoot docker container on the Oracle Cloud. In this post I am going to try and do the same but then using Amazons EC2 Elastic Container Service. Lets get started!

Setting up your container service

I am going to use Amazons Fargate which makes live much easier. What is Fargate?

“AWS Fargate is a technology for Amazon ECS and EKS* that allows you to run containers without having to manage servers or clusters. With AWS Fargate, you no longer have to provision, configure, and scale clusters of virtual machines to run containers. This removes the need to choose server types, decide when to scale your clusters, or optimize cluster packing. AWS Fargate removes the need for you to interact with or think about servers or clusters. Fargate lets you focus on designing and building your applications instead of managing the infrastructure that runs them.”

First log into Amazon and go to the console.

Fargate.

From there select Elastic Container Service and Click Let’s get started.

Now we enter a 4 step wizard where you can specify a Container Definition, Task Definition, Service and a Cluster. This has a strong resemblance with what we had to do to get the docker container running on the Oracle Cloud.

Step 1: Configure our container definition.

Click the Configure button under Container Configuration and specify the basics.

Container Definition

I keep the Advanced features on default and click Update.

Step 2: Service Configuration.

Lets keep it simple and choose no loadbalancing and then click Next.

Service Config

Step 3: Cluster Configuration.

Just accept the default values here and click Next.

Cluster Config

Step 4: Review

Check to see if al the configuration seems right and click Create.

Now you can see Amazon is going to provision all the things you need with minimal configuration. Mine took about 2 minutes to finish.

Lauch Status

When it is done click View Service.

Now you will get an overview of the whole service. You can check out logging, metrics and more. In the logs you should see that the container was successfully started.

DockerContainerSuccesfulStarted

Lets check out what the public ip is so we can actually check if our API is available. Just click Tasks and then on the task id. Over here you can see the public ip in the overview. You can also click on ENI id which actually takes you to the EC2 console in Network Interfaces where you should also see your container.

DockerContainerIP

The last thing we want to do is to see if the service is actually running so start Postman and make a call:

PostmanResult

Both cloud solutions work in a similar fashion but it seems it is a bit easier to set up clustering with Fargate as it takes care of al this for you with a wizard. In the Oracle cloud you still have to do a bit more configuration I think but I couldn’t test it as the Oracle trail prohibited that. But both are quite easy to work with and fast. Amazon was a bit quicker in provisioning. Price wise they probably also differ but I haven’t really looked in to that. Keep in mind though that Fargate is only availble now in US East. Other regions will follow.

References:

One Reply to “Deploy your docker container on Amazon EC2 Elastic Container Service.”

  1. Pingback: deploy your docker container on azure container service

Leave a Reply

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

*