Interview Prep/AWS/EC2, Auto Scaling and Load Balancing

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 →

  1. Create the profile and add the role to it: aws iam create-instance-profile --instance-profile-name app-profile then aws iam add-role-to-instance-profile --instance-profile-name app-profile --role-name app-role
  2. 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.

aws All AWS questions Roadmap: AWS core services

More on EC2, Auto Scaling and Load Balancing