<?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: Sajid Rashid</title>
    <description>The latest articles on DEV Community by Sajid Rashid (@sajid_rashid).</description>
    <link>https://dev.to/sajid_rashid</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%2F2950555%2F45f82d76-315a-4b25-b349-b37be9540456.jpg</url>
      <title>DEV Community: Sajid Rashid</title>
      <link>https://dev.to/sajid_rashid</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sajid_rashid"/>
    <language>en</language>
    <item>
      <title>Introduction to Prometheus &amp; Grafana for Observability</title>
      <dc:creator>Sajid Rashid</dc:creator>
      <pubDate>Mon, 17 Mar 2025 16:36:17 +0000</pubDate>
      <link>https://dev.to/sajid_rashid/introduction-to-prometheus-grafana-for-observability-4e3d</link>
      <guid>https://dev.to/sajid_rashid/introduction-to-prometheus-grafana-for-observability-4e3d</guid>
      <description>&lt;h2&gt;
  
  
  What is Prometheus?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://prometheus.io/" rel="noopener noreferrer"&gt;Prometheus&lt;/a&gt; is an open-source monitoring and alerting toolkit that is widely used in cloud-native ecosystems. It is the default monitoring solution for Kubernetes and supports metrics-based monitoring with a pull-based data collection model.&lt;/p&gt;

&lt;p&gt;Official Documentation: &lt;a href="https://prometheus.io/docs/introduction/faq/" rel="noopener noreferrer"&gt;Prometheus FAQ&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features of Prometheus:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Time-series Database: Stores metrics efficiently with labels for fast retrieval.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Powerful Querying (PromQL): Allows multi-dimensional queries to analyze data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Push and Pull Metrics Collection: Supports both push (via Pushgateway) and pull-based monitoring.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Service Discovery: Auto-discovers services dynamically, making it ideal for cloud environments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Alerting Mechanism: Works with Alertmanager to trigger alerts based on metric thresholds.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is Grafana?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://grafana.com/" rel="noopener noreferrer"&gt;Grafana&lt;/a&gt; is an open-source data visualization and monitoring tool. It helps users create interactive dashboards with real-time data from various sources, including Prometheus, AWS CloudWatch, Loki, MySQL, and more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features of Grafana:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Customizable Dashboards: Interactive dashboards that combine multiple data sources in one view.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Plugins: A variety of plugins for data sources, visualizations, and apps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Alerts: Built-in alerting to notify teams of potential issues.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Annotations: Overlay events on top of graphs to add context.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Source Support: Integrates with Prometheus, Loki (logs), MySQL, and more.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Observability Pillars: Logs, Metrics, Traces, and Profiles
&lt;/h2&gt;

&lt;p&gt;A reliable system should collect and analyze different types of telemetry data:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Logs&lt;/strong&gt; → Chronological records of events from applications and infrastructure.&lt;br&gt;
&lt;strong&gt;Metrics&lt;/strong&gt; → Numeric time-series data that help track system performance.&lt;br&gt;
&lt;strong&gt;Traces&lt;/strong&gt; → End-to-end request tracking for debugging microservices.&lt;br&gt;
&lt;strong&gt;Profiles&lt;/strong&gt; → Performance profiling to analyze CPU, memory, and execution times.&lt;/p&gt;

&lt;p&gt;Each type of data is collected in specialized databases optimized for different observability needs.&lt;/p&gt;
&lt;h2&gt;
  
  
  Logs in Grafana (Loki)
&lt;/h2&gt;

&lt;p&gt;Loki is a log aggregation system designed to work efficiently with Prometheus. Unlike traditional log systems, Loki does not index full log content, but instead indexes metadata (labels) for fast querying.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Advantages of Loki:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Efficient storage: Uses labels instead of indexing full logs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Integration with Prometheus: Works with Alertmanager for alerting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Supports structured and unstructured logs.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example: How Loki Indexing Works&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Timestamp: 2024-03-17 10:15:00  
Labels: {app="nginx", instance="1.1.1.1"}  
Log Content: "GET /about 200 OK"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Metrics in Prometheus
&lt;/h2&gt;

&lt;p&gt;Prometheus stores time-series data with a label-based model. Instead of storing raw files, it organizes data using key-value pairs (labels).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Metric Labels in Prometheus:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;server_type="web", region="us-east-1"&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Querying with PromQL (Prometheus Query Language)
&lt;/h2&gt;

&lt;p&gt;PromQL is a multi-dimensional query language used for analyzing metrics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Query:&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;rate(http_requests_total[5m])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This query shows the rate of HTTP requests in the last 5 minutes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exemplars:&lt;/strong&gt;&lt;br&gt;
Exemplars are sample data points linked to traces, helping correlate logs and metrics with tracing data.&lt;/p&gt;
&lt;h2&gt;
  
  
  Traces in Tempo
&lt;/h2&gt;

&lt;p&gt;Tempo is a distributed tracing backend used to trace individual transactions through a system. It works alongside Loki and Prometheus.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Cases:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Debugging microservices latency issues.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Identifying slow database queries.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;End-to-end request tracking.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example Query in TraceQL:&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;span.http.route = "/api/v1/user"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Profiles in Pyroscope
&lt;/h2&gt;

&lt;p&gt;Pyroscope is a profiling database that collects application performance data over time. It uses FlameQL for querying.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common Use Cases:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Detecting CPU bottlenecks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Memory leak analysis.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Comparing performance across different software builds.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example FlameQL Query:&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;topk(5, heap_alloc_bytes{app="payment-service"})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This retrieves the top 5 memory allocations in the payment service.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Collection Methods
&lt;/h2&gt;

&lt;p&gt;Observability systems collect data through instrumentation and exporters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Source Instrumentation:&lt;/strong&gt; Uses SDKs, libraries, and agents to collect telemetry data during runtime.&lt;br&gt;
&lt;strong&gt;Frontend Observability:&lt;/strong&gt; Faro collects logs and traces from web applications.&lt;br&gt;
&lt;strong&gt;Backend Monitoring:&lt;/strong&gt; Uses OpenTelemetry to capture application traces and logs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; OpenTelemetry Collector Pipeline&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Application → OpenTelemetry Collector → Prometheus → Grafana&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What to Do with the Data?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Visualization in Grafana&lt;/strong&gt;&lt;br&gt;
Use data sources to connect to Prometheus, Loki, and Tempo.&lt;br&gt;
Configure panels to display metrics, logs, and traces.&lt;br&gt;
&lt;strong&gt;2. Alerting in Grafana&lt;/strong&gt;&lt;br&gt;
Use OnCall for incident response and automated escalation via webhook, email, or Slack notifications.&lt;br&gt;
You can also send alerts to BigPanda via webhook.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Prometheus&lt;/strong&gt; = Metrics collection and monitoring.&lt;br&gt;
&lt;strong&gt;Grafana&lt;/strong&gt; = Data visualization and dashboards.&lt;br&gt;
&lt;strong&gt;Loki&lt;/strong&gt; = Log aggregation.&lt;br&gt;
&lt;strong&gt;Tempo&lt;/strong&gt; = Distributed tracing.&lt;br&gt;
&lt;strong&gt;Pyroscope&lt;/strong&gt; = Performance profiling.&lt;br&gt;
&lt;strong&gt;OpenTelemetry&lt;/strong&gt; = Unified telemetry collection.&lt;/p&gt;

&lt;p&gt;Observability helps make our systems reliable!&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Observability is essential for modern cloud infrastructure. By using Prometheus, Loki, Tempo, and Pyroscope, teams can collect, analyze, and visualize data efficiently in Grafana.&lt;/p&gt;

