<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ibrahim</title>
    <description>The latest articles on DEV Community by ibrahim (@highbee).</description>
    <link>https://dev.to/highbee</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1245102%2F9a673e21-816c-4cf5-945f-c21e5c6408dd.jpg</url>
      <title>DEV Community: ibrahim</title>
      <link>https://dev.to/highbee</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/highbee"/>
    <language>en</language>
    <item>
      <title>Deploying a 3-Tier Architecture on AWS Using Terraform Modules</title>
      <dc:creator>ibrahim</dc:creator>
      <pubDate>Thu, 19 Jun 2025 14:59:47 +0000</pubDate>
      <link>https://dev.to/highbee/deploying-a-3-tier-architecture-on-aws-using-terraform-modules-1pie</link>
      <guid>https://dev.to/highbee/deploying-a-3-tier-architecture-on-aws-using-terraform-modules-1pie</guid>
      <description>&lt;p&gt;When it comes to Infrastructure as Code (IaC), one of the first tools that comes to mind is Terraform. Developed by HashiCorp, Terraform is widely adopted because of its simplicity, ease of installation, and support for multiple cloud providers.&lt;/p&gt;

&lt;p&gt;In this blog post, I'll walk you through how to use Terraform modules to deploy a 3-tier architecture on AWS. By the end, you’ll understand how modular Terraform projects are structured and how to build reusable infrastructure components.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a Terraform Module?
&lt;/h3&gt;

&lt;p&gt;A Terraform module is a collection of &lt;code&gt;.tf&lt;/code&gt; files grouped together to perform a specific task or provision a particular resource. You can think of a module as a reusable template for deploying cloud infrastructure.&lt;/p&gt;

&lt;p&gt;Terraform code is written in HCL (HashiCorp Configuration Language), which is human-readable and much easier to understand than languages like C or Java.&lt;/p&gt;

&lt;p&gt;The primary purpose of using modules is to avoid code repetition and to promote reusability and maintainability in your infrastructure.&lt;/p&gt;

&lt;p&gt;There are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Official AWS modules&lt;/strong&gt; in the &lt;a href="https://registry.terraform.io/" rel="noopener noreferrer"&gt;Terraform Registry&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Community-contributed modules&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;And of course, &lt;strong&gt;custom modules&lt;/strong&gt; you can write yourself&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The 3-Tier Architecture We’re Deploying
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi12ttwcnahhrnh5ea8f8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi12ttwcnahhrnh5ea8f8.png" alt=" " width="800" height="531"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this project, we’ll deploy the following infrastructure on AWS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;VPC&lt;/strong&gt; with public and private subnets&lt;/li&gt;
&lt;li&gt;An &lt;strong&gt;Internet Gateway&lt;/strong&gt; for the public subnet&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;NAT Gateway&lt;/strong&gt; for the private subnet&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EC2 Instances&lt;/strong&gt; in each tier (Frontend, Backend, and Database)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Groups&lt;/strong&gt; and &lt;strong&gt;Network ACLs&lt;/strong&gt; to control traffic rules&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s a simple breakdown of the &lt;strong&gt;three tiers&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tier&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Presentation Layer&lt;/td&gt;
&lt;td&gt;Frontend (e.g., React app)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Business Logic Layer&lt;/td&gt;
&lt;td&gt;Backend (e.g., Node.js or Django)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Database Layer&lt;/td&gt;
&lt;td&gt;RDS or MySQL/PostgreSQL&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  📁 Project Folder Structure
&lt;/h3&gt;

