AutoS3Uploader
A lightweight Bash script that automates the process of uploading files or folders from an EC2 instance to an AWS S3 bucket. It allows users to either create a new bucket or use an existing one, checks AWS CLI installation and configuration, and securely uploads files or folders to the specified bucket.
-
Automatically checks and installs AWS CLI v2 if missing.
-
Verifies AWS CLI configuration before proceeding.
-
Lets you create a new S3 bucket or use an existing bucket.
-
Uploads files or folders directly from the EC2 instance to S3.
-
Provides clear prompts and error handling for smooth execution.
- Bash/Shell Scripting
- AWS CLI v2
-
Amazon S3 β For storing uploaded files.
-
AWS IAM β For managing permissions to access and upload to S3.
- Clone this repository on your EC2 instance:
git clone https://github.com/<your-username>/AutoS3Uploader.git cd AutoS3Uploader
- Give execution permission:
chmod +x AutoS3Uploader.sh
- Ensure AWS CLI is configured:
aws configure
- Run the script using the command:
./AutoS3Uploader.sh
You will be prompted to:
-
Choose whether to create a new S3 bucket or use an existing one.
-
Enter the bucket name (and region if creating a new one).
-
Provide the full path of the file or folder on the EC2 instance.
-
The script uploads your file/folder to S3.
-
How to automate AWS CLI operations using Bash.
-
Handling user input and conditions in shell scripts.
-
Managing AWS S3 buckets and file uploads programmatically.
-
Implementing error handling with set -euo pipefail for safer scripts.
This project is licensed under the MIT License - see the LICENSE file for details.
Nishika Jaiswal
Aspiring Cloud & DevOps Engineer