以下の内容はhttps://sadayoshi-tada.hatenablog.com/entry/2025/02/15/122839より取得しました。


ecrm を CodeBuild で動かすためにやったことまとめメモ✍

タダです.

以前以下の記事を書きました.ecrm をローカルで試してみたのですが,CodeBuildで稼働させてみているのでその時に必要だった設定を備忘録でまとめます.

sadayoshi-tada.hatenablog.com

CodeBuild の IAMポリシー

CodeBuild の IAM ポリシーとしては以下のとおりです.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "logs:PutLogEvents",
                "logs:CreateLogStream"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:logs:[region]:[account number]:log-group:[log group name]:*"
        },
        {
            "Action": [
                "lambda:List*",
                "lambda:Get*",
                "ecs:List*",
                "ecs:Get*",
                "ecs:Describe*",
                "ecr:List*",
                "ecr:Get*",
                "ecr:Describe*",
                "ecr:BatchGet*"
            ],
            "Effect": "Allow",
            "Resource": "*"
        },
        {
            "Action": [
                "ecr:BatchDeleteImage"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:ecr:[region]:[account number]:repository/*"
        }
    ]
}

KMS で ECR を暗号化している場合は追加で以下の権限を付与しました.

  • kms:List*
  • kms:Get*
  • kms:Describe*
  • kms:GenerateDataKey
  • kms:Encrypt

参考記事

zenn.dev

buildspec.yml の定義

ecrm は aqua でのインストールがサポートされているので aqua を使って導入することにしました.イメージ削除する時の CloudWatch Logs に結果を残すのですが, --no-color を指定しておくと視認性が良くなるため指定しました.

version: 0.2

env:
  shell: bash

phases:
  install:
    commands:
      - |
        [aqua install execution]
        aqua i -l

  build:
    commands:
      - ecrm --config="[cofig file path]" delete --force --no-color

参考記事

zenn.dev

zenn.dev

まとめ

ecrm を CodeBuild で稼働させるために行った設定をまとめました.




以上の内容はhttps://sadayoshi-tada.hatenablog.com/entry/2025/02/15/122839より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14