Skip to content

Commit eb22dd5

Browse files
authored
Update README.md
1 parent 5b65603 commit eb22dd5

File tree

1 file changed

+19
-97
lines changed

1 file changed

+19
-97
lines changed

README.md

Lines changed: 19 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,29 @@
1+
# 🗄️ Python AWS Backup CLI
12

2-
# Python AWS Backup CLI
3+
![Python](https://img.shields.io/badge/Python-3.9%2B-blue)
4+
![GitHub Actions](https://github.com/Ahadxcode/python-aws-backup-cli/actions/workflows/python-tests.yml/badge.svg)
35

4-
A simple, production-ready Python script to compress a directory and upload the archive to **AWS S3**.
5-
Includes unit tests (pytest) and CI automation with **GitHub Actions**.
66

7-
## Features
8-
- Compress any folder into a timestamped **.zip** (default) or **.tar.gz**
9-
- Upload the archive to **Amazon S3**
10-
- Simple CLI interface with sensible defaults
11-
- Unit tests with **pytest**
12-
- **GitHub Actions** workflow to run tests on every push/PR
7+
A simple yet powerful **Python CLI tool** that compresses local directories and uploads them securely to **AWS S3**.
8+
Built with **automation + DevOps best practices** (Pytest, GitHub Actions, modular Python).
139

1410
---
1511

16-
## Quickstart
17-
18-
### 1) Clone & set up
19-
```bash
20-
git clone https://github.com/your-username/python-aws-backup-cli.git
21-
cd python-aws-backup-cli
22-
python -m venv .venv
23-
# Windows
24-
. .venv/Scripts/activate
25-
# macOS/Linux
26-
# source .venv/bin/activate
27-
pip install -r requirements.txt
28-
```
29-
30-
### 2) Configure AWS credentials (one-time)
31-
Use the AWS CLI or environment variables.
32-
33-
```bash
34-
# Option A: AWS CLI (recommended)
35-
aws configure
36-
# Provide AWS Access Key ID, Secret Access Key, region, output format
37-
```
38-
39-
Alternatively set env vars before running:
40-
```bash
41-
export AWS_ACCESS_KEY_ID=...
42-
export AWS_SECRET_ACCESS_KEY=...
43-
export AWS_DEFAULT_REGION=ap-south-1
44-
```
45-
46-
### 3) Run a local backup (no upload)
47-
```bash
48-
python backup.py --source ./my_data --outdir ./backups --format zip
49-
```
50-
51-
### 4) Backup and upload to S3
52-
```bash
53-
python backup_and_s3.py --source ./my_data --outdir ./backups --format zip --bucket your-bucket-name --prefix optional/folder/path/
54-
```
55-
56-
- `--bucket` is your S3 bucket name.
57-
- `--prefix` is optional (folder path inside the bucket).
58-
- Result example: `s3://your-bucket-name/optional/folder/path/backup_my_data_20250101_123000.zip`
12+
## 🚀 Features
13+
- 📦 Compress and back up files/directories into `.tar.gz`.
14+
- ☁️ Upload backups automatically to **AWS S3**.
15+
- 🧪 Includes **unit tests** (`pytest`) for reliability.
16+
-**GitHub Actions** workflow to run tests on every push.
17+
- 🛠️ Modular design (`backup.py`, `s3_upload.py`, etc.).
5918

6019
---
20+
## 📂 Project Structure
6121

62-
## Project Structure
63-
```
6422
python-aws-backup-cli/
65-
├─ backup.py # create compressed backups (zip/tar.gz)
66-
├─ s3_upload.py # upload helper for S3
67-
├─ backup_and_s3.py # one-shot: create backup + upload
68-
├─ requirements.txt
69-
├─ .gitignore
70-
├─ README.md
71-
├─ tests/
72-
│ └─ test_backup.py
73-
└─ .github/
74-
└─ workflows/
75-
└─ python-tests.yml # CI: run pytest on push/PR
76-
```
77-
78-
---
79-
80-
## Examples
81-
82-
Create a **.zip** archive:
83-
```bash
84-
python backup.py -s ./my_data -o ./backups -f zip
85-
```
86-
87-
Create a **.tar.gz** archive:
88-
```bash
89-
python backup.py -s ./my_data -o ./backups -f tar
90-
```
91-
92-
Backup and **upload to S3** with a prefix:
93-
```bash
94-
python backup_and_s3.py -s ./my_data -o ./backups -f zip --bucket my-bucket --prefix daily/ahad/
95-
```
96-
97-
---
98-
99-
## Notes
100-
- Windows users: prefer absolute paths or use `./my_data` relative to the project root.
101-
- Make sure your AWS IAM user/role has `s3:PutObject` permission for your bucket (and `s3:ListBucket` if needed).
102-
- Large directories: consider excluding patterns (future enhancement).
103-
104-
---
105-
106-
## License
107-
MIT
23+
│── backup.py # Handles local compression
24+
│── s3_upload.py # Handles AWS S3 upload
25+
│── backup_and_s3.py # Combined CLI script
26+
│── requirements.txt # Python dependencies
27+
│── tests/ # Unit tests (pytest)
28+
│── .github/workflows/ # CI/CD (GitHub Actions)
29+
│── README.md # Project documentation

0 commit comments

Comments
 (0)