Hi@MD,
You need to import the boto3 module in your script. After you can use this module according to your requirement as shown below
import boto3
 ec2 = boto3.resource('ec2')
 for instance in ec2.instances.all():
     print(
         "Id: {0}\nPlatform: {1}\nType: {2}\nPublic IPv4: {3}\nAMI: {4}\nState: {5}\n".format(
         instance.id, instance.platform, instance.instance_type, instance.public_ip_address, instance.image.id, instance.state
         )
     )
Get ready to level up your skills as an AWS Developer! Join our comprehensive AWS Developer Associate certification Course!