Skip to content

feat: add --express flag to sam delete#9116

Merged
tobixlea merged 6 commits into
aws:developfrom
koteshyelamati:feat-delete-express
Jul 9, 2026
Merged

feat: add --express flag to sam delete#9116
tobixlea merged 6 commits into
aws:developfrom
koteshyelamati:feat-delete-express

Conversation

@koteshyelamati

Copy link
Copy Markdown
Contributor

Closes #9115

Which issue(s) does this change fix?

#9115

Why is this change necessary?

#9106 added --express/--no-express support to sam deploy and sam sync for CloudFormation Express mode, but sam delete does not expose the same flag. For teams using express mode during development, delete is part of the same iteration loop: without express support on sam delete, teardown stays on the slower standard path even when the stack was created with --express.

How does it address the issue?

Mirrors the deploy/sync implementation for the delete path:

  • sam delete gains --express/--no-express (default: off, backwards compatible). The flag is persisted to samconfig.toml via the existing --save-params machinery, consistent with deploy/sync.
  • When enabled, DeleteContext passes DeploymentConfig={"Mode": "EXPRESS"} to every CloudFormation DeleteStack call (main stack, ECR companion stack, and the retain_resources retry paths).
  • CfnUtils.delete_stack accepts an optional deployment_config and only includes DeploymentConfig in the boto call when provided, so non-express behaviour is byte-for-byte unchanged.
  • After a successful express delete, a yellow notice is printed that some resources may still be removing in the background — consistent with the deploy/sync messaging from feat: add --express flag to sam deploy and sam sync #9106.
  • The express option is registered in the delete help formatter (core/options.py).

The guided cleanup of S3 artifacts, ECR images, and companion stacks is unchanged — express mode only affects the CloudFormation stack deletion calls, which is what the current aws cloudformation delete-stack --deployment-config workaround bypasses.

What side effects does this change have?

None when the flag is not used: DeleteStack is called with exactly the same arguments as before.

Checklist

  • Add input/output type hints to new functions/methods
  • Write unit tests: flag plumbing from do_cli to DeleteContext, and CfnUtils.delete_stack with/without DeploymentConfig (all tests/unit/commands/delete and tests/unit/lib/delete pass)

@koteshyelamati koteshyelamati requested a review from a team as a code owner July 6, 2026 20:24
@github-actions github-actions Bot added area/delete pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Jul 6, 2026
- Add test_delete_express_mode: deploys a stack, deletes with --express,
  verifies express mode message and stack deletion
- Add express parameter to get_delete_command_list helper
- Regenerate schema/samcli.json to include express option for delete command
@roger-zhangg

Copy link
Copy Markdown
Member

Thanks for the contribution @koteshyelamati ! The change LGTM, I added integ test & schema update.

@tobixlea tobixlea added this pull request to the merge queue Jul 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 8, 2026
@tobixlea tobixlea added this pull request to the merge queue Jul 9, 2026
Merged via the queue into aws:develop with commit aa228f8 Jul 9, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/delete pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: add --express flag to sam delete

3 participants