In the container community, most of pubic container images are located in Docker hub, Quay and GCR, in order to get fast, stable and secure access to these public images from Amazon ECS or EKS, it's recommended to replicate these images to Amazon ECR. There are 2 use cases to have replicated public container images in your private ECR container registry:
This solution is intend to demostrate an automated process to replicate public conatiner images into ECR by submit your needed images list into AWS CodeCommit repository:
You may deploy this solution with AWS CDK to any AWS global regions.
Please follow Getting started with the AWS CDK to install AWS CLI, Node.js and other tools.
Get AK/SK for AWS IAM user who has push/pull access to target ECR registry.
Clone this project and install required npm modules
$ git clone https://github.com/aws-samples/amazon-ecr-replication-for-pub-container-images.git
$ cd amazon-ecr-replication-for-pub-container-images
$ npm install
Deploy this solution with Amaozn ECR of another AWS account and region, replace targetRegion, targetRegionAK and targetRegionSK with the region and IAM user credential.
$ npx cdk deploy --parameters targetRegion=cn-northwest-1 --parameters targetRegionAK=AKABCD12345 --parameters targetRegionSK=SK12345
Checkout and commit the images.txt file into the CodeCommit repository, you may noticed that the images will be replicated to your ECR in the target Account.
$ npx cdk destroy
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.