aws / serverless-application-model

The AWS Serverless Application Model (AWS SAM) transform is a AWS CloudFormation macro that transforms SAM templates into CloudFormation templates.
https://aws.amazon.com/serverless/sam
Apache License 2.0
9.36k stars 2.38k forks source link

Feature Request: Add retention policy to DynamoDB properties #940

Closed allanchua101 closed 5 years ago

allanchua101 commented 5 years ago

In order to protect data stored in DynamoDB, we need a mechanism to retain it after decommissioning a CF stack. This is currently possible on Cloud Formation but not in SAM. I am getting the exception below:

Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Applica tion Specification document. Number of errors found: 1. Resource with id [WatchHistory] is invalid. property RetentionPolicy not defined for resource of type AWS::Serverless::SimpleTable

imangerah commented 5 years ago

@allanchua101 we have worked around this by using AWS::DynamoDB::Table directly in our SAM templates or via a nested stack if you wish to keep your DB definitions in a separate template.

jlhood commented 5 years ago

@allanchua101 RetentionPolicy is not a valid CloudFormation resource attribute. You should use DeletionPolicy with a value of Retain to keep a resource after stack deletion. SAM does support adding DeletionPolicy to AWS::Serverless::SimpleTable resource types.

allanchua101 commented 5 years ago

@allanchua101 RetentionPolicy is not a valid CloudFormation resource attribute. You should use DeletionPolicy with a value of Retain to keep a resource after stack deletion. SAM does support adding DeletionPolicy to AWS::Serverless::SimpleTable resource types.

Why? IMHO, It's very useful based from what I saw from the other forums.