&lt;p&gt;Follow me for more DevOps and Observability insights! &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Setting Up an IAM Role for Terraform on EC2</title>
      <dc:creator>Sajid Rashid</dc:creator>
      <pubDate>Mon, 17 Mar 2025 14:18:34 +0000</pubDate>
      <link>https://dev.to/sajid_rashid/setting-up-an-iam-role-for-terraform-on-ec2-30nk</link>
      <guid>https://dev.to/sajid_rashid/setting-up-an-iam-role-for-terraform-on-ec2-30nk</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;When running Terraform on AWS EC2, it's best practice to use an IAM role instead of manually managing AWS access keys. An IAM role allows Terraform to securely authenticate and access AWS resources. This guide will walk you through the process of creating an IAM role, attaching it to an EC2 instance, and verifying the setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Create an IAM Role with Permissions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Log in to AWS Management Console&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Navigate to the AWS IAM Console.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Create a New IAM Role&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In the IAM dashboard, click Roles in the left-hand menu.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click Create role.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Select Use Case&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Under Trusted entity type, choose AWS service.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Under Use case, select EC2 (since the role will be used by an EC2 instance).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click Next.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Attach Policies (Permissions)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Choose the necessary permissions for Terraform to run. Some commonly used policies include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;AdministratorAccess (Full access to AWS services).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AmazonS3FullAccess (For managing S3 buckets).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AmazonEC2FullAccess (For full EC2 resource access).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Select the required policies and click Next.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Configure Tags (Optional)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Add tags if needed for identification or tracking.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Click Next.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6. Review and Create Role&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Provide a name (e.g., &lt;em&gt;Terraform-EC2-Role&lt;/em&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Review policies and click Create role.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 2: Attach the IAM Role to Your EC2 Instance
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Go to the EC2 Dashboard&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Navigate to the AWS EC2 Console.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Select Your EC2 Instance&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Under Instances, find and select the EC2 instance where Terraform will run.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Modify the IAM Role&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;With the instance selected, click &lt;strong&gt;Actions&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate to &lt;strong&gt;Security&lt;/strong&gt; &amp;gt; &lt;strong&gt;Modify IAM Role&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Attach the IAM Role&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Select the IAM role created earlier (&lt;em&gt;Terraform-EC2-Role&lt;/em&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click Update IAM Role.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 3: Verify IAM Role is Attached to the EC2 Instance
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Check IAM Role in EC2 Dashboard&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Select the instance and check the Description tab.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensure the IAM role field shows the assigned role (&lt;em&gt;Terraform-EC2-Role&lt;/em&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Verify Permissions from EC2 Instance&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
SSH into your EC2 instance:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh ec2-user@&amp;lt;your-ec2-public-ip&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Run the following command:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;p&gt;This should return details about the IAM role attached to the instance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Run Terraform on EC2
&lt;/h2&gt;

&lt;p&gt;With the IAM role attached, Terraform will automatically authenticate with AWS, eliminating the need for manual AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Run Terraform Commands:&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;terraform init
terraform plan
terraform apply
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Terraform will now use the IAM role to authenticate with AWS and manage resources.&lt;/p&gt;

&lt;p&gt;Follow me for more tips :)&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>devops</category>
      <category>aws</category>
    </item>
    <item>
      <title>What is Terraform? Everything You Need to Know</title>
      <dc:creator>Sajid Rashid</dc:creator>
      <pubDate>Mon, 17 Mar 2025 13:46:19 +0000</pubDate>
      <link>https://dev.to/sajid_rashid/what-is-terraform-everything-you-need-to-know-nlp</link>
      <guid>https://dev.to/sajid_rashid/what-is-terraform-everything-you-need-to-know-nlp</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Terraform is an Infrastructure as Code (IaC) tool developed by HashiCorp that allows you to define, provision, and manage infrastructure using a declarative configuration language called HCL (HashiCorp Configuration Language). Terraform is widely used in cloud environments like AWS, Azure, and Google Cloud to automate infrastructure provisioning and ensure repeatability.&lt;/p&gt;

&lt;p&gt;This article will provide an in-depth understanding of Terraform, its benefits, installation, key commands, and usage with cloud providers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Use Terraform?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Terraform is a powerful tool that helps DevOps and infrastructure engineers achieve repeatability, automation, and version control in infrastructure provisioning. Some key benefits include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Repeatability: Infrastructure can be defined and deployed consistently.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Auditability: Changes are tracked in a version control system (VCS) like Git.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Change Control: Any infrastructure change is introduced via code updates.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Collaboration: Teams can work together using GitHub, GitLab, or Bitbucket.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key Terminology
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;IaC (Infrastructure as Code): Managing infrastructure through code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CM (Configuration Management): Tools like Ansible, Puppet, SaltStack for managing configurations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;IaaS (Infrastructure as a Service): AWS, Azure, and other cloud providers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PaaS (Platform as a Service): Platforms for hosting applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;VCS (Version Control System): Git, GitHub, or GitLab for tracking changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CI/CD (Continuous Integration/Continuous Deployment): Automating deployment pipelines.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SDLC (Software Development Life Cycle): The development workflow from planning to maintenance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Declarative vs. Imperative Approaches
&lt;/h2&gt;

&lt;p&gt;Terraform follows the Declarative approach, meaning you describe the desired state of infrastructure, and Terraform figures out how to achieve it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Declarative Example:&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;resource "aws_instance" "web" {
  ami           = "ami-12345678"
  instance_type = "t2.micro"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Imperative Approach:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Using CLI tools like AWS CLI or Python scripts to manually define the provisioning steps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Terraform Components
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Terraform Configuration Files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Terraform configuration consists of .tf files that define infrastructure resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. State File&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Terraform keeps track of deployed resources in a state file (terraform.tfstate). This file can be stored locally or in a remote backend like AWS S3 or Terraform Cloud.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Modules and Registry&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Terraform modules allow code reusability and modularity, while the Terraform Registry provides pre-built modules for infrastructure components.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Terraform
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Using Docker:&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;docker pull hashicorp/terraform:latest
docker run --rm hashicorp/terraform --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;On CentOS:&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;sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo yum -y install terraform
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;On Amazon Linux/EC2:&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;sudo yum install -y yum-utils shadow-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
sudo yum -y install terraform
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Terraform Workflow
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Initializing Terraform&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;terraform init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This prepares Terraform to manage infrastructure by downloading necessary providers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Planning Infrastructure Changes&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;terraform plan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compares the desired configuration with the current state and generates an execution plan.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Applying Changes&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;terraform apply

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

&lt;/div&gt;



&lt;p&gt;Executes the plan and provisions the infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Destroying Resources&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;terraform destroy

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

&lt;/div&gt;



&lt;p&gt;Removes all resources managed by Terraform.&lt;/p&gt;

&lt;h2&gt;
  
  
  Terraform in a Version Control Environment
&lt;/h2&gt;

&lt;p&gt;Terraform configurations should be managed using a Git repository to track changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pushing Changes to GitHub&lt;/strong&gt;&lt;br&gt;
1- Clone the repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/your-repo/terraform-project.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2- Initialize Terraform:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;3- Generate a plan:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;terraform plan -out=tfplan.out
terraform show -no-color tfplan.out &amp;gt; tfplan.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4- Apply changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;terraform apply tfplan.out
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5- Push changes to GitHub:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .
git commit -m "Added Terraform configuration"
git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Creating an EC2 Instance with Terraform
&lt;/h2&gt;

&lt;p&gt;Here’s how you can launch an EC2 instance using Terraform:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;main.tf (Terraform configuration 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;provider "aws" {
  region = "eu-west-2"
}

resource "aws_instance" "web" {
  ami           = "ami-12345678"
  instance_type = "t2.micro"
  tags = {
    Name = "Terraform-EC2-Instance"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Execution Steps:&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;terraform init
terraform plan -out=tfplan.out
terraform apply tfplan.out
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once applied, Terraform will output Instance ID, Public IP, and other details.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Terraform is a powerful, declarative IaC tool that simplifies infrastructure provisioning and management. With support for multiple cloud providers, modular code, and version control integration, it is an essential tool for DevOps engineers.&lt;/p&gt;

&lt;p&gt;Start using Terraform today and automate your cloud infrastructure efficiently!&lt;/p&gt;

&lt;p&gt;Follow me for more DevOps insights! :)&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>cicd</category>
      <category>devops</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
