AWS Resource Deletion Policy - krdheeraj51/aws-labs GitHub Wiki
In AWS CloudFormation, the DeletionPolicy attribute allows you to specify what happens to a resource when its stack is deleted. This attribute can help you preserve, backup, or delete resources based on your requirements.
DeletionPolicy Options:
Retain:
- The resource is kept and not deleted when the stack is deleted.
- Useful for resources that contain important data you want to preserve, such as S3 buckets or RDS databases.
Snapshot:
- A snapshot of the resource is created before it is deleted.
- Applicable to resources like RDS databases and EBS volumes.
- Ensures you have a backup of the resource data.
Delete:
- The resource is deleted when the stack is deleted.
- This is the default behavior if no DeletionPolicy is specified.