Skip to content

Latest commit

 

History

History
57 lines (52 loc) · 2.78 KB

aws_ecr.md

File metadata and controls

57 lines (52 loc) · 2.78 KB

List AWS ECR (Elastic Container Registry) information

oofficial doc

有關 ecr 的 policy 設定

$ aws --profile admin ecr set-repository-policy --repository-name repo1 --policy-text file://usr1Policy.json
  • 透過 command,來 create user & create access key
$ aws --profile power-dev-serverless iam create-user --user-name=bruce-test1
$ aws --profile power-dev-serverless iam create-access-key --user-name=bruce-test1
  • 設定 policy 的方式,目前僅能用 command line 來設定
$ aws ecr set-repository-policy --repository-name dev/acus/fe --policy-text file://devPolicy.json

使用 iam policy 來設定 ecr 的權限

  • 使用 iam user 來設定 ecr 存取權限
  • example
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ecr:GetDownloadUrlForLayer",
        "ecr:ListImages",
        "ecr:BatchCheckLayerAvailability",
        "ecr:BatchGetImage",
        "ecr:DescribeImages",
        "ecr:DescribeRepositories"
      ],
      "Resource": [
        "arn:aws:ecr:us-west-2:<AWS_ID>:repository/dev/*"
      ]
    }
  ]
}

Reference

進階技巧