Skip to content

Python Script for AWS Automation with Boto3. (Create a Python script using the AWS SDK (Boto3) to automate common AWS tasks, such as provisioning EC2 instances, uploading files to S3, and managing RDS databases.)

Notifications You must be signed in to change notification settings

22MH1A42G1/Aws-Automation-With-Boto3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

40 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ AWS Automation Dashboard using Python, Boto3, and Streamlit

Python Streamlit AWS Boto3 License: MIT


πŸ“Œ Overview

This project is a fully functional AWS Automation Dashboard, built using Streamlit and Boto3, designed to automate infrastructure tasks like launching EC2 instances, uploading files to S3, and managing RDS databases.

βœ… Web-based interface for AWS tasks
βœ… Secure .env file for credentials
βœ… Modular structure with clean Python code
βœ… Deployed and tested on Amazon EC2


πŸ”§ Features

πŸ–₯️ EC2 Management

  • Launch EC2 instance using button click

☁️ S3 Management

  • Upload files to any S3 bucket from your browser

πŸ—ƒοΈ RDS Management

  • Create, delete RDS instance
  • Take and restore snapshots
  • Modify database size

πŸ—‚οΈ Project Structure

AWS_MINI_PROJECT/
β”œβ”€β”€ app.py                    # Streamlit Web Interface
β”œβ”€β”€ .env                      # AWS keys and configuration
β”œβ”€β”€ EC2/
β”‚   └── create_ec2_instance_file.py
β”œβ”€β”€ RDS/
β”‚   β”œβ”€β”€ create_rds_instance.py
β”‚   β”œβ”€β”€ delete_rds_instance.py
β”‚   β”œβ”€β”€ create_snapshot.py
β”‚   β”œβ”€β”€ modify_rds_instance.py
β”‚   └── restore_from_snapshot.py
β”œβ”€β”€ S3/
β”‚   └── upload_to_s3.py
β”œβ”€β”€ screenshots/
β”‚   β”œβ”€β”€ ec2.png
β”‚   β”œβ”€β”€ s3.png
β”‚   └── rds.png
β”œβ”€β”€ architecture_diagram.png
β”œβ”€β”€ requirements.txt
└── README.md

πŸ–ΌοΈ Architecture Diagram and πŸ“Ή Demo Output video

Architecture Diagram


βš™οΈ Setup Instructions (Step-by-Step Guide)

βœ… 1. Prerequisites

Install Python 3.8+ and pip

You must have AWS CLI installed and configured with valid credentials.

Create an IAM user with the following permissions:

- AmazonEC2FullAccess

- AmazonS3FullAccess

- AmazonRDSFullAccess

Ensure an EC2 key pair and valid AMI ID is available in your selected region.


πŸ“ 2. Clone the Repository

Open terminal or Git Bash and run:

git clone https://github.com/22MH1A42G1/Aws-Automation-With-Boto3.git
cd Aws-Automation-With-Boto3

πŸ“ 3. Create the .env File

Create a .env file in the root directory and add the following content:

AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_DEFAULT_REGION=ap-south-1

AMI_ID=ami-0ded8326293d3201b
KEY_PAIR_NAME=PemKey
EC2_INSTANCE_NAME=MyEC2Instance

RDS_USERNAME=admin
RDS_PASSWORD=Automation123
RDS_DB_INSTANCE=mydbinstance
RDS_SNAPSHOT_NAME=mysnapshot
RDS_RESTORE_INSTANCE=mynewdbinstance

⚠️ Make sure to replace the placeholders with your actual AWS values.

🚫 DO NOT commit this file to GitHub. Add .env to your .gitignore.


πŸ“¦ 4. Install Project Dependencies

You can install the required libraries using pip:

pip install -r requirements.txt

Or install manually:

pip install streamlit boto3 python-dotenv

πŸ§ͺ 5. Run the Application Locally

Use this command to start your Streamlit app:

