Skip to content

Conversation

@fsatsuki
Copy link
Contributor

Description

This PR fixes the Step Functions state machine for AMI cleanup (issue #171). The current implementation attempts to delete snapshots in parallel with deregistering AMIs, which causes errors since snapshots that are in use by AMIs cannot be deleted.

Changes

  • Modified the state machine in asl.json to ensure that AMIs are deregistered before attempting to delete their associated snapshots
  • Replaced the parallel execution with a sequential workflow:
    1. Delete Image Builder Image
    2. Deregister AMI
    3. Delete associated snapshots

This change ensures that snapshots are only deleted after the AMI has been successfully deregistered, which should resolve the error:

"Error": "Ec2.Ec2Exception", 
"Cause": "The snapshot snap-0xxxxxxxxxxxx is currently in use by ami-xxxxxxxxxxxx"

Fixes #171

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ec2-gc: DeleteSnapshotInMap is failing

1 participant