https://docs.aws.amazon.com/ja_jp/codepipeline/latest/userguide/tutorials-ecs-ecr-codedeploy.html
- Cerate Docker image and push to ECR
- Create ECS task definition and AppSpec source files
- Create ALB and taget groups
- Create CodeDeploy application and deployment group
- Create deployment pipeline on GitHub Actions
- Update
static-html-directory/index.html
and push Gitub
# Pull Nginx image
$ docker pull nginx
# Create ECR repository
$ aws ecr create-repository --repository-name nginx
# Add a tag to Nginx image
$ docker tag nginx:latest 353381651656.dkr.ecr.ap-northeast-1.amazonaws.com/nginx:latest
# Login ECR
$ aws ecr get-login-password --region ap-northeast-1 | \
docker login --username AWS --password-stdin 353381651656.dkr.ecr.ap-northeast-1.amazonaws.com/nginx
# Push Nginx image to ECR
$ docker push 353381651656.dkr.ecr.ap-northeast-1.amazonaws.com/nginx:latest
# Register task definition
$ aws ecs register-task-definition --cli-input-json file://taskdef.json
# Create ECS service
$ aws ecs create-service --service-name my-service --cli-input-json file://create-service.json
# Confirm
$ aws ecs describe-services --cluster ecs-blue-green-deploy --services my-service
https://hub.docker.com/_/nginx
$ docker build -t 353381651656.dkr.ecr.ap-northeast-1.amazonaws.com/nginx:latest .
$ docker run -d -p 8080:80 353381651656.dkr.ecr.ap-northeast-1.amazonaws.com/nginx:latest
Open localhost:8080
in user browser.