Showing posts with label AWS. Show all posts
Showing posts with label AWS. Show all posts

Monday 14 January 2019

How to Deploy your docker container on Amazon EC2 Elastic Container Service

Deploy our docker container on Amazon EC2 Elastic Container Service

In previous post, we discuss about how to run SpringBoot API as a Docker.

I am going to use Amazons fargate for Amazon EC2 Elastic Container Service. 

"AWS Fargate is a compute engine for Amazon ECS 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"

For more information you can go to https://aws.amazon.com/fargate/

Step 1: Log into Amazon and go to the console. Select Elastic container service and click let's get started.

How to Deploy your docker container on Amazon EC2 Elastic Container Service

Step 2: Click the Configure button under Container Configuration and specify the basics.

  • container name: EmployeesAPIContainer
  • Image: niteshkumar/employeesapi-docker:1.0.1
How to Deploy your docker container on Amazon EC2 Elastic Container Service
          keep the Advanced features on default and click Update.


Step 3: Service configuration

How to Deploy your docker container on Amazon EC2 Elastic Container Service

Step 4: Cluster configuration

Just accept the default values and click next

How to Deploy your docker container on Amazon EC2 Elastic Container Service

Step 5: Review

Check to see if all the configuration are correct and click create.

How to Deploy your docker container on Amazon EC2 Elastic Container Service

Step 6: Click view service

In the logs we can see container was successfully started.

How to Deploy your docker container on Amazon EC2 Elastic Container Service

Step 7: Check Public IP

Click Tasks and then on the task id, we can get public IP in the overview. By using this IP we can check if our API is available or not.

Step 8: Use Postman or RestClient to connect API's using these public IP address.


References: 


Related post:

Implementation of swagger in SpringBoot API

How to run SpringBoot API as a Docker container