JeremDem
JeremDem

Reputation: 51

Is it safe to update infrastructure using AWS CDK

We plan to deploy a serverless backend using serverless stack toolkit, based on AWS CDK.

I know that some AWS resources cannot be updated. For example, it is not possible to create a new sort key on an existing dynamodb table. I suppose that this update is automatically realized using AWS CDK : the table to update is destroyed and then created using the new schema. This can cause huge problem on an existing application in production...

How can we determine which kind of update is safe and which kind of update is critical?

If you are using AWS CDK, how do you manage infrastructure updates?

Upvotes: 1

Views: 1617

Answers (1)

Martin Trenker
Martin Trenker

Reputation: 86

You can check the CloudFormation documentation for exactly that info, let's stay with your DynamoDB Key Question, if you look at the CloudFormation Documentation for AWS::DynamoDB::Table under KeySchema you will see the Field Update Requires: Replacement, what exactly that means is explained on Update behaviors of stack resources

To extend that question to "Is it safe?" I would say yes but this doesn't mean that you can't mess things up. For example, you can set RemovalPolicy to Retain (more on removal here) to make sure that CloudFormation will not delete your Table even when you destroy your Stack.

Upvotes: 5

Related Questions