This Python script uses the Boto3 library to retrieve details about your EC2 instances in a specified AWS region. The script retrieves the instance ID, status, and region for each EC2 instance and prints them to the console.
- Python 3.x
- Boto3 library
- AWS access key ID and secret access key with permissions to access EC2 instances in the specified region
- Clone or download the repository to your local machine.
- Install the Boto3 library by running the following command in your terminal or command prompt:
- Open the
retrieve_ec2_instance_details.py
file in your preferred text editor. - Replace the values for
aws_access_key_id
,aws_secret_access_key
, andregion_name
with your AWS credentials and the region you want to retrieve EC2 instance details from. - Save and close the file.
- In your terminal or command prompt, navigate to the directory where the
retrieve_ec2_instance_details.py
file is located. - Run the following command to execute the script:
- The script will retrieve the instance ID, status, and region for each EC2 instance in the specified region and print them to the console.