Repository navigation
(3.0.0‐3.16.2) Build image stack deletion failure
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.
- ParallelCluster version 3.0.0 to 3.16.2
- All OSes and schedulers
Upgrade ParallelCluster to 3.16.3 or later. The first pcluster build-image creates the role with the updated policy.
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.
- Open the IAM console and find the role named
PClusterBuildImageCleanupRole-<hash>-v2(-v1for 3.14.0). If the role does not exist yet, runpcluster build-imageonce with your version, then come back. - Open its inline policy
ParallelClusterCleanupInlineand choose Edit. - Find the
logs:DeleteLogGroupstatement 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-*
- 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.
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.
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.