Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to delete cfn stack, role is invalid or cannot be assumed

I'm new to aws cloudformation; I'm wondering if anybody knows of a way to force delete a stack when it just won't delete. It fails with this error:

Failed to delete stack: Role arn:aws:iam::role/CloudFormationRole-NestedCFN-CodePipeline is invalid or cannot be assumed 

This error usually happens when I try to delete a nested child stack instead of starting by deleting the parent stack first. Is there any way to delete the nested stack if I accidentally deleteted the parent stack?

like image 547
pelican Avatar asked Feb 09 '18 15:02

pelican


People also ask

Can I delete CDKToolkit stack?

If you would like to delete this stack, it will have to be done through the CloudFormation console. Head over to the CloudFormation console and delete the CDKToolkit stack.

How long does it take to delete a stack in AWS?

The default value is 60 seconds.


1 Answers

I got the same problem and the only way to delete the stack was using the AWS CLI and executing the following command:

aws cloudformation delete-stack --role-arn arn:aws:iam::xxxx:role/anyrolewithpermissions --stack-name StuckStack 

just be sure to use another role with enough permissions.

like image 58
Juan Zapata Avatar answered Oct 06 '22 15:10

Juan Zapata