Skip to content

Instantly share code, notes, and snippets.

Last active May 22, 2023 22:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
`Failed to delete stack: Role <role> is invalid or cannot be assumed` Assume this role from the cli if your cloudformation stack can't delete

Create a role with a trust policy that can be assumed by Cloudformation. Trust policy looks like this:

    "Version": "2012-10-17",
    "Statement": [
            "Sid": "",
            "Effect": "Allow",
            "Principal": {
                "Service": ""
            "Action": "sts:AssumeRole"

Create a role with AdmininstratorAccess or something and attach the above trust policy (or just use the gui wizard). Give it a meaningful name, eg CfnAdmin. Then, you can delete your stack like this:

aws cloudformation delete-stack --stack-name name-of-stack-to-delete --role-arn arn:aws:iam::111111111111:role/CfnAdmin

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