This project demonstrates how to automate AWS resource monitoring using a Bash shell script and AWS CLI.
The script retrieves information about commonly used AWS resources and displays them in the terminal. This helps reduce manual effort and provides a simple introduction to infrastructure automation using shell scripting.
- Learn Bash Shell Scripting
- Use AWS CLI to interact with AWS services
- Automate repetitive AWS monitoring tasks
- Practice Linux command-line operations
- Build a beginner-friendly DevOps project
- Amazon S3
- Amazon EC2
- AWS Lambda
- AWS IAM
Shell Script
│
▼
AWS CLI
│
▼
AWS Account Resources
├── S3 Buckets
├── EC2 Instances
├── Lambda Functions
└── IAM Users
#!/bin/bash
set -x
echo "Printing S3 Buckets"
aws s3 ls
echo "Printing EC2 Instances"
aws ec2 describe-instances
echo "Printing Lambda Functions"
aws lambda list-functions
echo "Printing IAM Users"
aws iam list-users
echo "Resource tracking completed successfully"Before running the script, ensure the following are installed and configured:
- Linux (Ubuntu)
- AWS CLI
- AWS Account
- IAM User with AWS CLI permissions
- Configured AWS Credentials
Verify AWS CLI installation:
aws --versionVerify AWS credentials:
aws sts get-caller-identityvim aws-resource-tracker.shPaste the script and save the file.
chmod +x aws-resource-tracker.sh./aws-resource-tracker.shPrinting S3 Buckets
bucket-1
bucket-2
Printing EC2 Instances
InstanceId: i-xxxxxxxxxxxxx
Printing Lambda Functions
FunctionName: demo-function
Printing IAM Users
UserName: admin
Cron jobs can be used to schedule the script to run automatically at fixed intervals.
Open the cron editor:
crontab -eSchedule the script to run every day at 6:00 PM:
0 18 * * * /home/ubuntu/aws-resource-tracker.shView existing cron jobs:
crontab -lCheck cron service status:
systemctl status cronSee:
commands/commands-used.md
- Linux Fundamentals
- Bash Shell Scripting
- AWS CLI
- AWS Resource Monitoring
- Task Automation
- Infrastructure Visibility
- DevOps Fundamentals
- GitHub Documentation
Through this project, I learned:
- How shell scripts automate repetitive tasks
- How to interact with AWS services using AWS CLI
- How to manage file permissions in Linux
- How to execute Bash scripts
- How to schedule automated tasks using Cron Jobs
- How to document a project professionally using GitHub
- Store output in log files
- Export results to CSV format
- Add error handling
- Send email notifications
- Monitor additional AWS services
- Generate automated reports
This project was created for learning and educational purposes. Commands, outputs, and AWS resources may vary depending on account configuration, AWS CLI version, permissions, and Linux distribution.
Swen Lemos
DevOps and Cloud Computing Learner