Skip to content

bug: Cannot put-registry-policy for a private registry #13512

@DW8Reaper

Description

@DW8Reaper

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I want to replicate our production environment setup and as such need to set a Registry policy on my LocalStack ECR. Any attempt to call put-registry-policy always fails with: An error occurred (InvalidParameterException) when calling the PutRegistryPolicy operation: Invalid parameter at 'PolicyText' failed to satisfy constraint: 'Invalid registry policy provided

Expected Behavior

I should be able to create a policy (even if it isn't really applied) without any error.

How are you starting LocalStack?

With the localstack script

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

sudo DEBUG=1 localstack start

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

AWS_ACCESS_KEY_ID=LKIAQAAAAAABAA00000C AWS_SECRET_ACCESS_KEY=test aws ecr put-registry-policy --policy-text '{"Version": "2012-10-17","Statement": [ {"Effect": "Allow","Principal": {"AWS": ["arn:aws:iam::386209384616:root","arn:aws:iam::902366379725:root"]},"Action": ["ecr:BatchGetImage","ecr:GetDownloadUrlForLayer","ecr:GetImageCopyStatus","ecr:BatchImportUpstreamImage"],"Resource": "arn:aws:ecr:us-east-1:000000000000:repository/*"}]}' --endpoint-url='http://localhost.localstack.cloud:4566' --region us-east-1

this policy works in AWS, note the account ID's have to be real otherwise AWS will not save them either. Those account ID's are not mine they are from a github repository that lists known account id's.

Environment

- OS:PopOs
- LocalStack: 4.11.1

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    aws:ecrAmazon Elastic Container Registrystatus: backlogTriaged but not yet being worked ontype: bugBug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions