[ECR] [Replication]: Enable Cross Region Replication per repo with tag regex
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Tell us about your request What do you want us to build?
- Added per-repo support for ECR
- Added tag regex support per-repo for targeting image tag for replication
Which service(s) is this request for? This could be ECR
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard? Many production environments run in multiple regions. With the added support for cross-region ECR replication, it would be great to target specific tags from specific ECR repos for replication to those target regions. This would solve the problem of slower image pull times for images that are being pulled across regions.
Hi @igaskin! Thanks for opening this up. This is one of the first features we plan to deliver now that we've launched replication. To give you some context on how we're thinking about this, we will probably end up delivering this as 2 separate features - one for per-repo support and another for tag-level filtering.
I'd love to hear more about your use case. Are you planning to filter only by tag or repository or both? Would you like specific filters (startswith/endswith/ full regex) or is exact match good enough?
Currently, the only example we have of tag filtering is in our Lifecycle Policy rules. Would that kind of filtering (for image tags) work for you or would you prefer something else?
Hi @igaskin! Thanks for opening this up. This is one of the first features we plan to deliver now that we've launched replication. To give you some context on how we're thinking about this, we will probably end up delivering this as 2 separate features - one for per-repo support and another for tag-level filtering.
I'd love to hear more about your use case. Are you planning to filter only by tag or repository or both? Would you like specific filters (
startswith/endswith/ full regex) or is exact match good enough?Currently, the only example we have of tag filtering is in our Lifecycle Policy rules. Would that kind of filtering (for image tags) work for you or would you prefer something else?
I'm planning on filtering by both repository and tag. The regex patterns in the lifecycle policy rules are exactly the type of granularity I'm looking for. A common pattern is for production and non-production to share the same repository, with potentially differing tags to distinguish production ready images.
This request is mostly to keep the costs of replication to a minimum. For accounts with a large number of repos and images, it could be costly to replicate all of the images when only a certain subset would benefit from replication.
edit: loved the shoutout to this roadmap item on Containers From The Couch!
It's not enough to replicate the whole registry cross the regions. I need the granular permission control for replication. Can I expect the repository will have the individual policy for replication with this feature?
I have a similar use case where my team has a central AWS account for building docker images and other accounts that use those images. We are currently using these images in AWS Batch jobs in another account (cross-account usage) without copying. It would be beneficial to store the images in the same account as the batch jobs for testing and tracking image versions, but not every built image needs to be copied over (our dry run builds are kept in ECR for example) and certainly not every repository is relevant to copy.
A new use case for us is deploying lambda functions from images built this way. The problem is that lambda requires the repository be in the same AWS account as the function, so now we need to copy images over, but do not need all of them.
For configuring CRR, all I really need is to be able to specify individual repositories and exact-match image tags.
My use-case is to replicate only images from repos in the base registry (dev) with the tag "master" to the next level up (integration), and when thoroughly tested, those images would be tagged "release", and replicated to the prod repos.
Something like this

Adding tags to the ECR repositories (AWS tags, not docker tags) and then the ability to select which tag values to replicate across region would be helpful to us. We would like to do this since we are using lambda container images and these images MUST be in the same account as the lambda that is using it (per current lambda container image limitations). Previously, we had a single ECR repository in an shared AWS account used by dev/qa/prod that worked great, until we started to use lambda container images. Now, we must copy these ECR repositories into each AWS account and we wanted to use this replication to do so since it seemed simple to setup.
Since only the lambda ECR images need to be replicated for our use case and we have a lot of other repositories in our shared ECR it would be a cost savings for us to only replicate the lambda container images.
It would be handy to tag ECR repos with something like, Replication=true or Lambda=true and then setup a rule/policy to only replicate those tagged ECR repos into our DEV/QA/PROD AWS accounts.
@srrengar : would you be able to give an update on this feature ? That would be really appreciated
hi @jgournet the per repo support is coming soon, and regex for specific images will be a follow up
One thing that I would find quite handy would be the possibility to filter per repository and per tag. My use case is that I want to replicate all images from a repository that are not tagged with -latest to another repository.
As I understand I need to tag my images following that schema: ${IMAGE_REPOSITORY}/${APP_NAME}:${IMAGE_TAG}
So in development we tag an application named "backend" multiple times with the -latest tag. Once we release it it gets a version number and I want only replicate these images to another account. Is this feature included in this request or is this filtering only per repository? A workaround would be to use different repositories, but than I would need to tag the image with a different app_name. And imho it is cleaner to keep the name of the application as it is "backend" and not "backend-released"
In combination with https://github.com/aws/containers-roadmap/issues/878 it would make a complete picture.
@srrengar, Is support for filtering only for cross region, or also cross account?
hey everyone, today we launched filtering for cross account and region replication, along with an API to see replication status! The filtering uses a prefix to determine which repositories to replicate.
https://aws.amazon.com/about-aws/whats-new/2021/09/amazon-ecr-replicate-individual-repositories-regions-accounts/ https://aws.amazon.com/blogs/containers/using-amazon-ecr-replication-rules-to-optimize-your-application-delivery-process/
@srrengar Is regex for specific images still on the roadmap?
Repo filtered replication is very helpful, thank you!
@srrengar These links are not working. Can you please help?
@vedant-singhania @srrengar, Is tag based image filtering feature available in ECR cross account replication yet? Any idea. Please help.
@vesubramanian image tag filtered replication is not available at the moment from my understanding. So far only repository filtered replication has been released.
Hello, is this tag filtered images feature on the near time roadmap?
Looks like replication can be configured based on repository name only. Is there any plans to introduce additional, tag-based filters?
ecr repo policy and lifecycle policy not reflect. is that intentional ? @srrengar
Looks like replication can be configured based on repository name only. Is there any plans to introduce additional, tag-based filters?
Replication Image by Tag Filter on this request: https://github.com/aws/containers-roadmap/issues/1737
Tag Filter for replication would be great as the amount of images built into the ECR repo for Development purposes are high and so the cost to replicate them cross region and account would get pretty high. I would like the feature to only replicate specific images in the ECR repo that have a release_# tagged to them so only production ready tags will be replicated.