<?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: Ian Gitonga</title>
    <description>The latest articles on DEV Community by Ian Gitonga (@igitonga).</description>
    <link>https://dev.to/igitonga</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%2F3828173%2F877528d6-97c7-42c6-a3c5-e5f58a4d9816.png</url>
      <title>DEV Community: Ian Gitonga</title>
      <link>https://dev.to/igitonga</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/igitonga"/>
    <language>en</language>
    <item>
      <title>Deploying a Highly Available Web App on AWS Using Terraform</title>
      <dc:creator>Ian Gitonga</dc:creator>
      <pubDate>Mon, 23 Mar 2026 13:33:56 +0000</pubDate>
      <link>https://dev.to/igitonga/deploying-a-highly-available-web-app-on-aws-using-terraform-4fmg</link>
      <guid>https://dev.to/igitonga/deploying-a-highly-available-web-app-on-aws-using-terraform-4fmg</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Running a single server is a good start, but in the real world, a single server is a single point of failure. If that server crashes, or if it becomes overloaded from too much traffic, users will be unable to access your site. The solution is to run a cluster of&lt;br&gt;
servers, routing around servers that go down and adjusting the size of the cluster up or down based on traffic.&lt;/p&gt;

&lt;p&gt;Managing such a cluster manually is a lot of work. Fortunately, you can let AWS take care of it for you by using an Auto Scaling Group &lt;em&gt;(ASG)&lt;/em&gt;. An ASG takes care of a lot of tasks for you completely automatically, including launching a cluster of EC2 Instances, monitoring the health of each instance, replacing failed instances and adjusting the size of the cluster in response to load.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create repository&lt;/strong&gt;
This is how i have organized my project:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;terraform/
├── main.tf                      # All resource definitions
├── variables.tf                 # Variable declarations
└── README.md     
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Define Variables&lt;/strong&gt;
To allow you to make your code more DRY_(Don't Repeat Yourself)_ and more configurable, Terraform allows you to define input variables.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="k"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"server_port"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"The port the server will use for HTTP requests"&lt;/span&gt;
    &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;
    &lt;span class="nx"&gt;default&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;8080&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"ami_id"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Amazon Machine Image (AMI) ID for the EC2 instance"&lt;/span&gt;
  &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;default&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ami-0aaa636894689fa47"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;You'll define the above inside &lt;em&gt;variables.tf&lt;/em&gt; file.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Using Auto Scaling Group &lt;em&gt;ASG&lt;/em&gt;&lt;/strong&gt;
An
ASG takes care of a lot of tasks for you completely automatically, including launching a cluster of EC2 Instances, monitoring the health of each Instance, replacing failed instances and adjusting the size of the cluster in response to load.
The first step in creating an ASG is to create a launch tempalte in &lt;em&gt;main.tf&lt;/em&gt;.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_launch_template"&lt;/span&gt; &lt;span class="s2"&gt;"instance1"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;image_id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ami_id&lt;/span&gt;
  &lt;span class="nx"&gt;instance_type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;instance_type&lt;/span&gt;
  &lt;span class="nx"&gt;vpc_security_group_ids&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;aws_security_group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;instanceSecurityGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="nx"&gt;user_data&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;base64encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;-&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;
              #!/bin/bash
              echo "Hello, World" &amp;gt; index.html
              nohup busybox httpd -f -p ${var.server_port} &amp;amp;
&lt;/span&gt;&lt;span class="no"&gt;              EOF
&lt;/span&gt;            &lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="c1"&gt;# Required when using a launch configuration with an auto scaling group.&lt;/span&gt;
  &lt;span class="nx"&gt;lifecycle&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;create_before_destroy&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now you can create the ASG itself using the &lt;em&gt;aws_autoscaling_group&lt;/em&gt; resource:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_autoscaling_group"&lt;/span&gt; &lt;span class="s2"&gt;"asg1"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;launch_template&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;id&lt;/span&gt;      &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_launch_template&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;instance1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
      &lt;span class="nx"&gt;version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="s2"&gt;Latest"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;vpc_zone_identifier&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;aws_subnets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;default&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ids&lt;/span&gt;

  &lt;span class="nx"&gt;min_size&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
  &lt;span class="nx"&gt;max_size&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;

  &lt;span class="nx"&gt;tag&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Name"&lt;/span&gt;
    &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"terraform-asg-example"&lt;/span&gt;
    &lt;span class="nx"&gt;propagate_at_launch&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There’s also one other parameter that you need to add to your ASG to make it work: subnet_ids. This parameter specifies to the ASG into which VPC subnets the EC2 instances should be deployed. Each subnet lives in an isolated AWS AZ (that is, isolated datacen‐&lt;br&gt;
ter), so by deploying your Instances across multiple subnets, you ensure that your service can keep running even if some of the datacenters have an outage. You could hardcode the list of subnets, but that won’t be maintainable or portable, so a better&lt;br&gt;
option is to use data sources to get the list of subnets in your AWS account.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="k"&gt;data&lt;/span&gt; &lt;span class="s2"&gt;"aws_vpc"&lt;/span&gt; &lt;span class="s2"&gt;"default"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;default&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;data&lt;/span&gt; &lt;span class="s2"&gt;"aws_subnets"&lt;/span&gt; &lt;span class="s2"&gt;"default"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;filter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"vpc-id"&lt;/span&gt;
    &lt;span class="nx"&gt;values&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;default&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Creating EC2 Instances
If this is a new project you'll need to first run this command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, if you've had initiated before you can apply the changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform apply
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F88jdr9rkd5lf0y0iq4y7.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%2F88jdr9rkd5lf0y0iq4y7.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;And with that we are able to deploy more than one instance. Throughout this series, we'll see how the right combination of Auto Scaling Groups, launch templates, security groups, and multi-AZ networking can transform a fragile single-instance setup into a resilient, self-healing system.&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>aws</category>
    </item>
    <item>
      <title>Deploying Your First Server with Terraform: A Beginner's Guide</title>
      <dc:creator>Ian Gitonga</dc:creator>
      <pubDate>Thu, 19 Mar 2026 17:03:13 +0000</pubDate>
      <link>https://dev.to/igitonga/deploying-your-first-server-with-terraform-a-beginners-guide-4f9m</link>
      <guid>https://dev.to/igitonga/deploying-your-first-server-with-terraform-a-beginners-guide-4f9m</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What if provisioning a server took less time than brewing your morning coffee?&lt;/strong&gt;&lt;br&gt;
That's the promise of Infrastructure as Code &lt;em&gt;(IaC)&lt;/em&gt;  and Terraform makes good on it. Instead of clicking through cloud dashboards or memorizing provider specific CLIs, you write a configuration file, run two commands, and your infrastructure exists.&lt;br&gt;
In this guide, we'll build something real: a running EC2 instance on AWS, defined entirely in Terraform. You don't need a background in DevOps or cloud architecture — just a willingness to write a little code and watch it come to life.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Setting up your project&lt;/strong&gt;&lt;br&gt;
Create a directory for your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;terraform-first-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Create your terraform file&lt;/strong&gt;&lt;br&gt;
Inside your directory create a file &lt;em&gt;main.tf&lt;/em&gt;. Inside configure a provider you want to use.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="k"&gt;provider&lt;/span&gt; &lt;span class="s2"&gt;"aws"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;region&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-east-2"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells Terraform that you are going to be using AWS as your provider and that you want to deploy your infrastructure into the us-east-2 region.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Add resources to your provider&lt;/strong&gt;&lt;br&gt;
For each type of provider, there are many different kinds of resources that you can create, such as servers, databases, and load balancers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_instance"&lt;/span&gt; &lt;span class="s2"&gt;"example"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;ami&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ami-0fb653ca2d3203ac1"&lt;/span&gt;
  &lt;span class="nx"&gt;instance_type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"t2.micro"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Initialize Terraform&lt;/strong&gt;&lt;br&gt;
In your terminal, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the command tells Terraform to scan the code, figure out which providers you’re using, and download the code for them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Checkout the plan&lt;/strong&gt;&lt;br&gt;
Run the command below &lt;em&gt;(Optional)&lt;/em&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform plan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The plan command lets you see what Terraform will do before actually making any changes. This is a great way to sanity-check your code before unleashing it onto&lt;br&gt;
the world.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Create instance&lt;/strong&gt;&lt;br&gt;
To actually create the Instance, run the the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform apply
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ll notice that the apply command shows you the same plan output and asks you to confirm whether you actually want to proceed with this plan. So, while plan is available as a separate command, it’s mainly useful for quick sanity checks and during code reviews.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Congrats&lt;/strong&gt;, you’ve just deployed an EC2 Instance in your AWS account using Terraform! To verify this, head over to the EC2 console,&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Destroy the instance&lt;/strong&gt;&lt;br&gt;
To avoid extra AWS charges, destroy the infrastructure when you’re done:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform destroy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;What started as a configuration file is now a live server running in the cloud. No console clicking, no guesswork, no waiting on someone else to provision an environment for you. Just code, a couple of commands, and a result you can see, version, and reproduce.&lt;/p&gt;

&lt;p&gt;The coffee's probably still warm. Not bad for an afternoon's work.&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>aws</category>
    </item>
    <item>
      <title>Step-by-Step Guide to Setting Up Terraform, AWS CLI, and Your AWS Environment</title>
      <dc:creator>Ian Gitonga</dc:creator>
      <pubDate>Wed, 18 Mar 2026 14:48:43 +0000</pubDate>
      <link>https://dev.to/igitonga/step-by-step-guide-to-setting-up-terraform-aws-cli-and-your-aws-environment-33pe</link>
      <guid>https://dev.to/igitonga/step-by-step-guide-to-setting-up-terraform-aws-cli-and-your-aws-environment-33pe</guid>
      <description>&lt;p&gt;&lt;strong&gt;Setting Up Your AWS Account&lt;/strong&gt;&lt;br&gt;
If you don’t already have an AWS account, head over to &lt;em&gt;&lt;a href="https://aws.amazon.com" rel="noopener noreferrer"&gt;https://aws.amazon.com&lt;/a&gt;&lt;/em&gt; and sign up. When you first register for AWS, you initially sign in as the root user. This user account has access permissions to do absolutely anything in the account, so&lt;br&gt;
from a security perspective, it’s not a good idea to use the root user on a day-to-day&lt;br&gt;
basis.&lt;/p&gt;

&lt;p&gt;You'll need to use the &lt;em&gt;Identity and Access Management (IAM)&lt;/em&gt; service. To create a new &lt;em&gt;IAM&lt;/em&gt; user; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to the IAM Console.&lt;/li&gt;
&lt;li&gt;Click Users and then click the Add Users button.&lt;/li&gt;
&lt;li&gt;Enter a name for the user and make sure &lt;em&gt;“Access key - Programmatic access”&lt;/em&gt; is selected. &lt;/li&gt;
&lt;li&gt;Click the Next button. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;AWS will ask you to add permissions to the user. By default, new IAM users have no permissions whatsoever and cannot do anything in an AWS account. To give your IAM user the ability to do something, you need to associate one or more IAM Policies with that user’s account.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click Next a couple more times and then the “Create user” button.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;AWS will show you the security credentials for that user, which consist of an Access Key ID and a Secret Access Key. You must save these immediately because they will never be shown again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installing Terraform&lt;/strong&gt;&lt;br&gt;
The easiest way to install Terraform is to use your operating system’s package manager. For my case since its macOS i use &lt;em&gt;Homebrew&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;brew tap hashicorp/tap
&lt;span class="nv"&gt;$ &lt;/span&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;hashicorp/tap/terraform
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To check if terraform is properly installed run this command&lt;br&gt;
&lt;code&gt;terraform --version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install and Configure the AWS CLI&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download the package installer using curl in your terminal
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="s2"&gt;"https://awscli.amazonaws.com/AWSCLIV2.pkg"&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="s2"&gt;"AWSCLIV2.pkg"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Run the installer
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;installer &lt;span class="nt"&gt;-pkg&lt;/span&gt; AWSCLIV2.pkg &lt;span class="nt"&gt;-target&lt;/span&gt; /
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Verify the installation
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Now to configure aws cli to your AWS account. This will also prompt you for 4 things. You'll get these credentials from the &lt;em&gt;IAM&lt;/em&gt; user we created earlier.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws configure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AWS Access Key ID [None]: AKIA...
AWS Secret Access Key [None]: xxxxxxxxxxxxxxxx
Default region name [None]: us-east-1
Default output format [None]: json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Verify this works. The command below will return your account info.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws sts get-caller-identity
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Just like that your setup for Terraform and AWS CLI is complete.&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>aws</category>
    </item>
    <item>
      <title>What is Infrastructure as Code and Why It's Transforming DevOps</title>
      <dc:creator>Ian Gitonga</dc:creator>
      <pubDate>Tue, 17 Mar 2026 12:30:54 +0000</pubDate>
      <link>https://dev.to/igitonga/what-is-infrastructure-as-code-and-why-its-transforming-devops-1g90</link>
      <guid>https://dev.to/igitonga/what-is-infrastructure-as-code-and-why-its-transforming-devops-1g90</guid>
      <description>&lt;p&gt;&lt;strong&gt;What IaC is and the problem it solves&lt;/strong&gt;&lt;br&gt;
The idea behind infrastructure as Code &lt;em&gt;(IaC)&lt;/em&gt; is that you write and execute code to define, deploy, update and destroy your infrastructure. This represents an important shift in mindset in which you treat all aspects of operations as software, even those aspects that represent hardware e.g setting up physical servers. A key insight is that you can manage almost everything in code like; servers, databases, network, application configuration, documentation, automated tests, deployment processes etc.&lt;/p&gt;

&lt;p&gt;Now a good question to ask is why bother? &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Self-service&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most teams that deploy code manually have a small number of system admins who are the only ones who know all the magic incantations to make the deployment work and are the only ones with access to production. This becomes a major bottleneck as the company grows. If your infrastructure is defined in code, the entire deployment process can be automated and developers can kick off their own deployments whenever necessary.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Speed and safety&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the deployment process is automated, it will be significantly faster since a computer can carry out the deployment steps far faster than a person. Also it's safer given that an automated process will be more consistent, more repeatable and not prone to manual error.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Documentation&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your infrastructure is defined as code, then the state of your&lt;br&gt;
infrastructure is in source files that anyone can read. In other words, IaC acts as documentation, allowing everyone in the organization to understand how things work, even if the system admin isn't available which happens sometimes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Version control&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;IaC source files can be stored in version control. This becomes a powerful tool for debugging issues because any time a problem pops&lt;br&gt;
up, your first step will be to check the commit log and find out what changed in your infrastructure and can resolve problem by reverting back.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Reuse&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can package your infrastructure into reusable modules so that instead of doing every deployment for every product in every environment from scratch, you can build on top of known, documented, battle-tested pieces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The difference between declarative and imperative approaches&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Imperative approach&lt;/em&gt;&lt;br&gt;
This is a style you write code that specifies, step by step, how to achieve some desired end state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;ec2&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ami-0fb653ca2d3203ac1&lt;/span&gt;
    &lt;span class="na"&gt;instance_type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;t2.micro&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Declarative approach&lt;/em&gt;&lt;br&gt;
In this style you write code that specifies your desired end state,&lt;br&gt;
and the IaC tool itself is responsible for figuring out how to achieve that state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_instance"&lt;/span&gt; &lt;span class="s2"&gt;"example"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
  &lt;span class="nx"&gt;ami&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ami-0fb653ca2d3203ac1"&lt;/span&gt;
  &lt;span class="nx"&gt;instance_type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"t2.micro"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note: The code snippets represent this;&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;I want to deploy 10 EC2 instances to run AMI with ID &lt;code&gt;ami-0fb653ca2d3203ac1&lt;/code&gt; (Ubuntu 22.04).&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Terraform is worth learning&lt;/strong&gt;&lt;br&gt;
Terraform is worth learning because it removes a lot of pain you don’t realize is avoidable unless you hear of it's capability or even get to use it. Instead of guessing or repeating manual steps, you just write down what your infrastructure should look like, and it handles the rest. The big win is consistency, you can spin up the same setup today, next week or on someone else’s machine and get the same result.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your personal goals for this 30-day challenge&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Get comfortable enough to use Terraform without overthinking it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Be able to spin up and tear down real infrastructure confidently.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Understand what’s happening under the hood (not just copy-paste configs).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We all talk about scalability, this is my part of the journey in understanding that.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At the end of it, I just want to reach a point where if I need infra, I don’t hesitate....I just write it.&lt;/p&gt;

</description>
      <category>automation</category>
      <category>cloud</category>
      <category>devops</category>
      <category>softwareengineering</category>
    </item>
  </channel>
</rss>
