The AWS Resource Tracker is a simple Bash script designed to report usage statistics for various AWS resources. This script utilizes the AWS CLI to gather information about AWS S3 buckets, EC2 instances, Lambda functions, and IAM users, making it easier to monitor your cloud resources.
- S3 Buckets: Lists all S3 buckets and saves the details to a file.
- EC2 Instances: Retrieves and displays a list of all EC2 instances.
- Lambda Functions: Lists all available Lambda functions in your AWS account.
- IAM Users: Outputs a list of IAM users.
Before running the script, ensure the following:
- AWS CLI: The AWS CLI must be installed and configured with appropriate access keys and permissions. Follow AWS CLI Installation Guide.
- jq: This script uses
jq
to parse JSON outputs. Install it using:- On Linux:
sudo apt install jq
- On macOS:
brew install jq
- On Linux:
- Permissions: Ensure your AWS user has read permissions for S3, EC2, Lambda, and IAM.
- Clone the repository or download the script:
git clone https://github.com/mahesh-diwan/AWS-Resource-Tracker.git cd AWS-Resource-Tracker
- Make the script executable:
chmod +x aws_resource_tracker.sh
- Run the script:
./aws_resource_tracker.sh
- View the output:
- S3 bucket details are saved in the
resource_tracker
file. - Other resource details are printed directly to the terminal.
- S3 bucket details are saved in the
- S3 Buckets:
Print list of S3 buckets bucket-1 bucket-2 bucket-3
- EC2 Instances:
Print EC2 instances "i-0123456789abcdef0" "i-0987654321fedcba0"
- Lambda Functions:
Print Lambda functions function-1 function-2
- IAM Users:
Print IAM users user1 user2
- The script assumes the AWS CLI is already configured with a default profile.
- Outputs are simplified for readability but can be modified to include more details if needed.
- Add support for additional AWS services.
- Format output into a more readable report (e.g., CSV or HTML).
- Include error handling for missing dependencies or insufficient permissions.
Author: Mahesh Diwan
Date: 23/12/2024
Version: v1