cloudformation-coverage-roadmap icon indicating copy to clipboard operation
cloudformation-coverage-roadmap copied to clipboard

AWS::ImageBuilder::Image delete AMI when the stack is deleted

Open mhtrinhLIC opened this issue 3 years ago • 1 comments

Name of the resource

AWS::ImageBuilder::Image

Resource name

No response

Description

I am using AWS::ImageBuilder::Image through CDK CfnImage, so the please let me know if it's a CDK question.

Currently, AMI are created with AWS::ImageBuilder::Image in the stack. But when the stack is deleted, the AMI is still there. Is this expected ?

I would expect it to be deleted along side with the stack as any other resource type. Or is it possible to have a Rention flag option ?

Other Details

No response

mhtrinhLIC avatar Aug 16 '22 10:08 mhtrinhLIC

Deletion of underlying resources is supported in CloudFormation now, with the DeletionSettings property on AWS::ImageBuilder::Image. Example:

Image:
  Type: AWS::ImageBuilder::Image
  Properties:
    # Deletes underlying AMIs/containers on replace/delete
    DeletionSettings:
      ExecutionRole: !Ref 'LifecycleExecutionRole'
    ...

tarunb12 avatar Nov 24 '25 16:11 tarunb12