&lt;p&gt;Assuming Terraform is already installed on your machine (if not, check out &lt;a href="https://developer.hashicorp.com/terraform/downloads" rel="noopener noreferrer"&gt;Terraform installation guide&lt;/a&gt;), here’s how you should organize your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;project-root/
│
├── main.tf
├── variables.tf
├── outputs.tf
├── provider.tf
│
└── modules/
    ├── vpc/
    ├── compute/
    └── network/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;📝 &lt;strong&gt;Note:&lt;/strong&gt; To keep the blog concise, I won’t paste all the code here. You can find the full source code in my GitHub repository.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  🧠 What Each Terraform File Does
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;File&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;main.tf&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Entry point – defines the resources and &lt;strong&gt;calls the modules&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;variables.tf&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Contains input variables (like AMI IDs, instance types, subnet IDs)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;outputs.tf&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Displays outputs after successful deployment (e.g., public IPs, VPC IDs)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;provider.tf&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Declares the cloud provider (e.g., AWS region, access keys)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The &lt;strong&gt;module directories&lt;/strong&gt; (like &lt;code&gt;vpc&lt;/code&gt;, &lt;code&gt;compute&lt;/code&gt;, and &lt;code&gt;network&lt;/code&gt;) each contain &lt;code&gt;.tf&lt;/code&gt; files that define the logic to deploy VPCs, EC2s, and other networking components.&lt;/p&gt;




&lt;h3&gt;
  
  
  📦 Understanding &lt;code&gt;terraform.tfstate&lt;/code&gt; and &lt;code&gt;terraform.tfstate.backup&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Terraform keeps track of the infrastructure it manages using a file called &lt;code&gt;terraform.tfstate&lt;/code&gt;. This file is critical because it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stores the &lt;strong&gt;current state&lt;/strong&gt; of your deployed infrastructure&lt;/li&gt;
&lt;li&gt;Allows Terraform to know &lt;strong&gt;what exists&lt;/strong&gt;, what to &lt;strong&gt;create&lt;/strong&gt;, &lt;strong&gt;update&lt;/strong&gt;, or &lt;strong&gt;destroy&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now here’s where &lt;code&gt;terraform.tfstate.backup&lt;/code&gt; comes in:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;terraform.tfstate.backup&lt;/code&gt;&lt;/strong&gt; is an automatic backup of your last good known state.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Whenever you run a command like &lt;code&gt;terraform apply&lt;/code&gt;, Terraform creates a new &lt;code&gt;terraform.tfstate&lt;/code&gt; and moves the previous version to &lt;code&gt;terraform.tfstate.backup&lt;/code&gt;. This ensures that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If something goes wrong, you can manually restore the backup&lt;/li&gt;
&lt;li&gt;You don’t lose the entire state file due to corruption or interruption&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Best Practice&lt;/strong&gt;: Never share your state file publicly. It often contains sensitive information like resource IDs, passwords, and more. Use &lt;strong&gt;remote backends (like S3 with encryption)&lt;/strong&gt; for production environments.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  Final Thoughts
&lt;/h3&gt;

&lt;p&gt;Using &lt;strong&gt;Terraform modules&lt;/strong&gt; makes your infrastructure more &lt;strong&gt;modular&lt;/strong&gt;, &lt;strong&gt;scalable&lt;/strong&gt;, and &lt;strong&gt;easy to maintain&lt;/strong&gt;. Whether you're managing a simple EC2 instance or a full-blown 3-tier app on AWS, breaking your setup into logical modules helps avoid repetition and enhances reusability.&lt;/p&gt;

&lt;p&gt;Let me know what you’d like to see next — maybe monitoring this infrastructure with Prometheus and Grafana? Or setting up CI/CD pipelines with GitHub Actions?&lt;/p&gt;




&lt;h3&gt;
  
  
  🔗 Full Source Code
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/highbee2810/aws-3tier-infra-terraform" rel="noopener noreferrer"&gt;GitHub Repository – 3-Tier Architecture with Terraform&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;If you found this post helpful, feel free to like, share, or leave a comment. You can connect with me on &lt;a href="https://www.linkedin.com/in/ibrahim-sarafadeen-oyinkolade-284133162/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; for more DevOps and cloud tips!&lt;/p&gt;




</description>
      <category>terraform</category>
      <category>aws</category>
      <category>awscommunitybuilder</category>
      <category>iac</category>
    </item>
    <item>
      <title>Deploying a 3-Tier Architecture on AWS Using Terraform Modules</title>
      <dc:creator>ibrahim</dc:creator>
      <pubDate>Thu, 19 Jun 2025 14:54:20 +0000</pubDate>
      <link>https://dev.to/highbee/deploying-a-3-tier-architecture-on-aws-using-terraform-modules-3cig</link>
      <guid>https://dev.to/highbee/deploying-a-3-tier-architecture-on-aws-using-terraform-modules-3cig</guid>
      <description>&lt;p&gt;When it comes to Infrastructure as Code (IaC), one of the first tools that comes to mind is Terraform. Developed by HashiCorp, Terraform is widely adopted because of its simplicity, ease of installation, and support for multiple cloud providers.&lt;/p&gt;

&lt;p&gt;In this blog post, I'll walk you through how to use Terraform modules to deploy a 3-tier architecture on AWS. By the end, you’ll understand how modular Terraform projects are structured and how to build reusable infrastructure components.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a Terraform Module?
&lt;/h3&gt;

&lt;p&gt;A Terraform module is a collection of &lt;code&gt;.tf&lt;/code&gt; files grouped together to perform a specific task or provision a particular resource. You can think of a module as a reusable template for deploying cloud infrastructure.&lt;/p&gt;

&lt;p&gt;Terraform code is written in HCL (HashiCorp Configuration Language), which is human-readable and much easier to understand than languages like C or Java.&lt;/p&gt;

&lt;p&gt;The primary purpose of using modules is to avoid code repetition and to promote reusability and maintainability in your infrastructure.&lt;/p&gt;

&lt;p&gt;There are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Official AWS modules&lt;/strong&gt; in the &lt;a href="https://registry.terraform.io/" rel="noopener noreferrer"&gt;Terraform Registry&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Community-contributed modules&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;And of course, &lt;strong&gt;custom modules&lt;/strong&gt; you can write yourself&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The 3-Tier Architecture We’re Deploying
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi12ttwcnahhrnh5ea8f8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi12ttwcnahhrnh5ea8f8.png" alt=" " width="800" height="531"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this project, we’ll deploy the following infrastructure on AWS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;VPC&lt;/strong&gt; with public and private subnets&lt;/li&gt;
&lt;li&gt;An &lt;strong&gt;Internet Gateway&lt;/strong&gt; for the public subnet&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;NAT Gateway&lt;/strong&gt; for the private subnet&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EC2 Instances&lt;/strong&gt; in each tier (Frontend, Backend, and Database)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Groups&lt;/strong&gt; and &lt;strong&gt;Network ACLs&lt;/strong&gt; to control traffic rules&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s a simple breakdown of the &lt;strong&gt;three tiers&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tier&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Presentation Layer&lt;/td&gt;
&lt;td&gt;Frontend (e.g., React app)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Business Logic Layer&lt;/td&gt;
&lt;td&gt;Backend (e.g., Node.js or Django)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Database Layer&lt;/td&gt;
&lt;td&gt;RDS or MySQL/PostgreSQL&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  📁 Project Folder Structure
&lt;/h3&gt;

&lt;p&gt;Assuming Terraform is already installed on your machine (if not, check out &lt;a href="https://developer.hashicorp.com/terraform/downloads" rel="noopener noreferrer"&gt;Terraform installation guide&lt;/a&gt;), here’s how you should organize your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;project-root/
│
├── main.tf
├── variables.tf
├── outputs.tf
├── provider.tf
│
└── modules/
    ├── vpc/
    ├── compute/
    └── network/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;📝 &lt;strong&gt;Note:&lt;/strong&gt; To keep the blog concise, I won’t paste all the code here. You can find the full source code in my GitHub repository.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  🧠 What Each Terraform File Does
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;File&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;main.tf&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Entry point – defines the resources and &lt;strong&gt;calls the modules&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;variables.tf&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Contains input variables (like AMI IDs, instance types, subnet IDs)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;outputs.tf&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Displays outputs after successful deployment (e.g., public IPs, VPC IDs)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;provider.tf&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Declares the cloud provider (e.g., AWS region, access keys)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The &lt;strong&gt;module directories&lt;/strong&gt; (like &lt;code&gt;vpc&lt;/code&gt;, &lt;code&gt;compute&lt;/code&gt;, and &lt;code&gt;network&lt;/code&gt;) each contain &lt;code&gt;.tf&lt;/code&gt; files that define the logic to deploy VPCs, EC2s, and other networking components.&lt;/p&gt;




&lt;h3&gt;
  
  
  📦 Understanding &lt;code&gt;terraform.tfstate&lt;/code&gt; and &lt;code&gt;terraform.tfstate.backup&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Terraform keeps track of the infrastructure it manages using a file called &lt;code&gt;terraform.tfstate&lt;/code&gt;. This file is critical because it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stores the &lt;strong&gt;current state&lt;/strong&gt; of your deployed infrastructure&lt;/li&gt;
&lt;li&gt;Allows Terraform to know &lt;strong&gt;what exists&lt;/strong&gt;, what to &lt;strong&gt;create&lt;/strong&gt;, &lt;strong&gt;update&lt;/strong&gt;, or &lt;strong&gt;destroy&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now here’s where &lt;code&gt;terraform.tfstate.backup&lt;/code&gt; comes in:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;terraform.tfstate.backup&lt;/code&gt;&lt;/strong&gt; is an automatic backup of your last good known state.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Whenever you run a command like &lt;code&gt;terraform apply&lt;/code&gt;, Terraform creates a new &lt;code&gt;terraform.tfstate&lt;/code&gt; and moves the previous version to &lt;code&gt;terraform.tfstate.backup&lt;/code&gt;. This ensures that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If something goes wrong, you can manually restore the backup&lt;/li&gt;
&lt;li&gt;You don’t lose the entire state file due to corruption or interruption&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Best Practice&lt;/strong&gt;: Never share your state file publicly. It often contains sensitive information like resource IDs, passwords, and more. Use &lt;strong&gt;remote backends (like S3 with encryption)&lt;/strong&gt; for production environments.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  Final Thoughts
&lt;/h3&gt;

&lt;p&gt;Using &lt;strong&gt;Terraform modules&lt;/strong&gt; makes your infrastructure more &lt;strong&gt;modular&lt;/strong&gt;, &lt;strong&gt;scalable&lt;/strong&gt;, and &lt;strong&gt;easy to maintain&lt;/strong&gt;. Whether you're managing a simple EC2 instance or a full-blown 3-tier app on AWS, breaking your setup into logical modules helps avoid repetition and enhances reusability.&lt;/p&gt;

&lt;p&gt;Let me know what you’d like to see next — maybe monitoring this infrastructure with Prometheus and Grafana? Or setting up CI/CD pipelines with GitHub Actions?&lt;/p&gt;




&lt;h3&gt;
  
  
  🔗 Full Source Code
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/highbee2810/aws-3tier-infra-terraform" rel="noopener noreferrer"&gt;GitHub Repository – 3-Tier Architecture with Terraform&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;If you found this post helpful, feel free to like, share, or leave a comment. You can connect with me on &lt;a href="https://www.linkedin.com/in/ibrahim-sarafadeen-oyinkolade-284133162/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; for more DevOps and cloud tips!&lt;/p&gt;




</description>
      <category>terraform</category>
      <category>aws</category>
      <category>awscommunitybuilder</category>
      <category>iac</category>
    </item>
    <item>
      <title>Key DevOps roles and responsibilities</title>
      <dc:creator>ibrahim</dc:creator>
      <pubDate>Sat, 31 Aug 2024 13:47:13 +0000</pubDate>
      <link>https://dev.to/highbee/key-devops-roles-and-responsibilities-1bb</link>
      <guid>https://dev.to/highbee/key-devops-roles-and-responsibilities-1bb</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzxo6e1h9c77ptc7656e0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzxo6e1h9c77ptc7656e0.png" alt=" " width="721" height="585"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
![ ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/samdq79lzlhd3q4x8qn3.png)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>DevOps vs Traditional Software Development: A Comprehensive Comparison</title>
      <dc:creator>ibrahim</dc:creator>
      <pubDate>Sat, 31 Aug 2024 13:10:17 +0000</pubDate>
      <link>https://dev.to/highbee/devops-vs-traditional-software-development-a-comprehensive-comparison-2n0c</link>
      <guid>https://dev.to/highbee/devops-vs-traditional-software-development-a-comprehensive-comparison-2n0c</guid>
      <description>&lt;p&gt;In software development, two primary approaches stand out: the traditional Waterfall model and the more modern DevOps methodology. Each has its unique characteristics, advantages, and challenges. This blog post explores the fundamental differences between these approaches to help you understand which might best suit your needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Traditional Software Development Process&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The traditional software development process, often called the Waterfall model, is a linear and sequential approach. It follows a structured path through distinct phases: requirements, design, coding/implementation, testing, and deployment. Each stage must be completed before moving on to the next, with the output of one phase serving as the input for the next.&lt;/p&gt;

&lt;p&gt;** Pros:**&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Clear Specifications:&lt;/strong&gt; Provides a well-defined specification at each stage, which helps in understanding requirements and goals clearly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comprehensive Documentation:&lt;/strong&gt; Offers extensive documentation, which can be valuable for future reference and compliance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rigidity:&lt;/strong&gt; The rigid structure makes it difficult to accommodate changes once a phase is completed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Time-Consuming:&lt;/strong&gt; Progressing through each phase sequentially can be slow, delaying the final delivery.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error Correction Challenges:&lt;/strong&gt; Identifying and fixing mistakes early in the process is difficult, often leading to costly fixes later on.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;** DevOps Approach**&lt;/p&gt;

&lt;p&gt;DevOps is a modern approach that fosters a collaborative culture between development and operations teams. It emphasizes automation, continuous integration, and continuous deployment/delivery to accelerate the software development lifecycle and improve product quality.&lt;/p&gt;

&lt;p&gt;** Pros:**&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Speed:&lt;/strong&gt; Enables rapid development and deployment, significantly reducing time-to-market.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quality:&lt;/strong&gt; Continuous integration and testing ensure high-quality software.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexibility:&lt;/strong&gt; Easily adapts to changes, allowing for iterative improvements.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ease of Maintenance:&lt;/strong&gt; Streamlined processes make debugging and maintenance more efficient.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Adoption Challenges:&lt;/strong&gt; Implementing DevOps requires cultural shifts and can be difficult to adopt initially.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documentation Complexity:&lt;/strong&gt; Continuous changes can make maintaining comprehensive documentation challenging.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Choosing between traditional software development and DevOps depends on your specific needs. If you require a structured, well-documented process with clear specifications, the traditional approach might be suitable. However, if speed, flexibility, and collaboration are your priorities, embracing DevOps could be the better choice. Each method has its place, and understanding the differences will help you make an informed decision.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Automating User and Group Management with a Bash Script</title>
      <dc:creator>ibrahim</dc:creator>
      <pubDate>Tue, 02 Jul 2024 11:07:21 +0000</pubDate>
      <link>https://dev.to/highbee/automating-user-and-group-management-with-a-bash-script-2il0</link>
      <guid>https://dev.to/highbee/automating-user-and-group-management-with-a-bash-script-2il0</guid>
      <description>&lt;h2&gt;
  
  
  Automating User and Group Management with a Bash Script
&lt;/h2&gt;

&lt;p&gt;inspired by  &lt;a href="https://hng.tech/internship" rel="noopener noreferrer"&gt;HNG &lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As a SysOps engineer, one of your routine tasks involves managing users and groups on a server. This can be time-consuming and prone to errors, especially when dealing with many users. Automation is the key to efficiency and reliability. This article will walk you through a Bash script that automates creating users and groups, setting up home directories with appropriate permissions, generating random passwords, and logging all actions.&lt;/p&gt;

