Я не понимаю, что вы пытаетесь сделать.
regions = ['us-east-2','us-east-1']
for region in regions:
conn = boto3.resource('ec2', aws_access_key_id=access_key, aws_secret_access_key=secret_key,region_name=region)
instances = conn.instances.filter(Filters=[{'Name': 'instance-state-name', 'Values': ['running', 'stopped']}])
for instance in instances:
instance_count.append(instance)
instanceCount = str(len(instance_count))
print('Instance count ->' + str(len(instance_count)))
Чтобы напечатать количество экземпляров,
regions = ['us-east-2','us-east-1']
num = 0
for region in regions:
conn = boto3.resource('ec2', aws_access_key_id=access_key, aws_secret_access_key=secret_key,region_name=region)
instances = conn.instances.filter(Filters=[{'Name': 'instance-state-name', 'Values': ['running', 'stopped']}])
for instance in instances: num += 1
print('Instance count -> {}'.format(num))