<?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 Adeel Subhan on Medium]]></title>
        <description><![CDATA[Stories by Adeel Subhan on Medium]]></description>
        <link>https://medium.com/@adeelsubhan25?source=rss-542d631820c3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5beMZewwzttwSnorn7nfWg.jpeg</url>
            <title>Stories by Adeel Subhan on Medium</title>
            <link>https://medium.com/@adeelsubhan25?source=rss-542d631820c3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 08:10:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adeelsubhan25/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[Automation with Ansible: A Beginner’s Guide]]></title>
            <link>https://medium.com/@adeelsubhan25/automation-with-ansible-a-beginners-guide-18bb19b7d632?source=rss-542d631820c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/18bb19b7d632</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[ansible]]></category>
            <dc:creator><![CDATA[Adeel Subhan]]></dc:creator>
            <pubDate>Thu, 24 Nov 2022 15:03:58 GMT</pubDate>
            <atom:updated>2022-11-24T15:03:58.808Z</atom:updated>
            <content:encoded><![CDATA[<p>Ansible is an open-source, cross-platform tool for resource provisioning automation. It can be used to<strong> </strong>provision the underlying infrastructure of your environment, virtualized hosts/hypervisors, network devices, and bare metal servers.</p><p>Sounds familiar? In our last article, we discussed <a href="https://medium.com/@adeelsubhan25/terraform-beginner-guide-and-setup-with-aws-61ef50ae9b08">Terraform</a>, an Infrastructure as Code tool which is also focused on resource provisioning automation of cloud. Certainly, you might think why use two similar tools for the same job?</p><p><strong>Why Ansible?</strong></p><p><em>Both Ansible and Terraform are open-source tools with huge user bases, which often leads to cult followings because of the classical “hammer” approach. That is, if my only tool is a hammer, every problem will start resembling a nail. [</em><a href="https://www.ansible.com/blog/author/sean-cavanaugh">Sean Cavanaugh</a>]</p><p>While the two tools have a lot of what they offer in common, each specializes in a specific category and can be used simultaneously.</p><ul><li>Terraform: A tool that excels in the <em>Configuration </em>of resources.</li><li>Ansible: A tool that excels in the <em>Configuration Management</em> of resources.</li></ul><p>Before taking a deep dive into Ansible<strong>, </strong>let’s build a scenario where we have to set up and maintain two EC2 instances on the AWS cloud. Here’s how we’d go about it:</p><ol><li>To create the infrastructure (EC2, VPC), we’ll use Terraform.</li><li>Once the infrastructure is created, we’ll use Ansible to manage and apply changes to the Infrastructure. Using Ansible, we can install services, add compute hosts, and provision resources, services, and applications inside of your cloud.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*PXBk991S9iR8YWdcc1QOzQ.png" /></figure><p><strong>How does Ansible work?</strong></p><p>To use Ansible you need at least two nodes, a<em> control node,</em> and a <em>managed node</em>, with as many <em>managed nodes </em>as you require. The <em>managed nodes </em>are controlled by <em>control nodes</em>. The configuration works by connecting to nodes (servers/clients) on a network and then sending a program called an Ansible <em>module </em>to that node. Ansible executes these modules over SSH and removes them when finished. SSH keys are required by the <em>control nodes</em> to get access to <em>managed nodes</em>.</p><p><strong>Ansible Playbook</strong></p><p>Ansible playbook is another name for a file that contains a script defining configurations for servers. It has a set of steps that’d be usually followed by an engineer if they were to set up a node. Unlike Terraform, which is <em>declarative</em>, Ansible scripts are p<em>rocedural </em>and require each task to be done in a specific order and do not take into account any dependencies whatsoever, so you’ll need to be much more careful when writing Ansible playbooks. Ansible playbooks use YAML, which is a human-readable language and is much easier to understand than other serialization languages like JSON and XML. Here’s a simple script to install Apache server on a host:</p><pre>  --- YAML files start with three dashes<br>  - hosts: apache<br>    sudo: yes<br>    tasks:<br>      - name: install apache2<br>        apt: name=apache2 update_cache=yes state=latest</pre><p>There are some important parameters you need to know before writing your own Ansible playbook.</p><pre>--- YAML files start with three dashes<br>- name: “My play”     #Use the name mapping to name your play<br>  hosts: all          #Define which hosts the play runs on,[etc/ansible/hosts].<br>                   <br><br>  tasks:              #Open a tasks mapping, which will contain a sequence<br>  - name: “My task”   #Give the task a name with the name mapping<br>    some_module:      #Import a module as a new mapping containing parameters<br>       path: ‘/example/’ <br><br>  - name: “My other task” #A play may contain more than one task<br>    other_module:         #A task usually imports a module<br>      foo: ‘bar’</pre><p>By now, you should have an understanding of scenarios where Ansible might be helpful and how you can effectively use Ansible playbooks to create and manage the infrastructure of your machines.</p><h4>Installing Ansible</h4><p>We’re going to use Ubuntu for installation as Ansible cannot run on a <em>Windows</em> host<strong> </strong>and can only manage Windows hosts, but Ansible can be run under the <a href="https://learn.microsoft.com/en-us/windows/wsl/install">Windows Subsystem for Linux (WSL)</a>.</p><p><strong>Step 1: Configuring Nodes and SSH key pair</strong></p><p>Add a control node as administrator:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*_1cx75clqpQFCAqi8vcA-w.png" /></figure><p>To give administrative privileges to the control node:</p><pre>sudo usermod -aG sudo [controlnode/usrname] </pre><p>To generate key pair:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*CQUZwSIk85NUBOfkgK9vIA.png" /></figure><p>To configure the host:</p><pre> ssh-copy-id username@remote_host</pre><p><strong>Step 2: Installing Ansible</strong></p><p>To update system packages and install software properties:</p><pre>sudo apt-get update<br>sudo apt-get install software-properties-common</pre><p>Installing Ansible</p><pre> sudo apt install ansible</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*ggv7L6AcMbPRgLWlZ7raWw.png" /></figure><p><strong>Step 3: Adding Hosts to Control Node</strong></p><p>To access the inventory file from the control node:</p><pre>sudo nano /etc/ansible/hosts</pre><p>With the host file open, you can add hosts to your control node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*At2maUeng4JKlqIG8HCnnw.png" /></figure><pre>[category name]<br>server_name ansible_host=[server_ip]</pre><p>Once you’ve changed the file, save and exit. You can check the inventory by the executing following command on the control node:</p><pre>ansible-inventory --list -y</pre><p><strong>Step 4: Verification</strong></p><p>To check a successful connection to the hosts:</p><pre>ansible all -m ping</pre><p>That was a lot of information to process, wasn’t it? I hope every reader is able to understand the applications and basics of Ansible.</p><p><strong><em>Thanks for Reading! </em></strong>If you liked the blog, please let me know in the comments, and feel free to give feedback if there’s something to improve.</p><p><strong>Learning Resources:</strong></p><p><a href="https://spacelift.io/blog/ansible-vs-terraform">Ansible vs. Terraform: Key Differences and Comparison of Tools (spacelift.io)</a></p><p><a href="https://phoenixnap.com/kb/install-ansible-ubuntu-20-04">How to Install and Configure Ansible on Ubuntu 20.04 (phoenixnap.com)</a></p><p><a href="https://opensource.com/sites/default/files/gated-content/osdc_cheatsheet-ansible.pdf">Ansible cheatsheet from opensource.com</a></p><p><a href="https://www.simplilearn.com/tutorials/ansible-tutorial/what-is-ansible">What is Ansible And How to Use Ansible in Docker [Updated] (simplilearn.com)</a></p><p><a href="https://www.ansible.com/blog/ansible-vs.-terraform-demystified#:~:text=The%20primary%20difference%20for%20their,an%20infrastructure%20as%20code%20tool.">Ansible vs. Terraform Demystified</a></p><p><strong>Additional Learning Resources and Community🙋</strong></p><p><a href="https://www.youtube.com/channel/UC7B9fl8jQ8TEdOCypF4g3Wg">The CLOUDNATIVEFM With SAIM — YouTube</a></p><p><a href="https://community.cncf.io/islamabad/">CNCF Islamabad</a></p><p><a href="https://twitter.com/CloudIslamabad">CNCF Twitter</a></p><p><strong>References:</strong></p><p><a href="https://www.ansible.com/">Ansible is Simple IT Automation</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18bb19b7d632" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform — Beginner Guide and Setup with AWS]]></title>
            <link>https://medium.com/@adeelsubhan25/terraform-beginner-guide-and-setup-with-aws-61ef50ae9b08?source=rss-542d631820c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/61ef50ae9b08</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Adeel Subhan]]></dc:creator>
            <pubDate>Sun, 23 Oct 2022 08:36:47 GMT</pubDate>
            <atom:updated>2022-11-15T20:41:24.162Z</atom:updated>
            <content:encoded><![CDATA[<h3>Terraform — Beginner Guide and Setup with AWS</h3><p>When building an instance in the cloud you may find yourself using the graphical user interface of your cloud provider. Clicking on buttons and paying for products just like you would on an e-commerce site. The drawback of this approach is that it’s a complete and total chaos and you might click a thousand different buttons to get your Virtual Machine configured properly. Moreover, what happens when you need to reproduce the same VM in the future? You’d have to go through the same exhaustive process once again.</p><h4><strong>Terraform: What it is and how does it solve the problem?</strong></h4><p>Terraform is infrastructure as code tool that allows you to create and provision resources in cloud using HCL (HASHICORP Configuration Language) or JSON. In addition to HCL, the CDK for Terraform (CDKTF) allows you to define your infrastructure in a familiar programming language such as TypeScript, Python, Go, C#, or Java.</p><p>Terraform allows you to <em>automate </em>and <em>manage </em>cloud infrastructure, services and platform all from a single file which you can share and reuse. This saves a lot of time as you don’t have to handle cloud infrastructure manually by logging into your cloud services and creating each component of your infrastructure. Need to change something in your infrastructure? No problem, you can just update your code and changes will be applied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BKqMHYB2yvEP4BtAqzp2QQ.png" /><figcaption>Visualization of Terraform Automation</figcaption></figure><p><strong>How to automate your Cloud Infrastructure?</strong></p><p><strong>Step 1: Setting Up Terraform.</strong></p><p><em>I will be using windows to set up terraform and will be using AWS as cloud provider for this tutorial.</em></p><p>Setting up terraform is pretty straight forward, here are the steps you need to follow (I’ve used windows in this setup):</p><ol><li>Download Terraform: <a href="https://www.terraform.io/downloads">Downloads | Terraform by HashiCorp</a></li><li>Extract terraform.exe</li><li>Add terraform.exe path to path variable<em> (System properties →environment variables →path → [Add path to terraform.exe])</em></li></ol><p>You can verify your installation using CMD:</p><pre>terraform --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/230/1*RmQ1ozA6f2EPRH5glOKDug.png" /><figcaption>Verifying Installation</figcaption></figure><p><strong>Step 2: Setting Up AWS CLI.</strong></p><p>Setting up AWS CLI is just downloading and running an exe file. You can get your installation file from here: <a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html">Installing or updating the latest version of the AWS CLI — AWS Command Line Interface (amazon.com)</a></p><p>Once you’ve installed AWS CLI you can verify your installation by running the following command on CMD:</p><pre>terraform configure</pre><p>You’ll have to configure AWS by entering AWS Access Key ID <br>AWS Secret Access Key and Default Region. (You can access your credentials from <em>IAM →Users →User_Name →Security Credentials →Create Access Key →Download CSV(Credentials).</em></p><p>Once you’ve configured AWS, you can start writing you first Terraform script. In this tutorial I’ll be creating a <em>T2. micro EC2 </em>instance with <em>Amazon Linux2 AMI </em>using terraform<em>.</em></p><p><strong>Step 3: Writing Terraform Script.</strong></p><p><em>Pre-requisites: </em><strong><em>Visual Studio Code &amp; HashiCorp Terraform Extension.</em></strong></p><p>After installing Terraform extension, create a folder for main.tf (terraform script) with terraform.exe in it. Here’s the script for our configuration of EC2 instance:</p><pre>provider &quot;aws&quot; {<br>region = &quot;us-east-1&quot; #select your default region<br>}</pre><pre>resource &quot;aws_instance&quot; &quot;LinuxVM&quot; {<br>ami = &quot;ami-047a51fa27710816e&quot;<br>instance_type = &quot;t2.micro&quot;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d0TRoOdGjOkZZM3dw-T2YQ.png" /><figcaption>TF script</figcaption></figure><p>Simple enough, right? Now we just have to execute the script but first we’ll need to initialize terraform by using the following command:</p><pre>terraform init</pre><p>After initializing, you should have a similar output to one shown in picture above. Our next command is to validate our terraform script which is:</p><pre>terraform validate</pre><p>This should return <em>“</em><strong><em>Success</em></strong><em>! The configuration is valid.” </em>if your script had no issues. The next step is to check whether the execution plan for a set of changes matches your expectations without making any changes to real resources or to the state.</p><pre>terraform plan</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*70dvajNnPqfXltsf9y6rSA.png" /><figcaption>Output from terraform plan command</figcaption></figure><p>Our configuration file is ready and just needs to create resources in AWS. To create resources in AWS, use the following command:</p><pre>terraform apply</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*vJCkDZedIlmnQKEmseQbQQ.png" /><figcaption>Verification</figcaption></figure><p>You’ll be asked to verify the execution, type <em>“yes”</em> to approve. You should have an output like this if your instance was created: <em>Creation Complete.</em></p><p>Congrats, you’ve just created an EC2 instance using an infrastructure as code tool only.</p><p><strong><em>Thanks for Reading! </em></strong>If you liked my tutorial let me know in the comments and please feel free to give feedback if there’s something to improve.</p><p><strong>Learning Resources:</strong></p><p><a href="https://www.youtube.com/channel/UC7B9fl8jQ8TEdOCypF4g3Wg">The CLOUDNATIVEFM With SAIM — YouTube</a></p><p><a href="https://community.cncf.io/islamabad/">CNCF Islamabad</a></p><p><a href="https://twitter.com/CloudIslamabad">CNCF Twitter</a></p><p><strong>Addtional Learning Resources:</strong></p><p><a href="https://spacelift.io/blog/terraform-best-practices">12 Terraform Best Practices to Improve your TF workflow (spacelift.io)</a></p><p><strong>References:</strong></p><p><a href="https://www.terraform.io/">Terraform by HashiCorp</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61ef50ae9b08" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to setup and build Docker Images on Windows]]></title>
            <link>https://medium.com/@adeelsubhan25/how-to-setup-and-build-docker-images-on-windows-baf252152aca?source=rss-542d631820c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/baf252152aca</guid>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Adeel Subhan]]></dc:creator>
            <pubDate>Tue, 06 Sep 2022 21:59:56 GMT</pubDate>
            <atom:updated>2022-09-07T19:21:20.157Z</atom:updated>
            <content:encoded><![CDATA[<p>Docker is a containerization platform that allow quick and easy replication of your working environment. This is done by standardizing version of libraries used, random seeds and even the OS. However, we we’re restricted to using Virtual Machines for using Linux on Windows (which are really slow and resource heavy) for a long time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nRw66pS3Fr-InxLIM914wA.jpeg" /></figure><p>With the release of WSL (Windows Subsystem for Linux), you can run Linux command-line tools and Linux filesystem on windows. WSL is lighter than a Virtual Machine and consumes less resources.</p><p>In this guide, you’ll learn how to setup docker on windows and run Linux based containerized application on windows.</p><p><strong>Installing WSL</strong></p><p>Installing WSL on windows has gotten effortless recently. You just need to go to Command Prompt with Administrator privilege and type in the following command.</p><pre>wsl --install</pre><p>This command will enable necessary features required to run WSL and install the Ubuntu distribution of Linux by default. After installation, you’ll be proceeded to setting up your user account and password. Once this is done, install Remote- WSL extension from Visual Studio Code.</p><p>For further information regarding WSL: <a href="https://docs.microsoft.com/en-us/windows/wsl/install">Install WSL | Microsoft Docs</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eVCgGXz_EOGtMu9nmPuSKw.jpeg" /><figcaption>Remote-WSL Extension</figcaption></figure><p><strong>Installing Docker</strong></p><p>Our next step is installing Docker, for this we’ll have to download Docker Desktop which provides us an interface to manage and run container Images. Use the following link for Docker setup file: <a href="https://docs.docker.com/desktop/install/windows-install/">Install Docker Desktop on Windows | Docker Documentation</a>.</p><p>Once you’ve docker installed it’s time to install Docker extension in WSL window using Visual Studio Code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*3kGAFi0gdMqeh3-AZUXWDg.gif" /><figcaption>Installation of Extensions</figcaption></figure><p>Congrats 🙌, you’ve successfully installed Docker and you’re done with your setup, now it’s time to containerize and run your application.</p><p><strong>Building and Running a Docker Container</strong></p><p>I’ve chosen to run a simple python script that we’ll containerize. Here are some simple steps you need to follow along to build your Docker Image:</p><ol><li>Open command palette by <em>View → Command</em> Palette or <em>Ctrl + Shift + P</em></li><li>Choose you work environment E.g., Flask/NodeJS</li><li>Select your <em>main</em> file</li><li>Include optional Docker compose files? No, as we aren’t deploying multiple containers for now.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*tbW_S2oG9Ui7HVxUsSUyjQ.gif" /><figcaption>Visual demo of steps mentioned above</figcaption></figure><p>By the end of this process, you shall have a Docker file that you can build. Now use these commands in your WSL terminal to build your Container:</p><pre>docker build Dockerfile</pre><p>Note that the command above may take some time to execute as your container is downloading dependencies and collecting metadata.</p><p>To run your container, use the following command:</p><pre>docker run example</pre><p>WOALA! You just built and ran a Linux container on windows using WSL.</p><p><strong><em>Thanks for Reading! </em></strong>If you liked my tutorial let me know in the comments and please feel free to give a feedback if there’s something to improve.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=baf252152aca" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>