Contents:
Login to ECR
Run the following command to log in to ECR:
aws ecr get-login-password –region us-east-1
| docker login –username AWS –password-stdin <AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com
Create ECR Repository
- Open ECR Console → Create repository
- Enter repository name:
fargate-workshop-app
- Select Private
- Create the repository and copy the URI
Build and Push Image to ECR
Build the Docker image:
docker build -t fargate-workshop-app .
Tag the image with your ECR URI (replace <AWS_ACCOUNT_ID>
with your account ID):
docker tag fargate-workshop-app:latest <AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/fargate-workshop-app:latest
Push the image to ECR:
docker push <AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/fargate-workshop-app:latest
Create ECS Cluster
- Open ECS Console → Clusters → Create Cluster
- Select Networking only (Powered by AWS Fargate)
- Enter cluster name:
fargate-workshop-cluster
- Choose the VPC and Subnets created in the Networking section
- Click Create

Create Task Definition
- Open ECS Console → Task Definitions → Create new Task Definition
- Select Fargate
- Enter task name:
fargate-workshop-task
- Select Task Role:
ecsTaskExecutionRole
- Define the container:
- Container name:
fargate-workshop-app
- Image:
<AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/fargate-workshop-app:latest
- Port mappings:
8080
(TCP)
- Click Next step and Create

Deploy Service with Fargate
- Open ECS Console → Select cluster
fargate-workshop-cluster
→ Create Service - Configure:
- Launch type: Fargate
- Task Definition:
fargate-workshop-task
- Platform version:
LATEST
- Service name:
fargate-service
- Number of tasks:
2
- Networking:
- Select VPC and Subnets
- Assign public IP: ENABLED (for public access)
- Choose a Security Group that allows port 8080
- Load Balancing (optional):
- Select Application Load Balancer
- Create a new target group
- Listener port: 80
- Review and Create Service

Once the service is running, you can access the application via the DNS name of the Load Balancer.