A lightweight, powerful bash script to monitor and report your AWS resource usage across multiple services in seconds.
This script provides a comprehensive snapshot of your AWS infrastructure by listing:
- S3 Buckets - All storage buckets in your account
- EC2 Instances - Running and stopped compute instances
- Lambda Functions - Serverless functions and their configurations
- IAM Users - All user accounts and their details
Quickly identify unused or forgotten resources that may be costing you money. Spot that S3 bucket you created months ago or EC2 instances left running after testing.
Regularly review your IAM users and ensure no unauthorized accounts exist. Track who has access to your AWS environment.
Get an instant inventory of your AWS resources without logging into the console. Perfect for documentation, compliance reports, or quick checks.
Integrate into your CI/CD pipelines or cron jobs to maintain automated resource tracking. Great for team visibility and infrastructure monitoring.
Ideal for developers learning AWS or managing multiple accounts. Understand what resources you have deployed at a glance.
Before running this script, ensure you have the following installed and configured:
-
AWS CLI - Install from AWS CLI Installation Guide
# Verify installation aws --version -
jq - JSON processor for parsing AWS CLI output
# macOS brew install jq # Linux (Ubuntu/Debian) sudo apt-get install jq # Verify installation jq --version
-
AWS Credentials - Configure your AWS credentials
aws configure
You'll need to provide:
- AWS Access Key ID
- AWS Secret Access Key
- Default region name
- Default output format (json recommended)
Your AWS IAM user/role needs the following permissions:
s3:ListAllMyBucketsec2:DescribeInstanceslambda:ListFunctionsiam:ListUsers
git clone https://github.com/rishis26/aws_resource_tracker.git
cd aws_resource_tracker
chmod +x aws_resource_tracker.sh
./aws_resource_tracker.sh# Download the script directly
curl -O https://raw.githubusercontent.com/rishis26/aws_resource_tracker/main/aws_resource_tracker.sh
# Make it executable
chmod +x aws_resource_tracker.sh
# Run it
./aws_resource_tracker.shbash <(curl -s https://raw.githubusercontent.com/rishis26/aws_resource_tracker/main/aws_resource_tracker.sh)The script will display:
- A list of all S3 bucket names
- EC2 instance IDs for all instances in your account
- Details of all Lambda functions
- Information about all IAM users
Debug output is enabled (set -x), so you'll see each command as it executes.
+ echo 'Print list of s3 Buckets'
Print list of s3 Buckets
+ aws s3 ls
2025-01-15 10:30:45 my-bucket-1
2025-02-20 14:22:10 my-bucket-2
+ echo 'Print list of EC2 Instances'
Print list of EC2 Instances
+ aws ec2 describe-instances
+ jq '.Reservations[].Instances[].InstanceId'
"i-1234567890abcdef0"
"i-0987654321fedcba0"
...
Install the AWS CLI using the prerequisites section above.
Install jq using the prerequisites section above.
Run aws configure to set up your AWS credentials.
Your AWS user/role lacks the necessary permissions. Contact your AWS administrator to grant the required permissions listed above.
Rishi Shah
v2 - 17th November 2025
- Run this script regularly (daily/weekly) to stay on top of your AWS resources
- Redirect output to a file for historical tracking:
./aws_resource_tracker.sh > report_$(date +%Y%m%d).txt - Use it before month-end to review resources and optimize costs
- Combine with other scripts for automated reporting and alerts