This project involves setting up the following AWS resources:
- VPC
- Subnets
- 2 Private subnets
- 2 Public subnets
- Route tables for subnets
- Internet Gateway
- Security Groups
- For Application Load Balancer (ALB)
- For ECS
- Application Load Balancer
- Internet-facing (public subnets)
- ECR (Elastic Container Registry)
- Manually create the ECR repository and import the existing resource.
- Build a "Hello World" Docker image from a Dockerfile and push it to ECR.
- Private ECR (internal access)
- Encrypted ECR
- Private endpoints (created by Terraform)
- ECS (Elastic Container Service)
- Task definition with a container in private subnets
- Service with 2 desired containers
- Resources should be highly available (2 Availability Zones).
- The Application Load Balancer is the only resource accessible from the Internet.
Create an end-to-end CI/CD pipeline with Amazon ECR and AWS CodePipeline.
- Create the CodeBuild service role.
- Create Build projects and a
buildspec.yamlthat includes:- Docker build and tag with short commit ID.
- Docker push to ECR.
- Create a new ECS task definition with the new image.
- Update ECS service to use the new task definition.
- Create a new pipeline.
- Configure the branch to trigger the pipeline.
- Run CodeBuild with the Build projects.