python -m streamlit run app.py

# Visit the following URL in your browser:
http://localhost:8501

☁️ 6. Deploy to AWS EC2 Instance

Step-by-step deployment on EC2

a. Launch an EC2 Instance

- Select Ubuntu 20.04 or Amazon Linux 2

- Choose a t2.micro (Free Tier eligible)

- Create or use an existing Key Pair (PemKey)

- Allow inbound traffic on port 8501 (Streamlit) and port 22 (SSH)

b. Connect to the Instance via SSH

# Run this from your local machine:
ssh -i "PemKey.pem" ec2-user@<EC2-Public-IP>

c. Update the instance and install Python

# For Amazon Linux:
sudo yum update -y
sudo yum install python3 git -y

# For Ubuntu:
sudo apt update && sudo apt install python3-pip git -y

d. Upload or Clone Your Project

# Option 1: Clone from GitHub (requires your repo to be public or provide access):
git clone https://github.com/yourusername/aws-automation-dashboard.git

# Option 2: Use SCP to upload files:
scp -i PemKey.pem -r ./aws-automation-dashboard ec2-user@<EC2-Public-IP>:~/project

e. Navigate to your project directory

cd aws-automation-dashboard

f. Recreate .env File

# Paste your .env content again on EC2 manually or upload it via SCP.

#### g. Install Project Requirements on EC2

pip3 install -r requirements.txt

# Or manually:
pip3 install streamlit boto3 python-dotenv

h. Run the App on EC2

streamlit run app.py --server.port 8501 --server.enableCORS false

🌐 7. Access the App in Browser

# Open a browser on your local machine and visit:
http://<EC2-Public-IP>:8501

πŸ”“ Make sure port 8501 is open in your EC2 security group settings.


🧹 8. Clean Up (Optional)

To avoid unexpected AWS charges:

  • Stop or terminate your EC2 instance
  • Delete RDS instances and snapshots
  • Remove unused S3 files

πŸŽ‰ Done! You have successfully set up the AWS Automation Dashboard.


πŸ“Έ Output Screenshots (Evidence)

πŸ” Before Login

Before Login Dashboard

βœ… After Login

After Login Dashboard


πŸ–₯️ EC2 Automation

βœ… EC2 Instance Launch via Dashboard

EC2 Launch

❌ EC2 Instance Terminated via Dashboard

EC2 Terminated

🌐 EC2 Deployed Server Screenshot

EC2 Server Deployed

πŸ“ Project Files on EC2 Server

Project Deployed on EC2


☁️ S3 Bucket Automation

πŸ“¦ Before Upload (Empty Bucket)

Empty S3 Bucket

βœ… File Upload via Dashboard

File Upload Success

πŸ“ After File Upload

After Upload

❌ S3 Bucket Deleted

S3 Deleted


πŸ—ƒοΈ RDS Automation

βœ… RDS Instance Created

RDS Created

🧩 Snapshot Created

Snapshot

πŸ“ˆ DB Instance Modified

DB Instance Modified

♻️ RDS Restored from Snapshot

RDS Restored

❌ RDS Deletion Initiated

RDS Deleted

🧼 Output: RDS Created

Output RDS Created

βœ… Output: RDS Modified

Output DB Modified

🧹 Output: RDS Deletion

Output RDS Deleted

πŸ” Output: RDS Restored

Output RDS Restored


πŸ”’ IAM User Management

🧾 IAM User Created with Roles & Access Key

IAM Roles

🧼 IAM User Deleted

IAM Deleted


🧭 UI Navigation Panels

🧠 Project Applications Panel

Applications Panel

πŸ“‹ Guidelines Panel

Guidelines Panel

🧭 Navigation Panel

Navigation Panel

About

Python Script for AWS Automation with Boto3. (Create a Python script using the AWS SDK (Boto3) to automate common AWS tasks, such as provisioning EC2 instances, uploading files to S3, and managing RDS databases.)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages