How to continue deploy if DynamoDb table already exists

Marckaraujo picture Marckaraujo · Jan 12, 2017 · Viewed 11.5k times · Source

I'd like to continue the deployment (or force) even if a resource already exists.

Atm I got this error:

Serverless Error ---------------------------------------

     An error occurred while provisioning your stack: AvailableDynamoDbTable
     - Available already exists.

Answer

Gábor Pintér picture Gábor Pintér · Jan 21, 2019

This question is fairly old, but still shows up in the top 5 results in Google, so here is a bit of an insight: It's a good idea to split up your serverless stack into multiple services, each having its own serverless.yml file. One for your API and lambdas, one for your DynamoDB. This way you can deal with them separately and update your lambdas without touching your DB. Here is a great guide on that:

  1. https://serverless-stack.com/chapters/organizing-serverless-projects.html
  2. https://serverless-stack.com/chapters/dynamodb-as-a-serverless-service.html
  3. https://serverless-stack.com/chapters/deploying-multiple-services-in-serverless.html