Checking EC2 spot instance via boto3

0

If an instance is running, and I have the ID plus region plus the usual info, is there a way to check whether the instance is spot or on-demand using boto3?

asked a year ago241 views
1 Answer
2
Accepted Answer

Yes, you can use ec2.describe_instances() and check for the InstanceLifecycle value which for a spot instance will be 'spot'. There may also be a 'SpotInstanceRequestId' value.

AWS
Alex_K
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions