in scripts/aws_plot.py [0:0]
def set_hosts(value ='running', instance_type='dev', region=region):
ec2resource = boto3.resource('ec2')
instances = ec2resource.instances.filter(Filters=[{'Name': 'instance-state-name', 'Values': [value]}])
for instance in instances:
for tag in instance.tags or []:
if 'Name'in tag['Key']:
name = tag['Value']
if instance_type in name:
instances_id.append(instance.id)
env.roledefs['dev'].append(instance.public_ip_address)