AWS – EC2 inventory Report across Organization

Managing resources efficiently is a key aspect of any AWS (Amazon Web Services) environment. Among the numerous services offered by AWS, EC2 (Elastic Compute Cloud) instances are fundamental for hosting applications and workloads. Keeping track of your EC2 inventory is crucial for optimizing costs, ensuring security, and maintaining overall system health.

In this blog post, we’ll explore how to fetch an AWS EC2 inventory report using PowerShell, providing a streamlined approach to stay on top of your cloud resources.

I am sharing this sample script which you can modify accordingly as per your environment to get the AWS EC2 inventory.

Logic is to assume role, go thru each region and account to find the inventory across whole AWS organization.

Prerequisites for this Solution:

Download the script from Git or PowerShell gallery from below links:

Git:

https://github.com/VikasSukhija/Downloads

AWSEC2Inventory.ps1

PowerShell Gallery:

https://www.powershellgallery.com/packages/AWSEC2Inventory

Install-Script -Name AWSEC2Inventory

Update the below section of the script with your own parameters:


This script needs access and secret key of the account that can assume a role that has access to read the EC2 across the whole organization.

Note: Please secure the access key and secret key as encrypted if you will schedule this script in production.

Script will fetch below details for each EC2 instance, will generate csv file and send on email.


Here is the Email that email address mentioned in variable will receive.


Here is the CSV report that your will get:


I hope this script will assist you in getting the EC2 inventory from your organization AWS instance.

 

 

Thanks for reading and downloading…

Tech Wizard

 

https://techwizard.cloud

https://syscloudpro.com/

PowerShell Fast Track

 

Leave a comment