Interview Prep/AWS/IAM and Access Errors

An IAM role created by CloudFormation cannot be assumed by a Lambda: `The role defined for the function cannot be assumed by Lambda`.

IntermediateTroubleshootingIAM and Access Errors
Answer

Likely causes → Trust policy missing lambda.amazonaws.com, or the role was just created.

Diagnose →

aws iam get-role --role-name fn-role --query Role.AssumeRolePolicyDocument

Fix →

  1. Add lambda.amazonaws.com to trust policy
  2. Add DependsOn or wait; retry creation

Prevent → Use SAM or CDK helpers that wire trust automatically.

aws All AWS questions Roadmap: AWS core services

More on IAM and Access Errors