Skip to content

(3.0.0‐3.16.2) Build image stack deletion failure

hgreebe edited this page Nov 19, 2026 · 1 revision

The issue

CloudWatch Logs is changing how it authorizes Log Group actions: IAM statements must use a Log Group ARN log-group:<name>). A Log Stream ARN log-group:<name>:*) will no longer grant Log Group actions.

The default cleanup role that ParallelCluster uses for pcluster build-image grants logs:DeleteLogGroup only on the Log Stream ARN:

arn:<partition>:logs:*:<account-id>:log-group:/aws/lambda/ParallelClusterImage-*:*

After the change, the cleanup Lambda can no longer delete its own log group. The build image stack then ends in DELETE_FAILED. The stack and its resources are left behind. The build image itself succeeds, the AMI is created and can be used in clusters as usual.

Affected ParallelCluster versions, OSes and schedulers

  1. ParallelCluster version 3.0.0 to 3.16.2
  2. All OSes and schedulers

Mitigation

Option 1: Upgrade

Upgrade ParallelCluster to 3.16.3 or later. The first pcluster build-image creates the role with the updated policy.

Option 2: Update the existing cleanup role (3.14.0 to 3.16.2)

In ParallelCluster versions < 3.14.0, the cleanup role is created per build as part of each image's own CloudFormation stack. For clusters of versions < 3.14.0, you must use either option 3 or 4.

  1. Open the IAM console and find the role named PClusterBuildImageCleanupRole-<hash>-v2 (-v1 for 3.14.0). If the role does not exist yet, run pcluster build-image once with your version, then come back.
  2. Open its inline policy ParallelClusterCleanupInline and choose Edit.
  3. Find the logs:DeleteLogGroup statement and remove the trailing :* from its resource:
Before: arn:aws:logs:*:<account-id>:log-group:/aws/lambda/ParallelClusterImage-*:*
After:  arn:aws:logs:*:<account-id>:log-group:/aws/lambda/ParallelClusterImage-*
  1. Save the policy.

The new resource still covers everything the old one did, so the cleanup keeps working today and after the CloudWatch Logs change. ParallelCluster does not rewrite this policy once the role is set up, so the change persists.

Option 3: use a custom cleanup role (applicable to all versions, required before 3.14.0)

Create a cleanup role with the same permissions as the cleanup role ParallelCluster creates for your version, plus logs:DeleteLogGroup on the Log Group ARN:

{
  "Effect": "Allow",
  "Action": "logs:DeleteLogGroup",
  "Resource": "arn:<partition>:logs:*:<account-id>:log-group:/aws/lambda/ParallelClusterImage-*"
}

Then set it in the image configuration of every build:

Build:
  Iam:
    CleanupLambdaRole: arn:<partition>:iam::<account-id>:role/<your-cleanup-role>

Image stacks created before you set the custom role keep their own cleanup role. If they end in DELETE_FAILED, see the next section.

Option 4: Manually delete a build image stack in DELETE_FAILED

Delete the stack with aws cloudformation delete-stack --stack-name <image-id> --region <region>. This runs with your credentials, which with the ParallelCluster user policies already include logs:DeleteLogGroup on the Log Group ARN. This will delete the stack but not the AMI.

Clone this wiki locally