# 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:

  1. Account ID
  2. 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:

  1. Go to the Containers tab of your organization.
  2. Click Add registry.
  3. From the list of registries, select ECR.
  4. In the Registry URL field, type in the URL you constructed above (for example, 12345679012.dkr.ecr.us-east-1.amazonaws.com).
  5. Type in a title for the new registry.
  6. Type AWS in the User field.
  7. In the Password field, type in the ECR password you've retrieved above.
  8. 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.

Last Updated: 7/27/2022, 1:07:10 PM