# Create an AWS Elastic Container Registry
To be able tp push and pull images to a custom AWS ECR container registry, you will need to add the registry's URL to cnvrg.
This guide will explain how to locate the URL for your custom registry and how to add it to cnvrg.
# Prerequisites: Prepare Your Local Environment
Before you can complete the setup, you must install and prepare the following dependencies on your local machine:
# Find the Information for your Registry URL
An ECR URL is constructed from two pieces of information:
- Account ID
- Region
# Account ID
Your ECR exists in affiliation with your account ID. You can determine your account ID by running the following command:
aws sts get-caller-identity
The field labelled Account
is your account ID.
# Region
Your ECR should ideally exist in the same region as your EKS cluster.
Find the name of the Amazon region your cluster is in.
# Construct the Registry URL
The URL is simply:
ACCOUNT-ID.dkr.ecr.REGION.amazonaws.com
That is to say, take the account ID and region and combine them to create the desired ECR registry URL.
EXAMPLE
For example, if your account name is 12345679012
and your cluster is in us-east-1
, the ECR registry URL would be: 12345679012.dkr.ecr.us-east-1.amazonaws.com
# Retrieve ECR password
Using the AWS CLI from your device or from the CloudShell in the AWS Console, type the following command:
aws ecr get-login-password --region REGION
Replace REGION with the region where the registry is located.
# Add the Registry URL to cnvrg
Now, we will take the URL we just built and add it to cnvrg:
- Go to the Containers tab of your organization.
- Click Add registry.
- From the list of registries, select ECR.
- In the Registry URL field, type in the URL you constructed above (for example,
12345679012.dkr.ecr.us-east-1.amazonaws.com
). - Type in a title for the new registry.
- Type
AWS
in the User field. - In the Password field, type in the ECR password you've retrieved above.
- Click Save.
NOTE
If you followed the EKS guide to set up your cluster, authentication will not be needed as your cluster will already be authenticated to have read/write access to your new ECR registry.
# Conclusion
You will now have added the URL of your ECR registry to cnvrg. You can now build and pull images, using your ECR registry inside cnvrg.