Added python code to describe ec2 instances (using boto3 library).
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import boto3
|
||||
|
||||
session = boto3.Session (region_name = "ap-south-1")
|
||||
|
||||
ec2_instances = session.resource('ec2').instances.all()
|
||||
|
||||
for instance in ec2_instances:
|
||||
print(f"ID: {instance.id}, State: {instance.state['Name']}, Type: {instance.instance_type}, Public IP: {instance.public_ip_address}")
|
||||
Reference in New Issue
Block a user