ECR Repo#
Now that we have a Docker image, let’s host it on ECR!
Assignment#
Create an ECR repository patientping-ecs, and push the image.
Cost check: ECR storage costs about $0.10 per GB per month. For a small image like ours, which we’ll keep on ECR only long enough for learning/testing, this is essentially free. Data transfer costs also apply when pulling images, but again, for learning purposes it’s minimal.
- Navigate to “ECR” using the search bar in the AWS console
- Click “Create repository”
- Ensure Private is selected, name it
patientping-ecs, and click “Create” - Click into your repository and click the “View push commands” button:

- Copy and paste the first command into your terminal to login to ECR.
- Build and push a linux/amd64 image so ECS can run it:
docker buildx build \
--platform linux/amd64 \
--tag "YOUR-ACCT-ID.dkr.ecr.us-east-1.amazonaws.com/patientping-ecs:latest" \
--push .- Navigate to your
patientping-ecsrepository in the AWS console and confirm that yourlatestimage is there.
Tip#
If you prefer the CLI:
aws ecr create-repository --repository-name patientping-ecs
my_account_id=$(aws sts get-caller-identity --query Account --output text)
my_region=$(aws configure get region)
aws ecr get-login-password --region "${my_region}" | docker login \
--username AWS \
--password-stdin "${my_account_id}.dkr.ecr.${my_region}.amazonaws.com"
docker buildx build \
--platform linux/amd64,linux/arm64 \
--tag "${my_account_id}.dkr.ecr.${my_region}.amazonaws.com/patientping-ecs:latest" \
--push .
# Fallback if multi-platform is unsupported on your Docker setup:
docker buildx build \
--platform linux/amd64 \
--tag "${my_account_id}.dkr.ecr.${my_region}.amazonaws.com/patientping-ecs:latest" \
--push .