Skip to main content

ECR Repository

๐Ÿ“ฆ Overviewโ€‹

This Terraform module provisions a private Amazon ECR repository in a specified AWS region.
It enables secure, versioned container storage for teams deploying to ECS, EKS, or self-managed platforms.


โœ… Key Featuresโ€‹

  • Creates a secure, private ECR repository
  • Supports custom names and standard environment tagging
  • Enables use with ECS, EKS, Lambda, or other container runtimes
  • Fully managed and integrated into AWS identity and security models

๐Ÿ’ผ Use Casesโ€‹

  • Teams storing backend or microservice container images
  • CI/CD pipelines pushing and pulling container builds
  • Infrastructure teams managing base images for internal tools
  • ECS and EKS environments requiring tightly scoped registries

๐Ÿ“ฅ Input Variablesโ€‹

NameTypeDescription
regionstringAWS region to deploy the ECR repository
repository_namestringThe name of the container image repository
environmentstringTag to specify the deployment environment (e.g., dev, prod)

๐Ÿ“ค Outputsโ€‹

NameDescription
repository_urlThe full URL of the created ECR repository
repository_arnThe ARN of the created ECR repository
repository_nameThe name of the created ECR repository

๐Ÿš€ Deployment Readinessโ€‹

  • โœ… Compatible with Terraform 1.0+
  • โœ… Tested with AWS provider 5.x
  • ๐Ÿงช Requires IAM permissions to create and manage ECR resources

๐Ÿ› ๏ธ Example Usageโ€‹

module "ecr-repository-deployment" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//developer-utilities/ecr-repository?ref=v1.0.0"

region = "us-east-1"
repository_name = "archiphire-backend"
environment = "prod"
}
terraform init
terraform plan
terraform apply

or

tofu init
tofu plan
tofu apply

๐Ÿงน Cleanup Optionsโ€‹

For testing:

terraform destroy

or

tofu destroy

For production: Manually delete the repository using the AWS CLI to avoid breaking pipelines or services:

aws ecr delete-repository --repository-name <your_repo_name> --force

๐Ÿ›ก๏ธ Notesโ€‹

This is a Level 1 container infrastructure module for provisioning private ECR repositories. For use cases requiring public access, image scanning, or lifecycle rules, consider extending this with a hardened or policy-enhanced variant.

๐Ÿ”’ Deployment Package Noticeโ€‹

This module is part of the Level 1 AWS License Tier. To access the full deployment package and source code, subscribe to Archiphire.