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"
Step 1: Log into Amazon and go to the console. Select Elastic container service and click let's get started.
Step 2: Click the Configure button under Container Configuration and specify the basics.
- container name: EmployeesAPIContainer
- Image: niteshkumar/employeesapi-docker:1.0.1
keep the Advanced features on default and click Update.
Step 3: Service configuration
Step 4: Cluster configuration
Just accept the default values and click next
Step 5: Review
Check to see if all the configuration are correct and click create.
Step 6: Click view service
In the logs we can see container was successfully started.
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