Skip to content

Commit f6f0ce6

Browse files
committed
minor
1 parent 9c3ca3d commit f6f0ce6

File tree

1 file changed

+11
-0
lines changed
  • packages/aws-library/src/aws_library/ec2

1 file changed

+11
-0
lines changed

packages/aws-library/src/aws_library/ec2/_client.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ async def launch_instances(
166166
_logger.debug(
167167
"Attempting to launch instances in subnet %s", subnet_id
168168
)
169+
169170
instances = await self.client.run_instances(
170171
ImageId=instance_config.ami_id,
171172
MinCount=min_number_of_instances,
@@ -199,6 +200,16 @@ async def launch_instances(
199200
# If we get here, the launch succeeded
200201
break
201202
except botocore.exceptions.ClientError as exc:
203+
# AI says run_instances may raise the following errors:
204+
# InsufficientInstanceCapacity, when a subnet does not have enough capacity
205+
# InstanceLimitExceeded, when the AWS account has reached its limit of instances for this region
206+
# InvalidAMIID.NotFound, when the AMI ID does not exist
207+
# InvalidSubnetID.NotFound, when the subnet does not exist
208+
# InvalidGroupId.NotFound, when a security group does not exist
209+
# InvalidKeyPair.NotFound, when the key pair does not exist
210+
# UnauthorizedOperation, when the credentials do not have permissions to launch instances
211+
# InvalidInstanceType, when the instance type is not valid
212+
202213
error_code = exc.response.get("Error", {}).get("Code")
203214
if error_code == "InsufficientInstanceCapacity":
204215
_logger.warning(

0 commit comments

Comments
 (0)