This repository has been archived by the owner on Mar 18, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retry EC2 run_instances on "Invalid IAM Instance Profile name" errors
Instance creation could fail with an error like this if the IAM instance profile for the instance was created a short time before run_instances, and had not yet propagated (which happened nearly every time on fast networks): "Instance creation failed => InvalidParameterValue: Value (xxx_profile) for parameter iamInstanceProfile.name is invalid. Invalid IAM Instance Profile name" We modify ec2.py to use an "EC2Retry" wrapper that inherits from CloudRetry and wraps run_instances, detects the InvalidParameterValue exception with the 'iamInstanceProfile.name is invalid' message, and retries that request a few times. Incidentally, terraform has the same problem and used the same fix, right up to using string matching on the error message to figure out whether it's the right error or not: hashicorp/terraform-provider-aws#3055
- Loading branch information