ASG activity fails: `Value (app-profile) for parameter iamInstanceProfile.name is invalid. Invalid IAM Instance Profile name`.
BeginnerTroubleshootingEC2, Auto Scaling and Load Balancing
Answer
Likely causes → The instance profile does not exist, or it was just created and has not propagated yet. Another common cause: the role was created in the console with a different profile name, or created through the CLI without a profile.
Diagnose →
aws iam get-instance-profile --instance-profile-name app-profile
aws iam list-instance-profiles-for-role --role-name app-role
Fix →
- Create the profile and add the role to it:
aws iam create-instance-profile --instance-profile-name app-profilethenaws iam add-role-to-instance-profile --instance-profile-name app-profile --role-name app-role - Wait a few seconds after creating it, then retry the launch
Prevent → In IaC, create aws_iam_instance_profile explicitly and reference it, so the dependency order is correct.