Creating Repositories
Introduction and Lesson Goals
Welcome to the second lesson in our course on Working with Container Registries. In the previous lesson, you explored Amazon ECR and verified your environment through the AWS CLI. Now it's time to create your first ECR repository with security best practices built in from day one.
Rather than creating a basic repository and adding security later, you'll learn to configure security settings during initial creation. This lesson focuses on two critical security features: scan on push for automatic vulnerability detection and immutable tags for deployment consistency.
By the end of this lesson, you'll run the aws ecr create-repository command with appropriate security flags and verify your settings using aws ecr describe-repositories.
Why Security by Default in ECR
Security in container registries goes beyond access control — it's about ensuring the integrity and safety of your stored images. Amazon ECR provides built-in security features that you can enable during repository creation.
Scan on push automatically analyzes container images for known security vulnerabilities whenever you push a new image. ECR uses a comprehensive vulnerability database to identify potential issues in image layers, including OS packages and application dependencies. Scans typically complete within minutes and provide severity ratings to help you prioritize fixes.
Immutable tags prevent you from pushing new images with existing tags, protecting against accidental overwrites that could introduce inconsistencies in your deployment pipeline.
Key Benefits:
- Scan on push: Immediate vulnerability feedback for every pushed image
- Immutable tags: Prevents accidental overwrites and maintains deployment consistency
- Automated security: Built-in protection without manual intervention
Consider a real-world scenario: without immutable tags, a developer could accidentally push a broken image with the :latest tag, overwriting a stable version. With immutable tags enabled, this would fail, preserving existing deployments.
Prerequisites and Setup Checks
Before creating your first ECR repository, understand these key requirements:
Region awareness is crucial because repositories are region-specific. A repository created in us-west-2 won't be accessible from us-east-1. This affects both repository URIs and deployment strategies.
IAM permissions are required for ECR operations. Key permissions include ecr:CreateRepository for creation, ecr:PutImage for pushing, and ecr:GetAuthorizationToken for authentication.
In the CodeSignal environment, these prerequisites are pre-configured with appropriate credentials and regional settings.
