Interview Prep/AWS/CloudFormation, CloudWatch, KMS, Secrets and Cost

`InsufficientCapabilitiesException: Requires capabilities : [CAPABILITY_NAMED_IAM]`.

BeginnerTroubleshootingCloudFormation, CloudWatch, KMS, Secrets and Cost
Answer

Likely causes → The template creates IAM resources with custom names (RoleName, PolicyName). CloudFormation makes you acknowledge that explicitly. Templates that use Transform macros (SAM) also need CAPABILITY_AUTO_EXPAND.

Diagnose →

grep -nE 'AWS::IAM::|RoleName|Transform' template.yaml

Fix →

aws cloudformation deploy --template-file template.yaml --stack-name app \
  --capabilities CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND

Prevent → Avoid hard-coded IAM names (let CloudFormation generate them) so you only need CAPABILITY_IAM, and let only reviewed pipelines pass capabilities.

aws All AWS questions Roadmap: Cloud cost & architecture

More on CloudFormation, CloudWatch, KMS, Secrets and Cost