Amazon ECR Container Registry & S3 Storage Buckets
23 minIntermediate
This creates billable resources. Run it in a dev environment and destroy it when you finish. Set a budget alarm first.
Success criteria
0 of 1
What you are building#
What are Amazon ECR and S3?#
- Amazon ECR (Elastic Container Registry): A managed AWS Docker container registry with image scanning on push (
scan_on_push = true) and automated lifecycle policies. - Amazon S3: Object storage used for ALB access logging and Terraform remote state backends.
Steps#
Step 1: Deploy ECR & S3 Infrastructure#
Terminal
cd 01-Infrastructure-Terraform/Lab03-ECR-S3-Storage
terraform init
terraform apply -auto-approveVerify it worked#
Terminal
aws ecr describe-repositories --repository-names nti-devops-ecrExpected Output:
json
{
"repositories": [
{
"repositoryName": "nti-devops-ecr",
"imageScanningConfiguration": {
"scanOnPush": true
}
}
]
}Clean up#
Run this even if you did not finish. Everything above is destroyable, and an account full of half-built experiments is how a surprise bill starts.
Destructive — This removes real resources. Check which environment you are in first.
Terminal
aws ecr delete-repository --repository-name <name> --force
aws s3 rm s3://<bucket> --recursive && aws s3api delete-bucket --bucket <bucket>
terraform destroy -auto-approveCost of this lab: Free tier — 500 MB of ECR storage and 5 GB of S3 are free for 12 months. Container images are large, so delete the repository rather than leaving a few GB of layers behind.