Run docker images on AWS using docker-compose - Application server
For creating a powerful App Server which can serve 2 million requests per month, take a new EC2 instance having 4 vCPUS, 16GB RAM, and running Ubuntu 18.04.
And follow these steps:
- Install Docker
- Install Docker Compose
- Setup aws cli
- Pull images from ECR
- Run them using docker-compose
1. Install docker
2. Install docker-compose
3. Install and setup aws cli
4. Pull images from ECR
Before docker-compose can access images hosted on ECR, we need to
$ aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 781335429294.dkr.ecr.us-east-1.amazonaws.com $ docker-compose up -d
Reserver an Elastic IP address
Reserve an Elastic (fixed) IP address and associate it with the app server. Otherwise every time, the app server is restarted, the new IP address will be assigned to it and break domain name pointing.