Last active
September 21, 2020 23:47
-
-
Save imedadel/7ff8a28e4b1bb7b74c80b3d02f3476a6 to your computer and use it in GitHub Desktop.
Setup AWS EC2 (Elastic Compute Cloud) with Ubuntu 20.04 (Focal), Docker, Docker Compose, and AWS ECR (Elastic Container Registry)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Docker | |
sudo apt update | |
sudo apt install apt-transport-https ca-certificates curl software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" | |
sudo apt update | |
sudo apt install docker-ce | |
sudo usermod -aG docker ubuntu | |
# Docker Compose | |
COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4) | |
sudo curl -L "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
# AWS CLI 2 | |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
sudo apt install unzip | |
unzip awscliv2.zip | |
sudo ./aws/install | |
# Setup ECR | |
sudo docker login -u AWS -p $(aws ecr get-login-password --region us-east-1) $AWS_ECR_REPO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run it using: