This repository contains a simple Bash automation script to manage Apache2 web server logs and upload them to an AWS S3 bucket.
- Updates all system packages
- Installs Apache2 if not already installed
- Ensures Apache2 service is running and enabled on boot
- Archives Apache2 log files with a timestamped filename
- Uploads the archive to a specified AWS S3 bucket
Before running this script, make sure you have:
- Ubuntu/Debian system with
bash - AWS CLI installed and configured (
aws configure) - Proper IAM role or AWS credentials with S3 write access
tar,systemctl, anddpkg-queryutilities installed (default in Ubuntu)
Inside the script, you can configure:
s3_bucket=upgrad-saurav # S3 bucket name
myname=saurav # Used for naming archives
timestamp=$(date '+%d%m%Y-%H%M%S') # Timestamp format-
Clone this repository:
git clone https://github.com/saurav-22/Automation_Project.git cd Automation_Project -
Make the script executable:
chmod +x automation.sh
-
Run the script:
./automation.sh
- Archives of Apache logs are stored in
/tmp:/tmp/saurav-httpd-logs-<timestamp>.tar - Archives are uploaded to your S3 bucket:
s3://upgrad-saurav/saurav-httpd-logs-<timestamp>.tar
This project is open source. Feel free to modify and use it as per your needs.