I'm not sure how to display the name of my instance in AWS EC2 using boto3
This is some of the code I have:
import boto3
ec2 = boto3.resource('ec2', region_name='us-west-2')
vpc = ec2.Vpc("vpc-21c15555")
for i in vpc.instances.all():
print(i)
What I get in return is
...
...
...
ec2.Instance(id='i-d77ed20c')
I can change i to be i.id or i.instance_type but when I try name I get:
AttributeError: 'ec2.Instance' object has no attribute 'name'
What is the correct way to get the instance name?