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?

demandé il y a un an254 vues
1 réponse
2
Réponse acceptée

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
répondu il y a un an

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions