Skip to content

Conversation

@sai-ray
Copy link

@sai-ray sai-ray commented Oct 27, 2025

Description of changes


This PR implements the validate() method for decommission command to ensure decommissioning won't accidentally delete stateful resources. The implementation uses CloudFormation change sets to preview what resources would be deleted during decommissioning without actually performing the deletion. The change set is created with an empty template ( { Resources: {} }), which simulates deleting all stack resources, allowing us to validate the impact before execution.

Flow:

  1. Get Stack Name - Retrieves from stateManager.getMeta(). Stack name format is amplify-{appId}-{envName}, which CloudFormation uses as the unique identifier.
  2. Create Change Set - Uses Date.now() for unique naming. Empty template simulates deleting all resources.
  3. Wait for Completion - waitUntilChangeSetCreateComplete with maxWaitTime: 120 secs (SDK default) polls until CloudFormation computes all changes.
  4. Describe & Store - Retrieves change set details into local variable for validation.
  5. Cleanup - Deletes change set from AWS.

Lint Suppressions:
@typescript-eslint/no-explicit-any (line 17): validateStatefulResources() doesn't use context, so {} as any is acceptable.
spellcheck/spell-checker (line 19): "Stateful" is valid technical terminology.

Issue #, if available

PR #14297

Description of how you validated changes

Checklist

  • PR description included
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sai-ray sai-ray requested a review from a team as a code owner October 27, 2025 20:33
@sai-ray sai-ray changed the title Sai/validate decommission for gen2 migration feat(gen2-migration): implement stateful resources validation for decommission command Oct 27, 2025
@sai-ray sai-ray marked this pull request as draft October 27, 2025 22:11
@sai-ray sai-ray marked this pull request as ready for review October 30, 2025 05:04
@sai-ray sai-ray marked this pull request as draft October 30, 2025 05:04
@sai-ray sai-ray force-pushed the sai/validate-decommission-for-gen2-migration branch from b6892a6 to 3dd1780 Compare November 4, 2025 16:16
@sai-ray sai-ray marked this pull request as ready for review November 4, 2025 16:23
@sai-ray sai-ray marked this pull request as draft November 7, 2025 18:53
@sai-ray sai-ray closed this Nov 7, 2025
@sai-ray sai-ray deleted the sai/validate-decommission-for-gen2-migration branch November 17, 2025 22:31
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.

1 participant