{"id":48495472,"url":"https://github.com/mdbentaleb/aws-cloud-native-stack","last_synced_at":"2026-04-07T12:02:25.936Z","repository":{"id":345423857,"uuid":"1185803940","full_name":"mdbentaleb/aws-cloud-native-stack","owner":"mdbentaleb","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-31T12:28:57.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-31T13:32:16.837Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdbentaleb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-19T00:45:14.000Z","updated_at":"2026-03-31T12:29:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mdbentaleb/aws-cloud-native-stack","commit_stats":null,"previous_names":["mdbentaleb/aws-cloud-native-stack"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mdbentaleb/aws-cloud-native-stack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdbentaleb%2Faws-cloud-native-stack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdbentaleb%2Faws-cloud-native-stack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdbentaleb%2Faws-cloud-native-stack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdbentaleb%2Faws-cloud-native-stack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdbentaleb","download_url":"https://codeload.github.com/mdbentaleb/aws-cloud-native-stack/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdbentaleb%2Faws-cloud-native-stack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31511785,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-07T12:02:14.072Z","updated_at":"2026-04-07T12:02:25.897Z","avatar_url":"https://github.com/mdbentaleb.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ☁️ AWS Cloud-Native Automated Stack\n\n![Project Structure](./img/AwsCloudNativeStack.png)\n\n### **Architecting Scalable Infrastructure with Nginx, Docker \u0026 AWS**\n\n## 📌 Project Overview\n\nThis project demonstrates a professional **DevOps workflow** by deploying a containerized Flask application behind an Nginx Reverse Proxy on **AWS EC2**. The core focus is on **Security**, **Infrastructure as Code concepts**, and **Cloud Automation**, utilizing AWS-native features for secure configuration management.\n\n---\n\n## 🏗️ Architecture \u0026 Features\n\n* **Reverse Proxy:** Nginx handles incoming traffic and routes it to the application.\n* **Containerization:** Multi-container setup managed by **Docker Compose**.\n* **Zero-Credential Security:** The EC2 instance uses an **IAM Role** to securely fetch configurations from S3, avoiding dangerous hardcoded AWS Access Keys.\n* **Config Management:** AWS S3 acts as a centralized store for production-ready Nginx configurations.\n* **Automated Provisioning:** A custom Bash script (`setup.sh`) handles dependencies, pulls cloud configs, and launches the stack.\n\n---\n\n## 📂 Repository Structure\n\n```text\n.\n├── app/                   # Flask Web Application\n│   ├── app.py             # Main Logic\n|   ├── requirements.txt   # Python Dependencies\n│   └── Dockerfile         # Optimized Python Image\n├── nginx/                 # Proxy Configuration\n│   └── default.conf       # Custom Nginx Rules\n├── scripts/               # DevOps Automation\n│   └── setup.sh           # One-click Cloud Provisioning\n└── docker-compose.yml     # Container Orchestration\n```\n\n---\n\n## 🛠️ Step-by-Step AWS Infrastructure Setup\n\nTo replicate this production-like environment, follow these precise steps in your AWS Console:\n\n### 1. Network \u0026 S3 Storage\n* **S3 Bucket Configuration:**\n  * Created a private S3 bucket (e.g., `motorolas3`).\n  * Uploaded the custom Nginx configuration file (`default.conf`) to this bucket.\n* **Network \u0026 Security Group:**\n  * Used a Default VPC (or a custom one).\n  * Created a dedicated **Security Group** for the EC2 instance with the following **Inbound Rules**:\n    * **SSH (Port 22):** Source `My IP` (For secure, restricted remote access).\n    * **HTTP (Port 80):** Source `0.0.0.0/0` (To allow public web traffic to Nginx).\n\n### 2. Identity and Access Management (IAM)\n* **IAM Role Creation:**\n  * Created an IAM Role for the **EC2** service.\n  * Attached the AWS managed policy: **`AmazonS3ReadOnlyAccess`** (Granting the instance permission to pull configs from S3 securely).\n  * Named the role `EC2-S3-ReadOnly-Role`.\n\n### 3. Compute (EC2 Instance)\n* **EC2 Deployment:**\n  * Launched a new EC2 instance running Debian.\n  * Attached the `EC2-S3-ReadOnly-Role` profile to the instance during launch (found under Advanced Details).\n  * Captured the instance's **Public IPv4 Address** for remote access and testing.\n\n---\n\n## 🚀 How to Run \u0026 Deploy\n\nOnce you SSH into your EC2 instance and clone this repository, follow these steps to run the automation:\n\n### 1. Give Execution Permissions to the Script\nLinux requires explicit permissions to run shell scripts. Grant them using `chmod`:\n```bash\nchmod +x scripts/setup.sh\n```\n\n### 2. Run the Automated Setup\nExecute the script. It will install Docker, pull the Nginx configuration from S3, and build the environment:\n```bash\n./scripts/setup.sh\n```\n\n### 3. Manual Fallback (Docker Compose)\nIf you ever need to manually spin up or rebuild the containers without the full script:\n```bash\n# To start the containers in the background\nsudo DOCKER_BUILDKIT=0 COMPOSE_DOCKER_CLI_BUILD=0 docker-compose up --build -d\n\n# To stop the containers and clean up\nsudo docker-compose down\n```\n\n---\n\n## 🧪 How to Test and Access the Web App\n\nOnce the containers are reported as `Started` by Docker Compose:\n\n1. Open your web browser on your local machine.\n2. In the URL bar, type the public IP of your EC2 instance using the HTTP protocol:\n   ```text\n   http://YOUR_EC2_PUBLIC_IP\n   ```\n   *(Note: Do not use `https://` as SSL certificates are not configured in this branch).*\n3. You should see the response served by your Flask application through the Nginx Reverse Proxy!\n\nTo verify that everything is running correctly from inside the server terminal, you can run:\n```bash\n# Check running containers\nsudo docker ps\n\n# Test local endpoint\ncurl http://localhost:80\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdbentaleb%2Faws-cloud-native-stack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdbentaleb%2Faws-cloud-native-stack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdbentaleb%2Faws-cloud-native-stack/lists"}