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": "cloudformation.amazonaws.com"
},
"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