Shell Scripting Project

Hello! I'm a student passionate about becoming a Cloud and DevOps Engineer. I have a solid foundation in AWS Cloud, Linux, Docker, and Kubernetes.
1. Report the Usage of AWS Resources using Shell Scripting
For Reporting the usage of AWS resources let's write a script.
create a file aws_resourceses_report.sh and write script.
#!/bin/bash ############################# #Author: Vishal #Date: 23-06-2024 #Version: v1 #this script will report aws resource usage ############################# #AWS S3 #AWS EC2 #AWS IAM set -x set -e set -o pipefail #List S3 buckets aws s3 ls #List EC2 instance Id aws ec2 describe-instances | jq '.Reservations[].Instances[].InstanceId' #List IAM UserName aws iam list-users | jq '.Users[].UserName'Change the file permission
chmod u+x aws_resourceses_report.shDownload and configure AWS CLI.
Execute the command.
./aws_resourceses_report.shNow if we want that everyday at 9.00 AM morning our script should be executed automatically, we should create a cronjob.
Install and start cron.
sudo yum install cronie systemctl start crondand create a cronjob.
crontab -e # write the job 0 9 * * * cd /home/ec2-user && ./aws_resourceses_report.sh >> resources_report
This script will be executed Everyday 9.00 AM and keeps the output in resources_report file.
Thnakyou for reading.



