DbSubnetGroup stack already exists (CloudFormation Stack issue)

0

Hello, I am trying to deploy using serverless, I had an exisiting stack which got deleted and upon redeploying, the code is now giving error on DBSubnet sThe DB subnet group 'asdsdafdsf' already exists. THe DBSubnet is not part of the current successful deployemnt in the resources, but if added it throws the error it exists. How can i fix it.

1 Answer
0

If that subnet group is not required, update the cloudformation stack again by changing the logical id and name of the subnet group in the template.

This way new subnet group would be created and used in database.

Note: Cloudformation first creates the resources and then delete the missing one from change set. In your case, it's trying to create one with same name, which is why you are stuck.

Additional context: If database was created through cloudfromation and set to retain, then even if cloudfromation stack gets deleted, default subnet group would also be retained as it can't be detached from DB, since it's default one. So you may want to create a new one or make sure DB provisioned from previously deployed template is also wiped off and then you can deploy this stack without any change. I hope this is non-production environment where you can provision resources again after deleting them.

Hope this helps.

Abhishek

profile pictureAWS
EXPERT
answered 9 months ago
  • Do you have any questions further, happy to help.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions