awsecrset-repository-policy \--repository-name cluster-autoscaler \--policy-text file:///tmp/my-policy.json# With a .json such as{"Version":"2008-10-17","Statement": [{"Sid":"allow public pull","Effect":"Allow","Principal":"*","Action": ["ecr:BatchCheckLayerAvailability","ecr:BatchGetImage","ecr:GetDownloadUrlForLayer"]}]}
awsecrput-registry-policy--policy-textfile://my-policy.json# With a .json like:{"Sid":"asdasd","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::947247140022:root"},"Action": ["ecr:CreateRepository","ecr:ReplicateImage"],"Resource":"arn:aws:ecr:eu-central-1:947247140022:repository/*"}
然后应用复制配置:
awsecrput-replication-configuration \--replication-configuration file://replication-settings.json \--region us-west-2# Having the .json a content such as:{"rules": [{"destinations": [{"region":"destination_region","registryId":"destination_accountId"}],"repositoryFilters": [{"filter":"repository_prefix_name","filterType":"PREFIX_MATCH"}]}]}