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?

preguntada hace un año261 visualizaciones
1 Respuesta
2
Respuesta aceptada

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
respondido hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas