<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rohit Manna on Medium]]></title>
        <description><![CDATA[Stories by Rohit Manna on Medium]]></description>
        <link>https://medium.com/@rkresearchwork11?source=rss-bf016fd6dae4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*7fsKO7o7JlT0zubx</url>
            <title>Stories by Rohit Manna on Medium</title>
            <link>https://medium.com/@rkresearchwork11?source=rss-bf016fd6dae4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 06:33:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rkresearchwork11/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[✨ End-to-End CI/CD Pipeline with Terraform on AWS: A DevOps Project for Real-World Infrastructure &…]]></title>
            <link>https://medium.com/@rkresearchwork11/end-to-end-ci-cd-pipeline-with-terraform-on-aws-a-devops-project-for-real-world-infrastructure-bd3262192617?source=rss-bf016fd6dae4------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd3262192617</guid>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Rohit Manna]]></dc:creator>
            <pubDate>Tue, 25 Mar 2025 18:51:34 GMT</pubDate>
            <atom:updated>2025-03-25T18:51:34.409Z</atom:updated>
            <content:encoded><![CDATA[<h3>✨ End-to-End CI/CD Pipeline with Terraform on AWS: A DevOps Project for Real-World Infrastructure &amp; App Deployment ✨</h3><h3>🚀 Introduction</h3><p>In today’s cloud-native world, Infrastructure as Code (IaC) and Continuous Integration/Continuous Deployment (CI/CD) have become essential for rapid, reliable, and repeatable deployments. In this blog, I walk you through my end-to-end DevOps project where I:</p><ul><li>Created a production-grade AWS infrastructure using <strong>Terraform</strong></li><li>Set up a <strong>CI/CD pipeline using GitHub Actions</strong></li><li>Deployed a <strong>3-tier Python To-Do web application</strong></li><li>Solved real-world errors along the way</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DpPljyETWdpchTd_gwXJow.gif" /></figure><p>Whether you’re a beginner or an aspiring DevOps engineer, this guide provides a step-by-step journey from infrastructure provisioning to automated deployment — backed by visuals and hands-on insights! 📸</p><h3>⚙️ Tools &amp; Technologies Used</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*GBZr3tkwXXgN_vsPaHgSbQ.png" /></figure><h3>📁 Phase 1: Infrastructure Creation with Terraform</h3><h3>✅ Goals</h3><ul><li>Define modular and scalable infrastructure</li><li>Implement remote state management and locking</li><li>Enable error-free provisioning with dependencies resolved</li></ul><h3>📂 Files Structured:</h3><pre>main.tf<br>variables.tf<br>outputs.tf<br>.github/workflows/terraform.yml<br>.devcontainer/devcontainer.json</pre><h3>📌 Key Resources Created</h3><ol><li><strong>VPC + Subnets</strong> (public/private)</li><li><strong>Route Tables + IGW + NAT Gateway</strong></li><li><strong>EC2 Instances with Launch Templates</strong></li><li><strong>RDS (MySQL) with Read Replica</strong></li><li><strong>EFS with Mount Targets</strong></li><li><strong>CloudWatch Metrics and Alarms</strong></li><li><strong>S3 Backend for State + DynamoDB for Locking</strong></li></ol><p>📸 <em>Terraform state stored in S3:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*qa8xII83mRNy8jCBbTS1lA.png" /></figure><h3>❓ Common Infrastructure Issues Faced</h3><ul><li>❌ <strong>RDS read replica error:</strong> <em>“Cannot create replica because automated backups are disabled.”</em></li><li>✅ <strong>Fix:</strong> Added backup_retention_period = 7 in the primary RDS block.</li><li>❌ <strong>Terraform Apply error (CI/CD stage):</strong> <em>“Invalid resource reference or execution timing issues.”</em></li><li>✅ <strong>Fix:</strong> Broke the process into separate resource modules and tested them individually.</li><li>❌ <strong>IAM Role/Policy confusion while using Terraform for CloudWatch permissions</strong></li><li>✅ <strong>Fix:</strong> Carefully configured IAM policies to allow EC2 and Lambda (if needed) to write logs.</li><li>❌ <strong>Resource not found or incorrect dependency order</strong></li><li>✅ <strong>Fix:</strong> Defined explicit depends_on where implicit dependency resolution failed.</li></ul><h3>🚫 Phase 2: Remote State Management</h3><pre>terraform {<br>  backend &quot;s3&quot; {<br>    bucket         = &quot;my-terraform-state-bucket&quot;<br>    key            = &quot;state/terraform.tfstate&quot;<br>    region         = &quot;us-east-1&quot;<br>    dynamodb_table = &quot;terraform-locks&quot;<br>  }<br>}</pre><ul><li>Ensures state is <strong>centralized</strong>, <strong>versioned</strong>, and <strong>locked</strong></li><li>Prevents accidental overwrites in team environments</li></ul><h3>🧪 Phase 3: CI/CD Pipeline with GitHub Actions</h3><h3>🌟 terraform.yml</h3><pre>name: Terraform CI/CD<br>on:<br>  push:<br>    branches:<br>      - main</pre><pre>jobs:<br>  terraform:<br>    runs-on: ubuntu-latest</pre><pre>    steps:<br>    - uses: actions/checkout@v3<br>    - uses: hashicorp/setup-terraform@v2<br>    - run: terraform init<br>    - run: terraform plan<br>    - run: terraform apply -auto-approve<br>      env:<br>        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}<br>        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}</pre><p>📸 <em>GitHub Actions deploying infrastructure successfully:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Yx2WVGKnRnZ_KvKTtUpNQw.png" /></figure><h3>🛠️ DevContainer Setup</h3><pre>{<br>  &quot;name&quot;: &quot;Terraform Dev Env&quot;,<br>  &quot;features&quot;: { &quot;terraform&quot;: &quot;latest&quot; },<br>  &quot;settings&quot;: {<br>    &quot;terminal.integrated.defaultProfile.linux&quot;: &quot;bash&quot;<br>  }<br>}</pre><h3>❌ CI/CD-Specific Errors</h3><ul><li>❌ <strong>Pipeline failure due to AWS credentials not being recognized</strong></li><li>✅ <strong>Fix:</strong> Added AWS credentials using GitHub Secrets.</li><li>❌ <strong>Terraform destroy triggering on unintended branches</strong></li><li>✅ <strong>Fix:</strong> Modified workflow trigger to only run on main.</li><li>❌ <strong>Devcontainer not loading Terraform correctly</strong></li><li>✅ <strong>Fix:</strong> Updated .devcontainer.json to include correct Terraform features.</li></ul><h3>🛠️ Phase 4: Application Deployment</h3><h3>🌐 3-Tier Architecture</h3><ul><li><strong>Frontend:</strong> React.js</li><li><strong>Backend:</strong> Python Flask API</li><li><strong>Database:</strong> AWS RDS (MySQL)</li></ul><h3>📅 Steps Followed:</h3><ol><li>Pushed Flask + React app code to GitHub</li><li>CI/CD triggered Terraform deployment</li><li>SSH’d into EC2 instance and deployed Flask app</li><li>Connected backend to RDS database</li><li>Deployed React frontend and tested end-to-end flow</li><li>Used <strong>Postman</strong> to validate API endpoints</li></ol><p>📸 <em>Backend running and API tested from EC2:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*6J71vtgy1kL0SbY6BrVeIA.png" /></figure><p>📸 <em>Frontend To-Do app running via S3-hosted React app:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*UALxmEiFCDynpsf_9MSNow.png" /></figure><p>📸 <em>S3 Bucket for Frontend Deployment:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*JgpzAnG97y4fT1l5r1Otbw.png" /></figure><h3>🐞 Real Errors I Solved Throughout the Project</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*DMku15KQBp9aj1ymwSvV6g.png" /></figure><h3>🌟 Final Outcome</h3><ul><li>✅ Fully functional AWS infrastructure provisioned via Terraform</li><li>✅ GitHub Actions pipeline automates deployments with every push</li><li>✅ 3-Tier web application running end-to-end on AWS</li><li>✅ Reusable project for future DevOps and cloud implementation</li><li>✅ Real-world DevOps debugging and problem-solving experience</li></ul><h3>🌍 Want to Explore It?</h3><p>→ GitHub Repo: <a href="https://github.com/RohitManna11/multi-tier-webapp">RohitManna11/multi-tier-webapp</a><br> → Share, fork, or leave a comment if this helped you!</p><h3>🙏 Thank You for Reading!</h3><p>If you’re learning DevOps or Cloud Engineering, I hope this guide gave you clarity and motivation. Follow me for more beginner-to-pro DevOps projects, and feel free to connect!</p><p>#DevOps #Terraform #AWS #CICD #GitHubActions #CloudComputing #InfrastructureAsCode #Debugging #CloudProjects</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd3262192617" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Linux System Monitoring Dashboard with Prometheus, Grafana, and Bash]]></title>
            <link>https://medium.com/@rkresearchwork11/building-a-linux-system-monitoring-dashboard-with-prometheus-grafana-and-bash-786b68c90280?source=rss-bf016fd6dae4------2</link>
            <guid isPermaLink="false">https://medium.com/p/786b68c90280</guid>
            <dc:creator><![CDATA[Rohit Manna]]></dc:creator>
            <pubDate>Tue, 04 Feb 2025 20:41:29 GMT</pubDate>
            <atom:updated>2025-02-04T20:41:29.077Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Monitoring system performance is critical for ensuring reliable operations in both personal and enterprise environments. As part of my Linux projects portfolio, I built a <strong>real-time Linux system monitoring dashboard</strong> that uses:</p><ul><li><strong>Prometheus</strong> for metrics scraping</li><li><strong>Node Exporter</strong> for system stats</li><li><strong>Grafana</strong> for visualization</li><li><strong>Alertmanager</strong> for alert notifications</li><li><strong>Bash scripting</strong> for on-demand monitoring</li></ul><p>In this post, I’ll walk you through the setup, share the challenges I faced, and discuss the solutions or workarounds I used.</p><h3>What Does the Dashboard Do?</h3><p>The dashboard tracks the following metrics in real-time:</p><ol><li><strong>CPU Usage</strong></li><li><strong>Memory and Disk Usage</strong></li><li><strong>Top 10 Processes by CPU Utilization</strong></li><li><strong>Network Connections</strong></li></ol><p>The dashboard also sends alerts (via Slack) when thresholds are breached, such as CPU usage exceeding 80%.</p><h4>Example Output</h4><p>Here’s a snapshot of my system stats captured using a Bash script:</p><figure><img alt="system_stats.sh execution output" src="https://cdn-images-1.medium.com/max/940/1*l9IQkFkBSCv84RNxO2BqqA.png" /></figure><h3>How I Built It</h3><h4>1️⃣ Bash Script for On-Demand Monitoring</h4><p>I started with a simple Bash script, system_stats.sh, which fetches system metrics like CPU, memory, and disk usage using Linux utilities (vmstat, free, df, ps, netstat). The script also logs data to /var/log/system_monitor.log for later review.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*t4Ed9EYuBwIlWZ7Hzxrw0Q.png" /></figure><h4>2️⃣ Real-Time Monitoring with Prometheus and Node Exporter</h4><p>To scale the project for real-time monitoring:</p><ul><li>I deployed <strong>Node Exporter</strong> on my Linux system to scrape system metrics.</li><li>Configured <strong>Prometheus</strong> to scrape data from Node Exporter at intervals.</li><li>Wrote custom alert rules in alert.rules.yml to monitor thresholds like CPU usage &gt; 80%.</li></ul><h4>3️⃣ Visualization with Grafana</h4><p>Grafana was integrated as the visualization tool. Using pre-built dashboards (e.g., Node Exporter Dashboard ID: 1860), I displayed:</p><ul><li>CPU, memory, disk usage trends</li><li>Alerts and annotations for high CPU usage</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*FfBdUGfgf5FGN2NOizLV-A.png" /></figure><h4>4️⃣ Alerting with Alertmanager</h4><p>Finally, I used <strong>Alertmanager</strong> to send notifications for critical alerts:</p><ul><li>Configured email alerts using Gmail’s SMTP server.</li><li>Integrated Slack alerts for team notifications.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*8R1ALYezApO1nEmjLB1vKA.png" /></figure><h3>Challenges Faced and Solutions</h3><h4>Issue 1: Failed Alerts Due to Gmail SMTP Restrictions</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*W6mOQNOagXsWdq5VOCqYFw.png" /></figure><p>I encountered a “534 5.7.9 Application-specific password required” error while testing email alerts.<br><strong>Solution</strong>: Enabled <strong>2-Step Verification</strong> in my Gmail account and generated an <strong>App Password</strong> for SMTP authentication.</p><h4>Issue 2: Alertmanager Version Mismatch</h4><p>Downloading Alertmanager caused a “404 Not Found” error because the requested version didn’t exist.<br><strong>Solution</strong>: Used GitHub’s API to fetch the latest release version dynamically:</p><pre>wget -qO- https://api.github.com/repos/prometheus/alertmanager/releases/latest | grep tag_name</pre><h4>Issue 3: Debugging Prometheus Alert Rules</h4><p>Initially, my alerts weren’t triggering despite exceeding thresholds.<br><strong>Solution</strong>: Verified metrics using Prometheus queries and adjusted thresholds in alert.rules.yml.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*rrnfCqWdg1O_BAgKBBxFtQ.png" /></figure><h3>Key Insights</h3><ol><li><strong>Simple Tools Like Bash are Powerful</strong><br>Even a basic script can provide significant insights into system performance.</li><li><strong>Automation with Prometheus &amp; Grafana is Scalable</strong><br>While the Bash script is useful for quick checks, Prometheus and Grafana provide a scalable solution for continuous monitoring.</li></ol><h3>Conclusion</h3><p>This project was a rewarding experience that combined scripting, monitoring, and visualization tools. By overcoming challenges with Alertmanager, SMTP configurations, and Prometheus queries, I gained deeper insights into Linux system administration and DevOps workflows.</p><p>The project is available in my GitHub repository:</p><p><strong>GitHub Repo</strong>: <a href="https://github.com/RohitManna11/linux_monitoring_dashboard/tree/main">Linux Monitoring Dashboard</a></p><h3>Future Enhancements</h3><ol><li>Add more alert rules (e.g., disk usage thresholds).</li><li>Integrate notifications with Microsoft Teams.</li><li>Deploy the solution on a Kubernetes cluster for distributed monitoring.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=786b68c90280" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Real-Time Log Analytics: A Complete Guide for Beginners]]></title>
            <link>https://medium.com/@rkresearchwork11/real-time-log-analytics-a-complete-guide-for-beginners-97ae005a6449?source=rss-bf016fd6dae4------2</link>
            <guid isPermaLink="false">https://medium.com/p/97ae005a6449</guid>
            <dc:creator><![CDATA[Rohit Manna]]></dc:creator>
            <pubDate>Thu, 30 Jan 2025 21:55:28 GMT</pubDate>
            <atom:updated>2025-01-30T21:55:28.804Z</atom:updated>
            <content:encoded><![CDATA[<p>📊 <strong>Monitor Your Logs Like a Pro!</strong></p><p>✅ <strong>Learn how to set up a Real-Time Log Analytics System</strong> using Prometheus, Grafana, Elasticsearch, and Kibana.<br>✅ <strong>Understand log collection, visualization, and alerting</strong> like a DevOps Engineer.<br>✅ <strong>Step-by-step setup guide</strong> with practical examples.</p><h3>💡 Why Log Analytics Matters?</h3><p>🔹 In modern DevOps, <strong>monitoring and log analysis</strong> are crucial for detecting performance issues, security threats, and debugging errors in real-time.<br>🔹 <strong>Traditional log management is slow</strong> — we need a <strong>real-time system</strong> to analyze logs and system metrics efficiently.<br>🔹 This guide will help you <strong>build a complete log analytics pipeline</strong> from <strong>scratch</strong> using Docker.</p><h3>🔧 Tools You’ll Use</h3><p>We will use <strong>powerful open-source tools</strong> to monitor logs and system performance in real time:</p><p>🛠 <strong>Prometheus</strong> — Collects system metrics (CPU, Memory, Disk, Network).<br>📈 <strong>Grafana</strong> — Creates <strong>beautiful dashboards</strong> for visualization.<br>🔍 <strong>Elasticsearch</strong> — Stores and indexes logs for <strong>fast search</strong>.<br>👀 <strong>Kibana</strong> — Provides an intuitive UI for log analytics.<br>📊 <strong>cAdvisor</strong> — Monitors <strong>containerized applications</strong> in real time.</p><p>By combining these tools, you will build a <strong>powerful</strong> and <strong>scalable</strong> log analytics system. 🔥</p><h3>📌 Step 1: Install Prerequisites</h3><p>Before starting, ensure you have:<br>✅ <strong>Docker</strong> and <strong>Docker Compose</strong> installed.<br>✅ A <strong>Linux-based system</strong> (Ubuntu recommended).<br>✅ <strong>Internet access</strong> to pull the required images.</p><p>Install Docker on Ubuntu:</p><pre>sudo apt update<br>sudo apt install docker.io -y<br>sudo systemctl enable docker<br>sudo systemctl start docker</pre><p>Check if Docker is installed:</p><pre>docker --version</pre><p>Now install <strong>Docker Compose</strong>:</p><pre>sudo apt install docker-compose -y</pre><h3>📌 Step 2: Set Up Docker Compose File</h3><p>Now, let’s create a <strong>Docker Compose</strong> file to set up all services.</p><p>🔹 <strong>Create a new file</strong>:</p><pre>nano docker-compose.yml</pre><p>🔹 <strong>Add the following configuration</strong>:</p><pre>version: &#39;3&#39;<br>services:<br>  prometheus:<br>    image: prom/prometheus<br>    container_name: prometheus<br>    volumes:<br>      - ./prometheus.yml:/etc/prometheus/prometheus.yml<br>    ports:<br>      - &quot;9090:9090&quot;</pre><pre>  grafana:<br>    image: grafana/grafana<br>    container_name: grafana<br>    ports:<br>      - &quot;3000:3000&quot;</pre><pre>  elasticsearch:<br>    image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3<br>    container_name: elasticsearch<br>    environment:<br>      - discovery.type=single-node<br>    ports:<br>      - &quot;9200:9200&quot;</pre><pre>  kibana:<br>    image: docker.elastic.co/kibana/kibana:7.9.3<br>    container_name: kibana<br>    depends_on:<br>      - elasticsearch<br>    ports:<br>      - &quot;5601:5601&quot;</pre><pre>  cadvisor:<br>    image: google/cadvisor<br>    container_name: cadvisor<br>    ports:<br>      - &quot;8080:8080&quot;</pre><p>🚀 <strong>This setup will:</strong><br>✅ Deploy <strong>Prometheus, Grafana, Elasticsearch, Kibana, and cAdvisor</strong> in Docker.<br>✅ Automatically configure them to <strong>communicate</strong> with each other.</p><h3>📌 Step 3: Start the Containers</h3><p>Run the following command to start all services:</p><pre>docker-compose up -d</pre><p>🎉 <strong>Your Log Analytics System is now running!</strong> 🎉</p><p>✅ <strong>Prometheus</strong> → http://localhost:9090<br>✅ <strong>Grafana</strong> → http://localhost:3000<br>✅ <strong>Elasticsearch</strong> → http://localhost:9200<br>✅ <strong>Kibana</strong> → http://localhost:5601<br>✅ <strong>cAdvisor</strong> → <a href="http://localhost:8080/">http://localhost:8080</a></p><h3>📌 Step 4: Configure Prometheus for Monitoring</h3><p>Create a <strong>Prometheus config file</strong> (prometheus.yml):</p><pre>global:<br>  scrape_interval: 5s<br>scrape_configs:<br>  - job_name: &#39;cadvisor&#39;<br>    static_configs:<br>      - targets: [&#39;cadvisor:8080&#39;]</pre><p>🔹 <strong>Restart Prometheus</strong> after updating the file:</p><pre>docker restart prometheus</pre><p>Now, <strong>Prometheus will start collecting metrics</strong> from cAdvisor! 🚀</p><h3>📌 Step 5: Visualize Logs &amp; Metrics in Grafana</h3><p>1️⃣ <strong>Open Grafana</strong> at http://localhost:3000.<br>2️⃣ <strong>Log in</strong> (default: admin / admin).<br>3️⃣ <strong>Add Prometheus as a Data Source</strong> (http://prometheus:9090).<br>4️⃣ <strong>Import pre-built dashboards</strong> for real-time metrics.</p><p>🚀 <strong>Boom! You have a fully functional log monitoring system!</strong> 🎉</p><h3>🌟 Bonus: Setting Up Alerts</h3><p>You can configure <strong>Prometheus Alertmanager</strong> to send real-time alerts via <strong>Slack, Email, or PagerDuty</strong>:</p><ul><li>Install <strong>Alertmanager</strong>.</li><li>Define alert rules in Prometheus (alerts.yml).</li><li>Configure alert notifications (Slack, email, etc.).</li></ul><h3>🎯 Final Outcome</h3><p>By following this guide, you have built a <strong>real-time log analytics system</strong> that:<br>✅ <strong>Monitors system metrics (CPU, Memory, Disk, Network).</strong><br>✅ <strong>Indexes logs for fast searching with Elasticsearch.</strong><br>✅ <strong>Visualizes data using Grafana &amp; Kibana.</strong><br>✅ <strong>Provides real-time alerting with Prometheus Alertmanager.</strong></p><p>🚀 <strong>You’re now one step closer to becoming a DevOps pro!</strong></p><p>📢 <strong>Liked this guide? Share it and help others build real-time log analytics systems!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97ae005a6449" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Automating Flask App Deployment on AWS with Terraform & Jenkins]]></title>
            <link>https://medium.com/@rkresearchwork11/automating-flask-app-deployment-on-aws-with-terraform-jenkins-711f1e7ddac5?source=rss-bf016fd6dae4------2</link>
            <guid isPermaLink="false">https://medium.com/p/711f1e7ddac5</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Rohit Manna]]></dc:creator>
            <pubDate>Thu, 30 Jan 2025 16:12:08 GMT</pubDate>
            <atom:updated>2025-01-30T19:41:19.934Z</atom:updated>
            <content:encoded><![CDATA[<h3>🎯 Introduction</h3><p>Are you looking to automate your infrastructure deployment while seamlessly deploying your application on AWS? This guide walks you through <strong>step-by-step instructions</strong> to set up a <strong>CI/CD pipeline</strong> for a Flask app using <strong>Terraform, AWS, and Jenkins</strong>. Whether you’re a <strong>DevOps beginner</strong> or a <strong>cloud enthusiast</strong>, this tutorial will help you master Infrastructure as Code (IaC) and automate deployments. 🚀</p><h3>✅ What You Will Learn</h3><p>By the end of this guide, you’ll be able to:</p><ul><li>🔹 Deploy an AWS EC2 instance using <strong>Terraform</strong></li><li>🔹 Automate Flask app deployment using <strong>Jenkins CI/CD</strong></li><li>🔹 Set up an <strong>automated pipeline</strong> from GitHub to AWS</li><li>🔹 Understand <strong>common DevOps challenges</strong> and solutions</li></ul><h3>🛠️ Prerequisites</h3><p>Before getting started, make sure you have the following: ✅ <strong>AWS Account</strong> (Sign up at <a href="https://aws.amazon.com/console/">AWS Console</a>)<br> ✅ <strong>Terraform Installed</strong> (<a href="https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli">Install Terraform</a>)<br> ✅ <strong>Jenkins Installed</strong> (<a href="https://www.jenkins.io/doc/book/installing/">Jenkins Setup Guide</a>)<br> ✅ <strong>Basic Git &amp; Python Knowledge</strong></p><h3>🔧 Step 1: Setting Up Terraform for AWS Infrastructure</h3><h3>1️⃣ Initialize a Terraform Project</h3><p>Create a new directory for the project and initialize Terraform:</p><pre>mkdir terraform-aws-setup<br>cd terraform-aws-setup<br>terraform init</pre><h3>2️⃣ Define AWS Resources in Terraform</h3><p>Create a file <strong>main.tf</strong> and define the following resources:</p><ul><li><strong>VPC &amp; Subnet</strong></li><li><strong>Security Groups</strong></li><li><strong>EC2 Instance</strong> with Flask App</li><li><strong>IAM Role &amp; Key Pair</strong></li></ul><p><strong>Example Terraform Code:</strong></p><pre>provider &quot;aws&quot; {<br>  region = &quot;us-east-1&quot;<br>}</pre><pre>resource &quot;aws_instance&quot; &quot;flask_app&quot; {<br>  ami           = &quot;ami-0abcdef1234567890&quot;<br>  instance_type = &quot;t2.micro&quot;<br>  security_groups = [aws_security_group.allow_http.name]<br>  user_data = file(&quot;install_flask.sh&quot;)<br>}</pre><p>Run the following commands to <strong>deploy</strong>:</p><pre>terraform plan<br>terraform apply -auto-approve</pre><p>✅ Your AWS EC2 instance is now <strong>provisioned</strong>! 🎉</p><h3>🤖 Step 2: Setting Up Jenkins for CI/CD</h3><h3>1️⃣ Install Required Plugins</h3><p>Go to <strong>Jenkins Dashboard → Manage Jenkins → Plugins</strong> and install:</p><ul><li>🛠️ <strong>Git Plugin</strong></li><li>🔄 <strong>Pipeline Plugin</strong></li><li>🌐 <strong>AWS Credentials Plugin</strong></li></ul><h3>2️⃣ Configure a Jenkins Pipeline</h3><p>Create a <strong>Jenkinsfile</strong> with the following stages:</p><pre>pipeline {<br>  agent any<br>  stages {<br>    stage(&#39;Checkout Code&#39;) {<br>      steps {<br>        git &#39;https://github.com/your-repo/flask-app.git&#39;<br>      }<br>    }<br>    stage(&#39;Deploy to AWS&#39;) {<br>      steps {<br>        sh &#39;scp -i key.pem app.py ec2-user@&lt;EC2-IP&gt;:~/app.py&#39;<br>      }<br>    }<br>  }<br>}</pre><p>✅ <strong>Now, every push to GitHub will automatically deploy the Flask app to AWS!</strong> 🔥</p><h3>🔥 Step 3: Testing &amp; Accessing Your Flask App</h3><p>After deployment, you can access your Flask app using the <strong>EC2 Public IP</strong>:</p><pre>http://&lt;your-ec2-ip&gt;:5000</pre><p>🚀 <strong>Boom! Your Flask app is live!</strong></p><h3>🛑 Common Issues &amp; Fixes</h3><h3>❌ Terraform State Issues?</h3><p>✅ Use <strong>Terraform Remote Backend (S3 + DynamoDB)</strong> to store your state securely.</p><h3>❌ App Not Running on EC2?</h3><p>✅ SSH into the instance and check logs:</p><pre>ssh -i key.pem ec2-user@&lt;your-ec2-ip&gt;<br>sudo journalctl -u flask-app --no-pager</pre><h3>❌ Jenkins Fails to Deploy?</h3><p>✅ Check <strong>credentials</strong> and <strong>security group rules</strong> for SSH access.</p><h3>📌 Summary for Medium Post</h3><p>🚀 <strong>Automate Flask App Deployment on AWS using Terraform &amp; Jenkins</strong> 🌟<br> 📌 Learn how to <strong>provision AWS infrastructure using Terraform</strong> and <strong>automate deployments with Jenkins</strong> in this detailed step-by-step guide.</p><h3>🎯 Conclusion</h3><p>✅ You’ve successfully deployed a <strong>Flask app on AWS</strong> using <strong>Terraform &amp; Jenkins</strong>! 🎉<br> 💡 <strong>Want to explore more?</strong> Try deploying with <strong>Docker &amp; ECS</strong> or <strong>Kubernetes (EKS)</strong>! 🚀<br> 📢 <strong>Follow me for more DevOps tutorials &amp; cloud automation guides!</strong> 💡</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=711f1e7ddac5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>