aws-amplify / aws-amplify/amplify-cli
Amplify managed resources should have DeletionPolicy set to "Delete" by default
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### Is this feature request related to a new or existing Amplify category?
storage
### Is this related to another service?
_No response_
### Describe the feature you'd like to request
Storage and deployment S3 buckets managed by Amplify have `DeletionPolicy: Retain` set by default. This means that when Amplify backends and their CF stacks are deleted these resources remain in our account.
Since we are using PR previews with our Amplify app, these orphaned S3 buckets pile up and will eventually lead to a quota exhaustion, at which point no PR previews will succeed.
This means that someone has to go into the AWS console and manually empty and delete hundreds of orphaned S3 buckets, which is time consuming since there's no bulk management tools for these operations. Also, these extra buckets cost us money in billed resources.
### Describe the solution you'd like
Amplify should set `DeletionPolicy: Delete` on all managed resources. If needed, this should be override-able in either a CF JSON file or via the Amplify CLI.
### Describe alternatives you've considered
It doesn't appear that I can edit the CF templates that create these resources. There is no editable CF fragment in the `amplify/backend/storage/[name]` directory and no editable fragment for the deployment bucket itself.
### Additional context
This would be a good policy for *ALL* Amplify-managed resources (Opensearch instances, etc...)
### Is this something that you'd be interested in working on?
- [ ] 👋 I may be able to implement this feature request
### Would this feature include a breaking change?
- [ ] ⚠️ This feature might incur a breaking change
Contributor guide
Research direction
Start by tracing how Amplify CLI generates the CloudFormation templates for storage buckets and the deployment bucket; the issue specifically notes amplify/backend/storage/[name] and the absence of editable fragments. Determine how a default Delete policy could cover managed resources and how a CF JSON or CLI override would work. Done means managed resources use Delete by default, with the intended override and breaking-change behavior documented and tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cli, cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100