&lt;p&gt;This project was inspired by HNG internship 11, DevOps trcak of stage one.&lt;br&gt;
visit &lt;a href="https://hng.tech/premium" rel="noopener noreferrer"&gt;HNG WEBSITE&lt;/a&gt; to learn more about the program&lt;/p&gt;
&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Creates users and their groups.&lt;/li&gt;
&lt;li&gt;Adds users to additional specified groups.&lt;/li&gt;
&lt;li&gt;Sets up home directories with correct permissions and ownership.&lt;/li&gt;
&lt;li&gt;Generates random passwords for users.&lt;/li&gt;
&lt;li&gt;Logs all actions to /var/log/user_management.log.
Stores generated passwords securely in /var/secure/user_passwords.txt&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  A bash script create_users.sh will be created:
&lt;/h2&gt;

&lt;p&gt;The script, create_users.sh, reads a text file containing usernames and their associated groups. Each line in the file is formatted as user;groups, where groups are delimited by commas. The script performs the following tasks:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Input File&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;light;sudo,dev,www-data
idimma;sudo
mayowa;dev,www-data

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The script&lt;/strong&gt;&lt;br&gt;
Below is the complete script&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

# Define log and password files
LOG_FILE="/var/log/user_management.log"
PASSWORD_FILE="/var/secure/user_passwords.txt"

# Create log and password files if they don't exist
touch $LOG_FILE
mkdir -p /var/secure
touch $PASSWORD_FILE

# Function to log messages
log_message() {
    echo "$(date +'%Y-%m-%d %H:%M:%S') - $1" | tee -a $LOG_FILE
}

# Function to generate random password
generate_password() {
    tr -dc A-Za-z0-9 &amp;lt;/dev/urandom | head -c 12 ; echo ''
}

