Использование метода boto3 Resource:
import boto3
ec2_resource = boto3.resource('ec2', region_name='ap-southeast-2')
instance = ec2_resource.Instance('i-12345')
if instance.state['Name'] == 'running':
print('It is running')
Использование метода клиента boto3:
import boto3
ec2_client = boto3.client('ec2', region_name='ap-southeast-2')
response = ec2_client.describe_instance_status(InstanceIds=['i-12345'])
if response['InstanceStatuses'][0]['InstanceState']['Name'] == 'running':
print('It is running')