sbstjn / serverless-dynamodb-autoscaling

Serverless Plugin for Amazon DynamoDB Auto Scaling configuration.

Home Page:https://sbstjn.com/serverless-dynamodb-auto-scaling-with-cloudformation.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dynamodb already exists

sjernigan opened this issue · comments

FYI: I'm sure I could kill and redeploy my stack but adding this to an existing stack gives

An error occurred while provisioning your stack: myserviceAutoScalingTargetReadParticipantsDynamoDbTabledev - table/myservice_participants-dev|dynamodb:table:ReadCapacityUnits|dynamodb already exists.

Do you create your DynamoDB table with the same CloudFormation stack or does it already exists?

I created it with a CloudFormation stack and subsequently added this to that same stack.

Hi, I have exactly the same problem. Everything has been created using serverless (not manually) and I only updated this plugin from ^0.3.0 to the ^0.5.1. I also deleted the DynamoDB table but the error is still here (?).

An error occurred while provisioning your stack: chatbotAutoScalingTargetReadconversationsTablestaging - table/conversationsTable-staging|dynamodb:table:ReadCapacityUnits|dynamodb already exists in stack arn:aws:cloudformation:eu-west-1:00000:stack/chatbot-staging/...

Can you help me with this problem, please? 🙂

I just wanted to ask if you had already enabled Auto Scaling using the AWS Console and maybe a target gets not removed when you disable it. But you said you created everything using serverless :(

Can you provide steps or a sample configuration to reproduce the issue? Then I will definitely have a look into it.

I have successfully deployed complete new stacks with the plugin, as well as enabled Auto Scaling to DynamoDB tables in production. :(

I have an idea what could cause this.

I renamed some resources in the stack to ensure unique names/resources and so there might still exists the old AutoScalingTarget with the old resource identifier and this could collide with the new resource. 😢

Steps to reproduce:

  • install v0.3.0 and deploy Lambda with DynamoDB and autoscaling
  • upgrade to v0.5.1 (I believe v0.3.3 is the broken one) and try to deploy again
  • you should see the error

I have an idea what could cause this...

Your idea sounds right to me.

So far we have reverted back to the v0.3.0 (exact version). Also, I am ok with this change but I would welcome some info how to use newest versions without redeploying the whole stack... :)

The releases between 0.3 and 0.5 are mostly internal changes and offer no improvements regarding the Auto Scaling, so it should be fine if you just stay on 0.3 …

One solution would be to add an useOldNamingSchema property to the custom configuration and switch the naming schemas. But it would be very happy to avoid this ;)

Maybe it's possible for you to remove the "old" AutoScalingTarget using the AWS API/CLI/Console and then just run the deployment again.

You could deploy your stack without any Auto Scaling, this should throw all resources away. After that just redeploy your stack with the most recent plugin version and you should be fine!

What about supporting multi-region deployments within the same AWS account? Would it be possible to add the region to auto scaling user role?

<projectName>-DynamoDBAutoscaleRole-<DatabaseResourceName>-staging-<Region>

Multi-Region support will be added in the next version. See #21

I just pushed v0.6.0 to NPM with an updated naming schema @lucasklaassen and added a paragraph about breaking changes to the README.md.

@sbstjn Thanks, I can confirm that your migration guide works. Now let's upgrade it again to fix another bug: #22 😄

#22 is merged, hopefully everything is fine. I need some tests to test the generated CF resources. You are more than welcome to provide some ;)

FYI: I'm sure I could kill and redeploy my stack but adding this to an existing stack gives

An error occurred while provisioning your stack: myserviceAutoScalingTargetReadParticipantsDynamoDbTabledev - table/myservice_participants-dev|dynamodb:table:ReadCapacityUnits|dynamodb already exists.

HI, Can you tell me what exactly this error means ? Does this means dynamodb table already exists or something else ?