Skip to content

pgarbe/cdk-ecr-sync

main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

CDK ECR Sync

An CDK Construct to synchronizes Docker images from Docker Hub to ECR.

Why should you use it?

  1. Avoid DockerHub throttling
  2. Better availability (ECR: 99.9%, DockerHub: "as is")
  3. Possible less data transfer costs (ECS pulls from ECR in same region are free)

See also my blog post: https://garbe.io/blog/2020/04/22/cdk-ecr-sync/

How to use it

In your CDK application, run npm install @pgarbe/cdk-ecr-sync and add the following construct:

const ecrSync = new EcrSync(this, 'ecrSync', {
  repoPrefix: 'dockerhub-mirror', // optional prefix
  dockerImages: [
    {
      imageName: 'datadog/agent',
      excludeTags: [  // Use RegEx expressions to exclude specific tags
        'latest',
        '^1.0'
      ],
    }
  ],
  lifcecyleRule: {...} // Optional lifecycle rule for ECR repos
});

// Allow all accounts in your organization to pull
ecrSync.grantPull(new iam.OrganizationalPrincipal('o-123456'));

See also examples folder.

Trigger the sync manually

Look up for a lambda called *ecrSync*%*, add an empty test event, and execute it. The lambda will check which images needs to be synced and trigger a CodePipeline.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published