AWS ECR (Elastic Container Registry) integration for the aux4 registry system. This package provides commands to authenticate with ECR, push Docker images to ECR repositories, and create new ECR repositories.
aws configure).aux4 aux4 pkger install community/registry-aws
This package requires the AWS CLI. If it is not installed, aux4 will attempt to install it using one of the following system installers:
awscliawscliFor more details, see system-installer.
Authenticate with ECR and push a local Docker image:
# Login to ECR
aux4 registry aws login --accountId 123456789012
# Push an image
aux4 registry aws push myapp:v1.0.0 --repository myapp --imageTag v1.0.0 --accountId 123456789012
You can set these environment variables to avoid passing flags on every command:
AWS_REGION -- AWS region (default: us-east-1)AWS_ACCOUNT_ID -- AWS account IDexport AWS_REGION=us-west-2
export AWS_ACCOUNT_ID=123456789012
# Now you can omit --region and --accountId
aux4 registry aws login
aux4 registry aws push myapp:v1.0.0 --repository myapp
Authenticate with AWS ECR. This obtains a login password from ECR using the AWS CLI and passes it to docker login.
aux4 registry aws login --accountId 123456789012
aux4 registry aws login --accountId 123456789012 --region us-west-2
| Flag | Description | Default | Env | |------|-------------|---------|-----| | --region | AWS region | us-east-1 | AWS_REGION | | --accountId | AWS account ID | -- | AWS_ACCOUNT_ID |
Tag and push a local Docker image to an ECR repository. This command automatically logs in to ECR before pushing.
aux4 registry aws push myapp:v1.0.0 --repository myapp --imageTag v1.0.0 --accountId 123456789012
aux4 registry aws push myapp:latest --repository myapp --accountId 123456789012
The image argument is positional. If --imageTag is not specified, it defaults to latest.
| Flag | Description | Default | Env | |------|-------------|---------|-----| | image | The local image to push (positional) | -- | -- | | --repository | The ECR repository name | -- | -- | | --imageTag | The image tag | latest | -- | | --region | AWS region | us-east-1 | AWS_REGION | | --accountId | AWS account ID | -- | AWS_ACCOUNT_ID |
Create an ECR repository if it does not already exist. If the repository already exists, the command succeeds without making changes.
aux4 registry aws create myapp
aux4 registry aws create myapp --region us-west-2
The repository name is a positional argument.
| Flag | Description | Default | Env | |------|-------------|---------|-----| | repository | The ECR repository name (positional) | -- | -- | | --region | AWS region | us-east-1 | AWS_REGION |
# Set environment variables
export AWS_ACCOUNT_ID=123456789012
export AWS_REGION=us-west-2
# Create the ECR repository (idempotent)
aux4 registry aws create myapp
# Build and push
docker build -t myapp:v1.0.0 .
aux4 registry aws push myapp:v1.0.0 --repository myapp --imageTag v1.0.0
aux4 registry aws push myapp:latest \
--repository myapp \
--imageTag latest \
--region us-east-1 \
--accountId 123456789012
Apache-2.0. See LICENSE for details.