Document S3 buckets used by ECR
It turns out that running docker against ECR in a VPC with an S3 endpoint with a nontrivial locked down policy on it is a recipe in frustration.
It eventually turned out that we needed to allow our endpoint to access prod-us-east-1-starport-layer-bucket for ECR to work properly, but this was not obvious at all from any of the official documentation.
I get that on some level it's an implementation detail of ECR, but on the other hand, given that other AWS constructs like VPCE policies require us to know about that implementation detail, it'd be nice to have that documented somewhere.
Thanks for filing this issue. I agree that we can improve the user experience here. I'll start a conversation with the product team to see what we can do to improve the documentation on using ECR with an S3 endpoint.
In many ways this feels similar in "shape" to prefix lists in EC2 networking. If want to open my security group to S3, I don't want to have to keep track of all the CIDRs S3 is using behind the scenes, but I still need to be able to talk about S3 as a logical entity. Unfortunately, there's not really a notion of "named resource bundles" in IAM, so within a given policy, I can't just say "hey allow the stuff that ECR wants". Managed policies do this for principals, but VPCEs don't support that.
But since none of that is really possible today, I think this boils down to the equivalent of https://ip-ranges.amazonaws.com/ip-ranges.json and just publishing a list of buckets in the documentation. Or perhaps in a machine-readable form like the ip-ranges.json so we can adjust our automated policies without having to keep reading the documentation?
This is now more relevant thanks to https://aws.amazon.com/blogs/compute/setting-up-aws-privatelink-for-aws-fargate-amazon-ecs-and-amazon-ecr/ and ECR gaining PrivateLink support.
That blog post suggests a wide-open S3 VPCE, which many/most organizations using VPCEs will not want or allow. But to recommend a more precise policy, the starport layer buckets need to be documented (and by extension, the team commits to their names) or we can't realistically write sensible private policies for our endpoints.
I also tried posting something like this comment on that blog post but my comment disappeared 😦
Looks like the documentation was updated! https://docs.aws.amazon.com/AmazonECR/latest/userguide/ecs-minimum-s3-perms.html
@copumpkin That link is no longer working it seems.
The updated link is https://docs.aws.amazon.com/AmazonECR/latest/userguide/ecr-minimum-s3-perms.html
That link no longer contains any information about s3 and starport.
I believe this documentation can be found at https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html#ecr-setting-up-s3-gateway