# Check if the input file is provided
if [ $# -ne 1 ]; then
    echo "Usage: $0 &amp;lt;input_file&amp;gt;"
    exit 1
fi

# Read the input file
INPUT_FILE=$1

# Check if the input file exists
if [ ! -f $INPUT_FILE ]; then
    echo "Input file not found!"
    exit 1
fi

while IFS=';' read -r username groups; do
    # Remove leading and trailing whitespaces
    username=$(echo $username | xargs)
    groups=$(echo $groups | xargs)

    if id "$username" &amp;amp;&amp;gt;/dev/null; then
        log_message "User $username already exists. Skipping..."
        continue
    fi

    # Create a personal group for the user
    groupadd $username
    if [ $? -ne 0 ]; then
        log_message "Failed to create group $username."
        continue
    fi
    log_message "Group $username created successfully."

    # Create user and add to personal group
    useradd -m -g $username -s /bin/bash $username
    if [ $? -ne 0 ]; then
        log_message "Failed to create user $username."
        continue
    fi
    log_message "User $username created successfully."

    # Create additional groups if they don't exist and add user to groups
    IFS=',' read -ra group_array &amp;lt;&amp;lt;&amp;lt; "$groups"
    for group in "${group_array[@]}"; do
        group=$(echo $group | xargs)
        if [ -z "$group" ]; then
            continue
        fi
        if ! getent group $group &amp;gt;/dev/null; then
            groupadd $group
            if [ $? -ne 0 ]; then
                log_message "Failed to create group $group."
                continue
            fi
            log_message "Group $group created successfully."
        fi
        usermod -aG $group $username
        log_message "User $username added to group $group."
    done

    # Set up home directory permissions
    chmod 700 /home/$username
    chown $username:$username /home/$username
    log_message "Permissions set for home directory of $username."

    # Generate random password and store it
    password=$(generate_password)
    echo "$username:$password" | chpasswd
    echo "$username:$password" &amp;gt;&amp;gt; $PASSWORD_FILE
    log_message "Password set for user $username."

done &amp;lt; "$INPUT_FILE"

log_message "User and group creation process completed."

exit 0


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Detailed Explanation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's break down the script line by line to understand how it works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Shebang and Definition&lt;/strong&gt;s&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
LOG_FILE="/var/log/user_management.log"
PASSWORD_FILE="/var/secure/user_passwords.txt"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The shebang (#!/bin/bash) indicates that the script should be executed using the Bash shell.&lt;br&gt;
LOG_FILE and PASSWORD_FILE specify the paths for the log and password files.&lt;br&gt;
&lt;strong&gt;2. Creating Log and Password Files&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch $LOG_FILE
mkdir -p /var/secure
touch $PASSWORD_FILE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;touch $LOG_FILE creates the log file if it doesn't exist.&lt;br&gt;
mkdir -p /var/secure creates the directory /var/secure if it doesn't exist.&lt;br&gt;
touch $PASSWORD_FILE creates the password file if it doesn't exist.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Logging Function&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;log_message() {
    echo "$(date +'%Y-%m-%d %H:%M:%S') - $1" | tee -a $LOG_FILE
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;'log_message' is a function that logs messages with a timestamp to both the log file and the terminal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Password Generation Function&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;generate_password() {
    tr -dc A-Za-z0-9 &amp;lt;/dev/urandom | head -c 12 ; echo ''
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function generates a random 12-character alphanumeric password.&lt;br&gt;
&lt;strong&gt;5. Input File Check&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if [ $# -ne 1 ]; then
    echo "Usage: $0 &amp;lt;input_file&amp;gt;"
    exit 1
fi
INPUT_FILE=$1
if [ ! -f $INPUT_FILE ]; then
    echo "Input file not found!"
    exit 1
fi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The script checks if exactly one argument (the input file) is provided and if the file exists.&lt;br&gt;
&lt;strong&gt;6. Reading the Input File&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;while IFS=';' read -r username groups; do
    username=$(echo $username | xargs)
    groups=$(echo $groups | xargs)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;his loop reads the input file line by line, splitting each line into username and groups using ; as the delimiter.&lt;br&gt;
xargs removes leading and trailing whitespaces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Checking for Existing Users&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    if id "$username" &amp;amp;&amp;gt;/dev/null; then
        log_message "User $username already exists. Skipping..."
        continue
    fi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This checks if the user already exists and logs a message if they do, then skips to the next iteration&lt;br&gt;
&lt;strong&gt;8. Creating Personal Group and User&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    groupadd $username
    if [ $? -ne 0 ]; then
        log_message "Failed to create group $username."
        continue
    fi
    log_message "Group $username created successfully."
    useradd -m -g $username -s /bin/bash $username
    if [ $? -ne 0 ]; then
        log_message "Failed to create user $username."
        continue
    fi
    log_message "User $username created successfully."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;groupadd $username creates a personal group for the user.&lt;br&gt;
useradd -m -g $username -s /bin/bash $username creates the user with the specified home directory and shell.&lt;br&gt;
&lt;strong&gt;9. Adding User to Additional Groups&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    IFS=',' read -ra group_array &amp;lt;&amp;lt;&amp;lt; "$groups"
    for group in "${group_array[@]}"; do
        group=$(echo $group | xargs)
        if [ -z "$group" ]; then
            continue
        fi
        if ! getent group $group &amp;gt;/dev/null; then
            groupadd $group
            if [ $? -ne 0 ]; then
                log_message "Failed to create group $group."
                continue
            fi
            log_message "Group $group created successfully."
        fi
        usermod -aG $group $username
        log_message "User $username added to group $group."
    done
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This splits the groups string into an array and iterates over each group, creating the group if it doesn't exist and adding the user to it.&lt;br&gt;
&lt;strong&gt;10. Setting Up Home Directory Permissions&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    chmod 700 /home/$username
    chown $username:$username /home/$username
    log_message "Permissions set for home directory of $username."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;chmod 700 /home/$username sets the permissions so that only the user can access their home directory.&lt;br&gt;
chown $username:$username /home/$username sets the ownership of the home directory.&lt;br&gt;
&lt;strong&gt;11. Generating and Storing Passwords&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    password=$(generate_password)
    echo "$username:$password" | chpasswd
    echo "$username:$password" &amp;gt;&amp;gt; $PASSWORD_FILE
    log_message "Password set for user $username."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This generates a random password for the user, sets it, and securely stores it&lt;br&gt;
&lt;strong&gt;12. Completing the Process&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;done &amp;lt; "$INPUT_FILE"
log_message "User and group creation process completed."
exit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
