Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sivaramsajeev/9d47d8b89c2a818e296f825b5bd1155f to your computer and use it in GitHub Desktop.
Save sivaramsajeev/9d47d8b89c2a818e296f825b5bd1155f to your computer and use it in GitHub Desktop.
Unable to delete cfn stack, role is invalid or cannot be assumed
The reason you get this error is because you probably deleted a CloudFormation stack that has an IAM role
that's being used by the stack you're trying to delete.
Follow the steps below to get rid of the mess
=================================================================
1) Create a new role (eg: myStackDeleterRole). Key is to attach `CloudFormation` as the service that assumes this role
2) Attach the required Policy. (You could play around here till finding the right set of permissions OR attach AdministratorAccess straight away)
3) Run the below command from CLI
```aws cloudformation delete-stack --role-arn arn:aws:iam::<account>:role/myStackDeleterRole --stack-name <theStuckStack>```
4) After you delete the CloudFormation stack, you can delete the IAM role you just created OR keep it for the next mess
https://aws.amazon.com/premiumsupport/knowledge-center/cloudformation-stack-delete-failed/
https://stackoverflow.com/questions/48709423/unable-to-delete-cfn-stack-role-is-invalid-or-cannot-be-assumed
@ManuelSanchezAcosta
Copy link

Thanks a lot !!! It Works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment