aws-amplify / amplify-category-api

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
https://docs.amplify.aws/
Apache License 2.0
88 stars 76 forks source link

Support DeletionPolicy Retain for DynamoDB resources #601

Open maximelebastard opened 4 years ago

maximelebastard commented 4 years ago

Is your feature request related to a problem? Please describe. I'm using Amplify in production for critical client data. I know I can't fully rely on Amplify to not delete my production data in the case of a mistake (Renaming a model by mistake for example). I can only rely on PITR Backups, but restoring them can take too long as we have to contact support if the Table has already been deleted.

Describe the solution you'd like I'd like to be able to use the Deletion Policy Retain in the stack generated for DynamoDB tables. This would ensure me that even if the stack is deleted, the production data is safe.

Describe alternatives you've considered I'm denying the table deletion to the Amplify Role. But it creates many issues and it's absolutely not comfortable to use. I also enabled PITR recovery, but it only limits the damages it doesn't prevent any incident.

arantespp commented 4 years ago

This enhancement should also be extended to S3 and Cognito User Pools.

MontoyaAndres commented 3 years ago

Any updates about this?

flogy commented 3 years ago

I just released a custom GraphQL directive for Amplify to set the deletion policy of generated DynamoDB tables to Retain. Like this it won't be deleted anymore when you change the name of a type or remove a type entirely!

In the end you can just add @retain directive to your schema like this:

type Todo @model @retain {
  id: ID!
  title: String!
  description: String
}

Check out the full installation instructions: https://github.com/flogy/graphql-retain-transformer

And please leave a ⭐️ if you like it! 😊 Thanks!

GeorgeBellTMH commented 3 years ago

This is related to: aws-amplify/amplify-category-api#235