<?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 Vishal Saini on Medium]]></title>
        <description><![CDATA[Stories by Vishal Saini on Medium]]></description>
        <link>https://medium.com/@vishalsaini1100?source=rss-06ce3acff70f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gyJgLp0kMigwGu5_U7P_Og.jpeg</url>
            <title>Stories by Vishal Saini on Medium</title>
            <link>https://medium.com/@vishalsaini1100?source=rss-06ce3acff70f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 09:30:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vishalsaini1100/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[A Step-by-Step Guide to Restoring EC2 Instances Using AWS Backup and EC2 Image Builder]]></title>
            <link>https://awstip.com/a-step-by-step-guide-to-restoring-ec2-images-using-aws-backup-vault-imagebuilder-and-terraform-ae1aed6e72d1?source=rss-06ce3acff70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae1aed6e72d1</guid>
            <category><![CDATA[backup-and-restore]]></category>
            <category><![CDATA[failover]]></category>
            <category><![CDATA[backup-vault]]></category>
            <category><![CDATA[disaster-recovery]]></category>
            <category><![CDATA[aws-ec2-image-builder]]></category>
            <dc:creator><![CDATA[Vishal Saini]]></dc:creator>
            <pubDate>Thu, 27 Feb 2025 16:26:12 GMT</pubDate>
            <atom:updated>2025-06-26T12:28:19.782Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Restoring an EC2 instance is a critical process for ensuring disaster recovery (DR) and business continuity. This guide provides a detailed, AWS-specific approach to restoring EC2 instances using <strong>AWS Backup</strong> and <strong>EC2 Image Builder</strong>. By leveraging these services, you can streamline the recovery process, minimize downtime, and ensure a seamless transition to a disaster recovery region.</p><p>Whether you’re recovering a production instance or preparing for failover, this step-by-step guide will help you restore your EC2 instances efficiently.</p><h3>Process Flow Overview</h3><p>The restoration process involves the following key steps:</p><ol><li><strong>Obtain EC2 Hostname</strong>: Identify the EC2 instance to be restored.</li><li><strong>Access AWS Backup Vault</strong>: Retrieve the latest backup from the Backup Vault.</li><li><strong>Create an AMI from the Backup</strong>: Use the backup to create an Amazon Machine Image (AMI).</li><li><strong>Share AMI to the DR Region</strong>: Share the AMI with the disaster recovery region.</li><li><strong>Launch a New EC2 Instance in the DR Region</strong>: Use the shared AMI to deploy the instance.</li><li><strong>Access the EC2 Instance and Restore Data</strong>: Log in and execute the restore script.</li><li><strong>Join the Instance to the Domain</strong>: Work with the security team to join the instance to the domain.</li><li><strong>Verify Restoration</strong>: Confirm the instance is fully functional.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*99pqAkdao0qNxNh4JfGKyA.png" /></figure><h3>Step-by-Step Guide</h3><h3>Step 1: Obtain EC2 Hostname</h3><ol><li>Log in to the <strong>AWS Management Console</strong>.</li><li>Navigate to the <strong>EC2 Dashboard</strong>.</li><li>Identify the EC2 instance you want to restore and note its <strong>hostname</strong> or <strong>instance ID</strong>.</li></ol><h3>Step 2: Access AWS Backup Vault</h3><ol><li>Open the <strong>AWS Backup</strong> service in the AWS Management Console.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hByyZRhI52dKTbBHfJfgKw.png" /></figure><ol><li>Locate the <strong>Backup Vault</strong> where your EC2 instance backups are stored.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*-p3wxdpbxVpfamiv_HwAHA.png" /></figure><ol><li>Retrieve the latest backup for the EC2 instance. Note the <strong>backup ID</strong> and associated metadata.</li></ol><h3>Step 3: Create an AMI from the Backup</h3><ol><li>In the <strong>AWS Backup</strong> console, select the backup you want to restore.</li><li>Choose the <strong>Create AMI</strong> option to generate an Amazon Machine Image from the backup.</li><li>Specify the necessary configurations, such as the AMI name, description, and region.</li><li>Wait for the AMI creation process to complete.</li></ol><h3>Step 4: Share AMI to the DR Region</h3><ol><li>Navigate to the <strong>EC2 Dashboard</strong> and select <strong>AMIs</strong> under the <strong>Images</strong> section.</li><li>Locate the newly created AMI and modify its <strong>sharing settings</strong>.</li><li>Share the AMI with the <strong>disaster recovery (DR) region</strong> by specifying the target region and account ID (if applicable).</li></ol><h3>Step 5: Launch a New EC2 Instance in the DR Region</h3><ol><li>Switch to the <strong>DR region</strong> in the AWS Management Console.</li><li>Navigate to the <strong>EC2 Dashboard</strong> and select <strong>Launch Instance</strong>.</li><li>Choose the <strong>shared AMI</strong> from the list of available AMIs.</li><li>Configure the instance settings (e.g., instance type, network settings, and security groups) to align with your recovery requirements.</li><li>Launch the instance and verify its status in the EC2 Dashboard.</li></ol><h3>Step 6: Access the EC2 Instance and Restore Data</h3><ol><li>Retrieve the <strong>login credentials</strong> for the new EC2 instance.</li><li>Connect to the instance using <strong>RDP</strong> (for Windows) or <strong>SSH</strong> (for Linux).</li><li>Execute the <strong>restore script</strong> to recover any additional data or configurations.</li></ol><h3>Step 7: Domain Join and Secure Access</h3><ol><li>Coordinate with your <strong>security team</strong> to join the EC2 instance to the domain.</li><li>Verify that the instance is successfully integrated into the domain.</li><li>Secure access to the instance by updating credentials and permissions as needed.</li></ol><h3>Step 8: Verify Restoration</h3><ol><li>Perform a thorough check to ensure the EC2 instance is fully functional.</li><li>Test applications and services running on the instance to confirm they are operating as expected.</li><li>Document the restoration process for future reference.</li></ol><h3>Conclusion</h3><p>Restoring an EC2 instance using <strong>AWS Backup</strong> and <strong>EC2 Image Builder</strong> provides a structured and efficient approach to disaster recovery. By following this guide, you can minimize downtime, ensure business continuity, and confidently recover your EC2 instances in a disaster recovery region.</p><p>These AWS-native tools eliminate the need for complex third-party integrations, making the restoration process straightforward and reliable.</p><p>Have questions or need further assistance? Drop them in the comments below! 👇</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae1aed6e72d1" width="1" height="1" alt=""><hr><p><a href="https://awstip.com/a-step-by-step-guide-to-restoring-ec2-images-using-aws-backup-vault-imagebuilder-and-terraform-ae1aed6e72d1">A Step-by-Step Guide to Restoring EC2 Instances Using AWS Backup and EC2 Image Builder</a> was originally published in <a href="https://awstip.com/">AWS Tip</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplified Guide to Terraform Import with S3 Backend]]></title>
            <link>https://medium.com/@vishalsaini1100/simplified-guide-to-terraform-import-with-s3-backend-ecf3c129aa5d?source=rss-06ce3acff70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecf3c129aa5d</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[terraform-import]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Vishal Saini]]></dc:creator>
            <pubDate>Wed, 04 Dec 2024 17:24:28 GMT</pubDate>
            <atom:updated>2024-12-04T17:24:28.827Z</atom:updated>
            <content:encoded><![CDATA[<p>If your Terraform state file is managed using an <strong>S3 backend</strong>, importing existing resources follows the same principles as usual but requires careful handling of the remote state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dv0Z0C-Lpxvxu6OY7TfzDw.png" /></figure><h3>Tips for Importing Resources</h3><ol><li><strong>Backup State</strong>: Always back up your S3 state file before importing to prevent accidental loss or corruption.</li></ol><pre>aws s3 cp s3://your-s3-bucket-name/path/to/terraform.tfstate ./terraform.tfstate.bak</pre><ol><li><strong>Import One Resource at a Time</strong>: Avoid importing multiple resources in a single command to reduce errors.</li><li><strong>Use Clear Names</strong>: Use descriptive names for resources to simplify management.</li></ol><h3>Step-by-Step Process</h3><h4>1. Verify Backend Configuration</h4><p>Ensure your backend block in provider is correctly configured:</p><pre>terraform {<br>  backend &quot;s3&quot; {<br>    bucket         = &quot;your-s3-bucket-name&quot;<br>    key            = &quot;path/to/terraform.tfstate&quot;<br>    region         = &quot;your-region&quot;<br>  }<br>}</pre><p>Run terraform init to initialize the S3 backend.</p><h4>2. Write the Resource Block</h4><p>Define the resource in your .tf file without attributes. For example, to import an AWS EC2 instance:</p><pre>resource &quot;aws_instance&quot; &quot;example&quot; {<br>  # Configuration<br>}</pre><h4>3. Find the Resource ID</h4><p>Locate the unique identifier of the resource. For an EC2 instance, this would be its instance ID (e.g., i-0abcd1234efgh5678).</p><h4>4. Import the Resource</h4><p>Use the terraform import command to map the resource to the state:</p><pre>terraform import aws_instance.example i-0abcd1234efgh5678</pre><p>Since the state is stored in S3, the changes are automatically synced.</p><h4>5. Update the Configuration</h4><p>Run the following to view resource attributes:</p><pre>terraform state show aws_instance.example</pre><p>Copy the attributes and update the .tf file accordingly:</p><pre>resource &quot;aws_instance&quot; &quot;example&quot; {<br>  ami           = &quot;ami-0abcdef1234567890&quot;<br>  instance_type = &quot;t2.micro&quot;<br>  key_name      = &quot;my-key&quot;<br>  subnet_id     = &quot;subnet-0abcd1234&quot;<br>  tags = {<br>    Name = &quot;MyImportedInstance&quot;<br>  }<br>}</pre><h4>6. Validate</h4><p>Run terraform plan to ensure the configuration matches the imported resource:</p><pre>terraform plan</pre><p>If there are no changes, the import is successful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecf3c129aa5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring AWS Firecracker: The Future of Lightweight Virtualization]]></title>
            <link>https://awstip.com/exploring-aws-firecracker-the-future-of-lightweight-virtualization-a20d9d31a2d0?source=rss-06ce3acff70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a20d9d31a2d0</guid>
            <category><![CDATA[serverless-architecture]]></category>
            <category><![CDATA[aws-firecracker]]></category>
            <category><![CDATA[microvm]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <dc:creator><![CDATA[Vishal Saini]]></dc:creator>
            <pubDate>Mon, 18 Nov 2024 08:33:52 GMT</pubDate>
            <atom:updated>2025-03-17T13:57:06.644Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DuNhi5xnZCb2OjU1.png" /></figure><p>In the rapidly evolving landscape of cloud computing, efficiency and performance are paramount. As organizations strive to maximize their resources, <strong>AWS Firecracker</strong> emerges as a game-changing solution for lightweight virtualization. Designed to run serverless functions and microservices at scale, Firecracker optimizes resource usage while ensuring robust security.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*5EPiMGzzW5prAQrI" /></figure><p>Let us dive into its architecture, key features, applications, and how it compares with traditional virtualization methods.</p><ol><li><strong>What is AWS Firecracker?</strong></li></ol><p>AWS Firecracker is an open-source virtualization technology that allows users to create and manage <strong>microVMs</strong> (micro virtual machines).</p><ul><li><strong>Purpose</strong>: Specifically built for workloads like serverless computing and containerized applications.</li><li><strong>Efficiency</strong>: Launch thousands of microVMs on a single physical server, optimizing resource utilization.</li></ul><p><strong>2. Firecracker vs. Containers</strong></p><p>Firecracker is a <strong>Virtual Machine Manager (VMM)</strong> optimized for running transient and short-lived processes. While containers (like Docker) are indeed faster and lighter than traditional VMs, they come with security trade-offs due to their relaxed isolation levels.</p><ul><li><strong>Isolation</strong>: VMs provide stronger isolation, making them more secure for sensitive workloads.</li><li><strong>Startup Time</strong>: Docker images can negatively impact function startup times, whereas Firecracker microVMs can boot in less than <strong>125 milliseconds</strong>.</li></ul><p>To bridge the gap between VMs and containers, several platforms have advocated for a <strong>one VM per container</strong> architecture. Examples include Microsoft’s Hyper-V Containers and VMware’s vSphere Integrated Containers. However, these solutions do not match the speed of AWS Lambda, which utilizes Firecracker for rapid microVM deployment.</p><p>While many serverless projects like Apache OpenWhisk and Kubeless rely on containers, they share similar challenges with single-VM containers. In my view, containers and serverless technologies serve distinct purposes, and relying solely on containers for serverless infrastructure may not be sustainable in the long-term.</p><p>Projects implementing serverless solutions based on containers should embrace Firecracker. It complements container technologies while being manageable through Kubernetes.</p><p><strong>3. Behind the Scenes of Firecracker</strong></p><p>Firecracker adopts a unique approach for isolation by leveraging <strong>KVM</strong> (Kernel-based Virtual Machine), which is built into every Linux Kernel version 4.14 or later. KVM is a type-1 hypervisor that collaborates with hardware virtualization capabilities from Intel and AMD.</p><p>Firecracker deserves attention for its innovative balance between the speed of containers and the security of VMs.</p><p><strong>4. KVM and QEMU</strong></p><p>In traditional virtualization setups, KVM is often paired with <strong>QEMU</strong>, which emulates various virtual resources. However, QEMU can slow down performance because it translates every privileged system call. Firecracker replaces QEMU with a minimalistic VMM that focuses only on essential virtual resources.</p><p>This architecture allows Firecracker to maintain the acceleration provided by KVM and hardware-assisted virtualization while minimizing overhead. Firecracker runs in user space and communicates directly with KVM embedded in the kernel.</p><p><strong>5. Why Firecracker?</strong></p><p>According to Firecracker’s official documentation, it is a cloud-native alternative to QEMU, designed specifically for running containers safely and efficiently. It provides a minimal device model to the guest OS, supporting only essential functionalities, which enables extremely fast startup times and a reduced memory footprint.</p><p>Firecracker microVMs are transient and short-lived, accessible only via UART/serial console (no SSH). Each microVM supports a virtual NIC, a block device, and a single-button keyboard, ensuring a minimalistic design that enhances speed. Firecracker claims to initiate user space applications in under <strong>125 milliseconds</strong> and supports creating <strong>150 microVMs per second</strong> per host.</p><p><strong>6. REST API and Management</strong></p><p>Firecracker exposes a REST API via a UNIX socket, like Docker’s control plane API. While there is no dedicated CLI yet, you can use curl to manage microVMs through the REST endpoint.</p><p>Each microVM operates as a process within the host OS, linked to a dedicated socket and API endpoint. They also support EC2-like metadata at well-known endpoints for service discovery and key-value storage.</p><p><strong>7. Getting Started with Firecracker on AWS</strong></p><p>To get started with Firecracker on an AWS bare metal instance, follow these steps:</p><ul><li><strong>Create an i3.metal instance using Ubuntu 18.04.1.</strong></li><li><strong>Set up access to /dev/kvm</strong>:</li></ul><blockquote>sudo setfacl -m u:${USER}:rw /dev/kvm</blockquote><ul><li><strong>Download and start the Firecracker binary</strong>:</li></ul><blockquote>curl -L <a href="https://github.com/firecracker-microvm/firecracker/releases/download/v0.11.0/firecracker-v0.11.0">https://github.com/firecracker-microvm/firecracker/releases/download/v0.11.0/firecracker-v0.11.0<br></a>./firecracker-v0.11.0 — api-sock /tmp/firecracker.sock</blockquote><ul><li><strong>Query the microVM</strong>:</li></ul><blockquote>curl — unix-socket /tmp/firecracker.sock “<a href="http://localhost/machine-config">http://localhost/machine-config</a>&quot;</blockquote><ul><li><strong>Download a sample kernel and root filesystem</strong>:</li></ul><blockquote>curl -fsSL -o hello-vmlinux.bin https://s3.amazonaws.com/spec.ccfc.min/img/hello/kernel/hello-vmlinux.bin<br> curl -fsSL -o hello-rootfs.ext4 https://s3.amazonaws.com/spec.ccfc.min/img/hello/fsfiles/hello-rootfs.ext4</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/0*kIomu7AbeIIUjmuz" /></figure><ul><li><strong>Set up the guest kernel</strong>:</li></ul><blockquote>curl — unix-socket /tmp/firecracker.sock -i \<br> -X PUT ‘<a href="http://localhost/boot-source">http://localhost/boot-source</a>&#39; \<br> -H ‘Accept: application/json’ \<br> -H ‘Content-Type: application/json’ \<br> -d ‘{ “kernel_image_path”: “./hello-vmlinux.bin”, “boot_args”: “console=ttyS0 reboot=k panic=1 pci=off” }’</blockquote><ul><li><strong>Set up the root filesystem</strong>:</li></ul><blockquote>curl — unix-socket /tmp/firecracker.sock -i \<br> -X PUT ‘<a href="http://localhost/drives/rootfs">http://localhost/drives/rootfs</a>&#39; \<br> -H ‘Accept: application/json’ \<br> -H ‘Content-Type: application/json’ \<br> -d ‘{ “drive_id”: “rootfs”, “path_on_host”: “./hello-rootfs.ext4”, “is_root_device”: true, “is_read_only”: false }’</blockquote><ul><li><strong>Start the microVM</strong>:</li></ul><blockquote>curl — unix-socket /tmp/firecracker.sock -i \<br> -X PUT ‘<a href="http://localhost/actions">http://localhost/actions</a>&#39; \<br> -H ‘Accept: application/json’ \<br> -H ‘Content-Type: application/json’ \<br> -d ‘{ “action_type”: “InstanceStart” }’</blockquote><ul><li><strong>Log in to the guest machine</strong>:</li></ul><blockquote>localhost login: root<br>Password: root</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/0*uuRW29ES8w2tPjHu" /></figure><ul><li><strong>Terminate the microVM using the reboot command.</strong></li></ul><p>For scaling, you can create multiple microVMs using a simple loop:</p><blockquote>for ((i=0; i&lt;1000; i++)); do<br> ./firecracker-v0.10.1 — api-sock /tmp/firecracker-$i.sock &amp;<br>done</blockquote><p><strong>8. Key Features of AWS Firecracker</strong></p><ul><li><strong>Fast Boot Times</strong><br> MicroVMs can start in under <strong>125 milliseconds</strong>, crucial for responsive serverless architectures.</li><li><strong>Secure Isolation</strong><br> Each microVM runs in its own memory space, enhancing security and protecting against attacks.</li><li><strong>Efficient Resource Utilization</strong><br> Run thousands of microVMs on a single host, maximizing infrastructure investments.</li><li><strong>Native Support for Container Workloads</strong><br> Seamlessly integrates with orchestration tools like Kubernetes, ideal for microservices.</li></ul><p><strong>9. Use Cases for AWS Firecracker</strong></p><ul><li><strong>Serverless Computing</strong></li></ul><p><strong>AWS Lambda</strong> leverages Firecracker for rapid microVM deployment, ideal for event-driven architectures.</p><ul><li><strong>AWS Fargate</strong></li></ul><p>Firecracker powers AWS Fargate, enabling serverless container deployment without the need to manage servers.</p><ul><li><strong>Amazon EC2 Spot Instances</strong></li></ul><p>Enhances EC2 Spot Instances by allowing quick and efficient workloads, optimizing cost and performance.</p><ul><li><strong>Microservices Architectures</strong></li></ul><p>Deploy lightweight microVMs for individual services, enabling rapid scaling and isolation.</p><h3>Conclusion</h3><p>AWS Firecracker represents a significant advancement in virtualization technology, tailored for modern application demands. Its lightweight design, rapid boot times, and efficient resource utilization make it a compelling choice for organizations aiming to optimize their cloud infrastructure.</p><p><strong>Ready to innovate?</strong> Whether you are designing scalable applications or seeking to harness the power of microVMs, Firecracker offers the tools you need to excel in today’s fast-paced cloud environment.</p><p>By focusing on microVMs and their applications, AWS Firecracker is not just a tool — it is a leap into the future of virtualization. Embrace the change and optimize your infrastructure today!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a20d9d31a2d0" width="1" height="1" alt=""><hr><p><a href="https://awstip.com/exploring-aws-firecracker-the-future-of-lightweight-virtualization-a20d9d31a2d0">Exploring AWS Firecracker: The Future of Lightweight Virtualization</a> was originally published in <a href="https://awstip.com/">AWS Tip</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seamless Data Management: A Step-by-Step Guide for Setting Up AWS Storage Gateway]]></title>
            <link>https://medium.com/@vishalsaini1100/seamless-data-management-a-step-by-step-guide-for-setting-up-aws-storage-gateway-6c5c28e08d4b?source=rss-06ce3acff70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c5c28e08d4b</guid>
            <category><![CDATA[ec2-instance]]></category>
            <category><![CDATA[data-management-solution]]></category>
            <category><![CDATA[aws-storage-gateway]]></category>
            <category><![CDATA[s3-bucket]]></category>
            <category><![CDATA[file-gateway]]></category>
            <dc:creator><![CDATA[Vishal Saini]]></dc:creator>
            <pubDate>Thu, 31 Oct 2024 12:49:40 GMT</pubDate>
            <atom:updated>2024-10-31T12:49:40.969Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*TFNsn9vuoEtbv898.png" /></figure><p><strong>Introduction</strong></p><p>In today’s cloud-centric world, data storage solutions need to be both efficient and flexible. AWS Storage Gateway provides a bridge between on-premises environments and the AWS cloud, enabling seamless integration and management of data. Whether you’re looking to backup data, extend your storage capacity, or enhance disaster recovery solutions, AWS Storage Gateway offers a variety of options. This article will guide you through the process of setting up an AWS Storage Gateway.</p><p><strong>What is AWS Storage Gateway?</strong></p><p>AWS Storage Gateway is a hybrid cloud storage service that connects on-premises software applications with cloud-based storage. It supports three types of gateways</p><ol><li><strong>File Gateway</strong>: This allows you to store and retrieve objects in Amazon S3 using the NFS or SMB protocols.</li><li><strong>Volume Gateway</strong>: This provides block storage volumes that you can use with your existing applications.</li><li><strong>Tape Gateway</strong>: This offers a virtual tape library for backup and archival using existing backup software.</li></ol><p><strong>Prerequisites</strong></p><p>Before starting the setup, ensure you have:</p><ul><li>An AWS account.</li><li>Administrative access to your on-premises environment.</li><li>An understanding of the storage requirements for your applications.</li></ul><p><strong>Step-by-Step Creation Process</strong></p><p><strong>Step 1: Sign in to AWS Management Console</strong></p><ol><li>Go to the <a href="https://aws.amazon.com/console/">AWS Management Console</a>.</li><li>Sign in with your AWS account credential</li></ol><p><strong>Step 2: Open the Storage Gateway Console</strong></p><ol><li>In the AWS Management Console, navigate to the <strong>Storage Gateway</strong> service.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F_7ZN5iiLYd7JUUxYQsJZA.png" /></figure><p>2. Click on <strong>Get Started and Create Gateway</strong> to initiate the creation process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kxvs9Wxp2jNBqJotNYbn6g.png" /></figure><p><strong>Step 3: Provide gateway name and select your respective time zone.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*xBNF0iZWN4ndEZXRLCzxXQ.png" /></figure><p><strong>Step 4: Choose the Gateway Type</strong></p><ol><li><strong>Select Gateway Type</strong>: Choose the type of Storage Gateway you want to create (File, Volume or Tape).</li></ol><p><em>Note: We are creating Amazon S3 File Gateway</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*3B5DxxMt3PJ2NLViRTRbbQ.png" /></figure><p><strong>Step 5: Deploy the Gateway</strong></p><p>You have two options for deploying your Storage Gateway:</p><ul><li><strong>On-Premises</strong>: Download and install the Storage Gateway VM as an OVA file on your hypervisor (VMware or Hyper-V).</li><li><strong>AWS</strong>: Deploy the gateway as an Amazon EC2 instance.</li></ul><p><strong><em>On-Premises Deployment</em></strong></p><ol><li>Download the OVA file.</li><li>Import it into your hypervisor.</li><li>Configure the VM (e.g., network settings).</li><li>Power on the VM.</li></ol><p><strong><em>AWS Deployment</em></strong></p><ol><li>Select <strong>Amazon EC2</strong> as platform options and choose <strong>Customize your settings</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*q1lWrc4R-r28ymZ7rDgmSg.png" /></figure><p>2. Click on <strong>Launch Instance</strong> and create an instance with the mentioned specifications.</p><p>3. Review and launch the instance.</p><p>4. Checkmark the <strong>Confirm set up gateway</strong> checkbox and click <strong>next</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*t7jG2EkFzTFDomog5sn4KQ.png" /></figure><p>5. Create a VPC endpoint for storage gateway in the same network and private dns should be disabled.</p><p><strong>Step 6: Activate the Gateway</strong></p><ol><li>After the VM or EC2 instance is running, return to the Storage Gateway Console.</li><li>Select <strong>Activation Key</strong> as <strong>Gateway connection options</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*OOEcqDYXOdP6iWvQsbvrWw.jpeg" /></figure><ol><li>SSH into any EC2 instance in the same network i.e. VPC/Subnet and execute this curl command.</li></ol><blockquote><strong>curl “http://gateway_ec2_private_ip_address/?activationRegion=region_code&amp;vpcEndpoint=vpc_endpoint&amp;no_redirect&quot;</strong></blockquote><p><em>Note: replace gateway_ec2_private_ip_address, region_code &amp; vpc_endpoint with your respective values.</em></p><ol><li>Paste the Activation key and complete the activation process.</li><li>Configure local disks as cache and configure your log group.</li><li>Create storage gateway.</li></ol><p><strong>Step 7: Configure Storage</strong></p><p>Depending on the type of gateway selected, the configuration steps will vary.</p><p><strong><em>For File Gateway</em></strong></p><ol><li>Create a new S3 bucket or select an existing one.</li><li>Configure the file share settings (NFS or SMB).</li><li>Set permissions and access control.</li></ol><p><strong><em>For Volume Gateway</em></strong></p><ol><li>Create new volumes.</li><li>Define your iSCSI target settings.</li><li>Configure snapshots for backup.</li></ol><p><strong><em>For Tape Gateway</em></strong></p><ol><li>Create a virtual tape library.</li><li>Set up the desired tape retention policy.</li><li>Configure your backup software to recognize the virtual tapes.</li></ol><p><strong>Step 8: Test the Configuration</strong></p><ol><li>Ensure that you can access the gateway from your on-premises environment.</li><li>Test data transfers (uploads and downloads) to verify that the connection is working as intended.</li><li>Monitor the performance and adjust settings as needed.</li></ol><p><strong>Step 9: Implement Security and Access Controls</strong></p><ol><li>Use IAM roles and policies to manage access to your Storage Gateway.</li><li>Configure encryption settings for data at rest and in transit.</li><li>Regularly review and update your security settings.</li></ol><p><strong>Conclusion</strong></p><p>Setting up an AWS Storage Gateway can significantly enhance your data management strategy by providing seamless integration between on-premises and cloud storage. With its flexibility and scalability, you can ensure that your storage needs are met efficiently. Whether you choose a file, volume, or tape gateway, following the steps outlined in this guide will help you successfully create and configure your AWS Storage Gateway.</p><p>For further details, consider exploring the <a href="https://docs.aws.amazon.com/storagegateway/latest/userguide/what-is-storage-gateway.html">AWS Storage Gateway documentation</a> for additional features and advanced configurations. Happy cloud storing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c5c28e08d4b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PHP Application Code Coverage in Sonar Cloud/SonarQube]]></title>
            <link>https://medium.com/@vishalsaini1100/php-application-code-coverage-in-sonar-cloud-sonarqube-e355113236dd?source=rss-06ce3acff70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e355113236dd</guid>
            <category><![CDATA[code-coverage]]></category>
            <category><![CDATA[phpunit]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[sonarcloud]]></category>
            <category><![CDATA[sonarqube]]></category>
            <dc:creator><![CDATA[Vishal Saini]]></dc:creator>
            <pubDate>Thu, 11 Apr 2024 19:44:25 GMT</pubDate>
            <atom:updated>2024-10-24T10:24:43.037Z</atom:updated>
            <content:encoded><![CDATA[<h4>Prerequisite:</h4><ol><li><em>Java</em></li><li><em>Phpunit</em></li><li><em>Xdebug</em></li></ol><h4><strong>Introduction:</strong></h4><p><em>Code coverage is a crucial metric in software development that measures the percentage of code that is executed during automated tests. It provides valuable insights into the effectiveness of your testing strategy and helps identify areas of your codebase that may lack proper test coverage. In this whitepaper, we will explore the concept of code coverage in the context of PHP applications, its significance, benefits, and how to improve code coverage in your PHP projects.</em></p><h4><strong>Steps:</strong></h4><p>1. <em>Install the prerequisite packages</em></p><p>2. <em>Whitelist the tests in phpunit.xml file</em></p><pre>&lt;?xml version=&quot;1.0&quot;  encoding=&quot;UTF-8&quot; ?&gt;<br>&lt;phpunit bootstrap=&quot;bootstrap.php&quot;<br>         backupGlobals               = &quot;false&quot;<br>         backupStaticAttributes      = &quot;false&quot;<br>         colors                      = &quot;true&quot;<br>         verbose                     = &quot;true&quot;<br>         convertErrorsToExceptions   = &quot;true&quot;<br>         convertNoticesToExceptions  = &quot;true&quot;<br>         convertWarningsToExceptions = &quot;true&quot;<br>         processIsolation            = &quot;false&quot;<br>         syntaxCheck                 = &quot;false&quot;<br>         stopOnFailure               = &quot;false&quot;&gt;<br>    &lt;testsuites&gt;<br>        &lt;testsuite name=&quot;Project Test Suite&quot;&gt;<br>            &lt;directory&gt;../tests&lt;/directory&gt;<br>        &lt;/testsuite&gt;<br>    &lt;/testsuites&gt;<br>    &lt;filter&gt;<br>        &lt;whitelist addUncoveredFilesFromWhitelist=&quot;true&quot;&gt;<br>            &lt;directory suffix=&quot;.php&quot;&gt;../../../../../../../api/rest/app&lt;/directory&gt;<br>        &lt;/whitelist&gt;<br>    &lt;/filter&gt;<br> &lt;!--<br> &lt;filter&gt;<br>  &lt;blacklist&gt;<br>   &lt;directory suffix=&quot;.php&quot;&gt;../../../lib&lt;/directory&gt;<br>   &lt;directory suffix=&quot;.php&quot;&gt;.&lt;/directory&gt;<br>  &lt;/blacklist&gt;<br> &lt;/filter&gt;<br> --&gt;<br>    &lt;coverage includeUncoveredFiles     =&quot;true&quot;<br>              pathCoverage              =&quot;true&quot;<br>              ignoreDeprecatedCodeUnits =&quot;true&quot;<br>              processUncoveredFiles     =&quot;true&quot;&gt;<br>        &lt;include&gt;<br>            &lt;directory suffix=&quot;.php&quot;&gt;../../../../../../../api/rest/app&lt;/directory&gt;<br>        &lt;/include&gt;<br>  &lt;report&gt;<br>         &lt;clover outputFile=&quot;$(System.DefaultWorkingDirectory)/api/rest/app/protected/tests/coverage.xml&quot;/&gt;<br>        &lt;/report&gt;<br>    &lt;/coverage&gt;<br> &lt;logging&gt;<br>        &lt;junit outputFile=&quot;$(System.DefaultWorkingDirectory)/api/rest/app/protected/tests/tests.xml&quot;/&gt;<br>    &lt;/logging&gt;<br>&lt;/phpunit&gt;</pre><p>3. <em>Install the sonar-scanner and unzip the sonar-scanner zip wget</em> <a href="https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip">https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip</a></p><p>unzip sonar-scanner-cli-5.0.1.3006-linux.zip</p><p>4. <em>Generate the code coverage i.e., coverage.xml file</em></p><p>XDEBUG_MODE=coverage phpunit — coverage-clover coverage.xml — log-junit tests.xml</p><p>5. <em>Push the code coverage in sonar cloud/SonarQube</em></p><p><a href="http://~/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner%20-Dsonar.token=$(SONAR_TOKEN)">~/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner -Dsonar.token=$(SONAR_TOKEN)</a></p><p>6. <em>Sonar Cloud/SonarQube dashboard</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nkmZXl8EzgEZT0EguvBTNg.png" /></figure><h4><strong>Conclusion:</strong></h4><p><em>Code coverage is a valuable metric for assessing the quality and reliability of your PHP applications. By measuring code coverage, identifying areas of low coverage, and implementing strategies to improve coverage, developers can enhance software quality, reduce bugs, and build more reliable and maintainable applications. Incorporating code coverage analysis into your development workflow empowers teams to deliver high-quality software with confidence.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e355113236dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learn Everything About Amazon CloudFront]]></title>
            <link>https://medium.com/@vishalsaini1100/learn-everything-about-amazon-cloudfront-429ffb22624b?source=rss-06ce3acff70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/429ffb22624b</guid>
            <category><![CDATA[cloudfront]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Vishal Saini]]></dc:creator>
            <pubDate>Tue, 09 Apr 2024 12:35:16 GMT</pubDate>
            <atom:updated>2024-04-09T12:35:16.193Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Contents:</strong></p><ul><li><strong>CDN (Content Delivery Network)</strong></li><li><strong>What is CloudFront?</strong></li><li><strong>Amazon CloudFront Working</strong></li><li><strong>Components of AWS CloudFront</strong></li><li><strong>Benefits of CloudFront</strong></li><li><strong>Conclusion</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*5TVAJ16HJoWKrCqVtPk5GA.png" /></figure><p>Before going to CloudFront functionality, we need to understand the CDN (Content delivery network) first, as CloudFront is nothing but just a FAAS (functions as a service) platform provided by AWS, which we relate to the content delivery network (CloudFront) in AWS cloud service provider.</p><h3>CDN (Content Delivery Network)</h3><p>A CDN is a geographically distributed group of servers that are attached so that they can communicate with each other and provide fast delivery of any content such as HTML pages, images, videos, etc. The popularity of CDN services is continuously growing among organizations such as Netflix, Facebook, and Amazon as their major web traffic is served through CDN.</p><p>Now, let us take a deep understanding of how CDN works in the AWS CloudFront service.</p><p>We could think of a CDN as an ATM. Having a cash machine on every corner makes it fast, immediate access, and efficient to get money. There is no wait time in long bank lines to get our money in hand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*I35rVTAKEPStHaMBlqu8bA.png" /></figure><p>In today’s time, a substantial portion of all internet content is delivered through CDNs (Content Delivery Network). Here is a simple example:</p><p>If we were in New York and wanted to view the website of our favorite store in London that is hosted on a server in the UK, we would have experienced slow content load times because the request had to travel all the way across the Atlantic Ocean. To resolve this, a CDN would store a cached version of the London website content in multiple geographical locations around the world, also called “<strong>points of presence</strong>” (PoP). These PoPs (points of presence) contain their own caching servers and are responsible for delivering that content close to where we are located in New York.</p><p>Content delivered from a server closest to your physical location gives you a faster, high-performance web experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*yLEjD9yrwgMQxQMEYP5o8A.png" /></figure><h3>What is CloudFront?</h3><p>Amazon CloudFront is a web service that gives business and web application developers an easy and cost-effective way to distribute content with low latency and high data transfer speed.</p><h3>What does latency mean?</h3><p>What does latency mean let us understand with this given picture?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*8aek_uq7l7L_IoVGCQHd-g.png" /></figure><p>For <strong>User1</strong> the total travel period is 4s and in the other scenario, for <strong>User2</strong> the travel time is 2s so generally what we choose, we always go for the low latency(2s) time. In our day-to-day routines, we use services on the internet like Wikipedia, YouTube, or websites where we can search for images, videos, etc. backed up by CDN.</p><p>To deliver content to end users with lower latency, Amazon CloudFront uses a global network of 310+ Points of Presence (300+ Edge locations and 13 regional mid-tier caches) in 90+ cities across 47 countries</p><p><strong>Technically Amazon CloudFront works in the following manner:</strong></p><p>a) A user accesses the application or website and requests one or more objects such as an image or an HTML file.</p><p>b) DNS then routes the request to CloudFront’s Edge location, nearest to where the request is made. Nearest distance is measured in terms of latency as we already discussed what latency means.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*QQitVvPRum7E9DwKdRv7ZA.png" /></figure><p>c) In the edge location, CloudFront checks its cache for the requested files. If the files are available in the cache, CloudFront returns them to the user. If the files are not available in the cache, it does the following:</p><p>· CloudFront compares the request with the specifications in your distribution and forwards the request for the files to the applicable origin server for the corresponding file type — for example, to the Amazon S3 bucket for image files and to your HTTP server for the HTML files.</p><p>· The origin servers send the files back to the CloudFront edge location.</p><p>· CloudFront also adds the files to the cache in the edge location for the next time someone requests those files.</p><p>· As soon as the first byte arrives from the origin, CloudFront begins to forward the files to the user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*OvlBHOyVgFUnMHIkuMTYow.png" /></figure><p><strong>Major components of AWS CloudFront:</strong></p><p><strong>Distributions: -</strong>CloudFront distribution to tell CloudFront where you want the content to be delivered from, and the details about how to track and manage content delivery</p><p><strong>Origins: — </strong>An origin is the location where content is stored, and from which CloudFront gets content to serve to viewers, at least one origin should be created. We can use several diverse kinds of origins with CloudFront. For example, we can use an Amazon S3 bucket, a Media Store container, an Application Load Balancer, or an AWS Lambda function URL.</p><p><strong>WAF (Web Application Firewall): — </strong>AWS WAF is a web application security system that lets you monitor the HTTP and HTTPS requests that are forwarded to CloudFront, and lets you control access to your content.</p><h3>Benefits of CloudFront</h3><p>· CloudFront runs on the AWS global network backbone that allows for efficient transmission of requests between the CloudFront Edge locations and other AWS services, across regions and applications.</p><p>· Cache retention in CloudFront has emerged as a key contributor to performance.</p><p>· AWS edge provides a scalable, reliable, and high-performance security perimeter for your applications and content.</p><p>· Amazon CloudFront, content, APIs, or applications can be delivered over HTTPS using the latest version of <strong>Transport Layer Security</strong> (TLSv1.3) to encrypt and secure communication between viewer clients and CloudFront.</p><p>· It supports multiple origins for backend architecture redundancy.</p><h3>Conclusion:</h3><p>AWS CloudFront is a globally distributed network offered by AWS which securely delivers content to the end-users with a high transfer speed and low latency. We saw how AWS CloudFront delivers the content. It has numerous benefits and uses like serving on-demand live streaming videos, encrypting specific fields throughout system processing, and accelerating static website content delivery.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=429ffb22624b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Records Creation in Azure DNS from AKS ExternalDNS]]></title>
            <link>https://medium.com/@vishalsaini1100/records-creation-in-azure-dns-from-aks-externaldns-1a43c75050da?source=rss-06ce3acff70f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a43c75050da</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[microsoft-azure]]></category>
            <category><![CDATA[external-dns]]></category>
            <category><![CDATA[cloud-services]]></category>
            <dc:creator><![CDATA[Vishal Saini]]></dc:creator>
            <pubDate>Tue, 09 Apr 2024 09:55:01 GMT</pubDate>
            <atom:updated>2024-04-09T09:55:01.195Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/767/0*kIsjezWVG1_vTNxL" /></figure><p>Have you ever thought to create the DNS records automatically (like: A record, AAAA record and TXT record etc.) in the DNS Zones of Azure cloud from the kubernetes cluster’s yaml manifests (to be specific the External DNS) ?</p><p>NO ?</p><p>So don’t worry guys because i have done it and i thought i should share this experience with you guys. This is not limited to Azure cloud DNS Zones, It will work with AWS Route 53, Google cloud DNS, AWS cloud map and many more to mention here.</p><p>Now let me introduce you guys to the particular objects of this setup then next we will move forward to know How to setup these objects.</p><p>So let’s go………….</p><h3>Context:</h3><p>So basically the story behind writing this blog is that there were more than one pods resulting in more than one IP addresses and here the requirement takes place because manual mapping of domain names with the pod’s IP addresses is not okay.</p><h3>Particular Objects Section:</h3><p><strong>DNS Zones</strong>: A DNS zone is used to host the DNS records for a particular domain. To start hosting your domain in Azure DNS, you need to create a DNS zone for that domain name. Each DNS record for your domain is then created inside this DNS zone.</p><p>For example, the domain ‘devopstool.ml’ may contain several DNS records, such as ‘mail.devopstool.ml’ (for a mail server) and ‘www.devopstool.ml’ (for a web site).</p><p><strong>ExternalDNS</strong>: ExternalDNS synchronizes exposed Kubernetes Services and Ingresses with DNS providers. ExternalDNS makes Kubernetes resources discoverable via public DNS servers. Like KubeDNS, it retrieves a list of resources (Services, Ingresses, etc.) from the Kubernetes API to determine a desired list of DNS records. In a broader sense, ExternalDNS allows you to control DNS records dynamically via Kubernetes resources in a DNS provider-agnostic way.</p><p><strong>Managed Identity</strong>: Managed Identity adds a role for the role of contributor to the DNS-RG then we add this Managed Identity with the VMSS(virtual machine scale set) to access the DNS Zone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*YuDw03KMa7jbQgHv" /></figure><h3>Prerequisites</h3><ul><li>Azure Account</li><li>Kubernetes Cluster</li><li>Domain Name</li></ul><h3>Setup Steps</h3><p><strong>Step 1</strong>: <strong>DNS Zone Creation</strong></p><ul><li>First of all we should have the domain name for which we want to create the DNS Zone.</li><li>Then we can create the DNS Zone with the name of the domain name.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*hLIZJ2ZZJaYzqDwF" /></figure><p><strong>Step 2: Managed Identity Creation</strong></p><ul><li>Create Managed service Identity.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*bD3TgC1Ni_0oZjL-" /></figure><ul><li>After creating MSI, add azure role assignment in MSI</li><li>Open MSI</li><li>Click on <strong>Azure Role Assignment -&gt; Add role assignment1</strong></li><li>Scope: Resource group</li><li>Subscription: use your own subscription</li><li>Resource group: use concerned resource group</li><li>Role: contributor</li><li>Make a note of client id and update in azure.json</li><li>Go to <strong>Overview</strong> -&gt; Make a note of <strong>“Client ID”</strong></li><li>Update it in <strong>azure.json</strong> value for <strong>userAssignedIdentityID</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Rzg4M-OHKm9EYLgL" /></figure><p><strong>Step 3. Create azure.json file</strong></p><p>For template we can use this</p><pre>{<br>  &quot;tenantId&quot;: &quot;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&quot;,<br>  &quot;subscriptionId&quot;: &quot;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&quot;,<br>  &quot;resourceGroup&quot;: &quot;dns-zones&quot;, <br>  &quot;useManagedIdentityExtension&quot;: true,<br>  &quot;userAssignedIdentityID&quot;: &quot;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&quot;  <br>}</pre><p><strong># To get Azure Tenant ID</strong></p><pre>az account show --query &quot;tenantId&quot;</pre><p><strong># To get Azure Subscription ID</strong></p><pre>az account show --query &quot;id&quot;</pre><p><strong># Use your own resource group</strong></p><p><strong># Update userAssignedIdentityID</strong></p><p><strong>Step 4. Associate MSI in AKS cluster VMSS</strong></p><ul><li>Go to all services -&gt; VMSS -&gt; open your VMSS</li><li>Go to Settings -&gt; Identity -&gt; User assigned -&gt; Add -&gt; select your subscription -&gt; Add the MSI which we have created earlier</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*yzj5BzcGE3fcGQl9" /></figure><p><strong>Step 5. Create kubernetes secret# Create Secret</strong></p><pre>kubectl create secret generic azure-config-file --from-file=azure.json</pre><p><strong># List Secrets</strong></p><pre>kubectl get secrets</pre><p><strong>Step 6. Create external-dns.yaml manifest and deploy it.</strong></p><pre>apiVersion: v1<br>kind: ServiceAccount<br>metadata:<br>  name: external-dns<br>---<br>apiVersion: rbac.authorization.k8s.io/v1beta1<br>kind: ClusterRole<br>metadata:<br>  name: external-dns<br>rules:<br>- apiGroups: [&quot;&quot;]<br>  resources: [&quot;services&quot;,&quot;endpoints&quot;,&quot;pods&quot;]<br>  verbs: [&quot;get&quot;,&quot;watch&quot;,&quot;list&quot;]<br>- apiGroups: [&quot;extensions&quot;,&quot;networking.k8s.io&quot;]<br>  resources: [&quot;ingresses&quot;] <br>  verbs: [&quot;get&quot;,&quot;watch&quot;,&quot;list&quot;]<br>- apiGroups: [&quot;&quot;]<br>  resources: [&quot;nodes&quot;]<br>  verbs: [&quot;list&quot;]<br>---<br>apiVersion: rbac.authorization.k8s.io/v1beta1<br>kind: ClusterRoleBinding<br>metadata:<br>  name: external-dns-viewer<br>roleRef:<br>  apiGroup: rbac.authorization.k8s.io<br>  kind: ClusterRole<br>  name: external-dns<br>subjects:<br>- kind: ServiceAccount<br>  name: external-dns<br>  namespace: default<br>---<br>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: external-dns<br>spec:<br>  strategy:<br>    type: Recreate<br>  selector:<br>    matchLabels:<br>      app: external-dns<br>  template:<br>    metadata:<br>      labels:<br>        app: external-dns<br>    spec:<br>      serviceAccountName: external-dns<br>      containers:<br>      - name: external-dns<br>        image: registry.opensource.zalan.do/teapot/external-dns:latest<br>        args:<br>        - --source=service<br>        - --source=ingress<br>        #- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.<br>        - --provider=azure<br>        #- --azure-resource-group=externaldns # (optional) use the DNS zones from the specific resource group<br>        volumeMounts:<br>        - name: azure-config-file<br>          mountPath: /etc/kubernetes<br>          readOnly: true<br>      volumes:<br>      - name: azure-config-file<br>        secret:<br>          secretName: azure-config-file</pre><ul><li>In <strong>–domain-filter</strong> we used the domain name</li><li>In –azure-resource-group we used the resource group in which DNS Zone is created</li></ul><p><strong># Deploy ExternalDNS</strong></p><pre>kubectl apply -f external-dns.yml</pre><p><strong># Verify ExternalDNS Logs</strong></p><pre>kubectl logs -f $(kubectl get po | egrep -o &#39;external-dns[A-Za-z0-9-]+&#39;)</pre><p><strong># Error Type: 400</strong></p><pre>time=&quot;2020-08-24T11:25:04Z&quot; level=error <br>msg=&quot;azure.BearerAuthorizer#WithAuthorization: Failed to refresh the <br>Token for request to <a href="https://management.azure.com/subscriptions/82808767-">https://management.azure.com/subscriptions/82808767-</a><br>144c-4c66-a320-b30791668b0a/resourceGroups/dns-zones/providers/<br>Microsoft.Network/dnsZones?api-version=2018-05-01: StatusCode=400 -- Original <br>Error: adal: Refresh request failed. Status Code = &#39;400&#39;. <br>Response body: {\&quot;error\&quot;:\&quot;invalid_request\&quot;,\&quot;error_description\&quot;:\<br>&quot;Identity not found\&quot;}&quot;</pre><p><strong># Error Type: 403</strong></p><pre>Notes: Error 403 will come when our Managed Service Identity dont have <br>access to respective destination resource</pre><p><strong># When all good, we should get log as below</strong></p><pre>time=&quot;2020-08-24T11:27:59Z&quot; level=info msg=&quot;Resolving to user assigned <br>identity, client id is 404b0cc1-ba04-4933-bcea-7d002d184436.&quot;</pre><p><strong>Step 7: Deploy a demo application and test it</strong></p><p><strong>deployment.yaml:</strong></p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: app1-nginx-deployment<br>  labels:<br>    app: app1-nginx<br>spec:<br>  replicas: 1<br>  selector:<br>    matchLabels:<br>      app: app1-nginx<br>  template:<br>    metadata:<br>      labels:<br>        app: app1-nginx<br>    spec:<br>      containers:<br>        - name: app1-nginx<br>          image: stacksimplify/kube-nginxapp1:1.0.0<br>          ports:<br>            - containerPort: 80</pre><p><strong>clusterip-service.yaml</strong></p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: app1-nginx-clusterip-service<br>  labels:<br>    app: app1-nginx<br>spec:<br>  type: ClusterIP<br>  selector:<br>    app: app1-nginx<br>  ports:<br>    - port: 80<br>      targetPort: 80</pre><p><strong>ingress-with-externaldns.yaml</strong></p><pre>apiVersion: networking.k8s.io/v1beta1<br>kind: Ingress<br>metadata:<br>  name: nginxapp1-ingress-service<br>  annotations:<br>    kubernetes.io/ingress.class: &quot;nginx&quot;<br>spec:<br>  rules:<br>  - host: eapp1.devcsp.ml<br>    http:<br>      paths:<br>      - path: /<br>        backend:<br>          serviceName: app1-nginx-clusterip-service<br>          servicePort: 80</pre><ul><li>Deploy these kubernetes objects.</li><li>Wait for 3 to 5 minutes for record set update in DNS Zone.</li><li>Verify external dns pod’s logs, should look like this.</li></ul><pre>time=&quot;2020-08-24T11:30:54Z&quot; level=info msg=&quot;Updating A record <br>named &#39;eapp1&#39; to &#39;20.37.141.33&#39; for Azure DNS zone &#39;devcsp.ml&#39;.&quot;<br><br>time=&quot;2020-08-24T11:30:55Z&quot; level=info msg=&quot;Updating TXT record <br>named &#39;eapp1&#39; to &#39;\&quot;heritage=external-dns,<br>external-dns/owner=default,<br>external-dns/resource=ingress/default/nginxapp1-ingress-service\&quot;&#39; <br>for Azure DNS zone &#39;devcsp.ml&#39;.&quot;</pre><p><strong>Important Note: If external-dns pod logs are not the same as expected then check for the ingress controller, it must be available and if it is not then deploy it…….</strong></p><pre>helm repo add nginx-stable https://helm.nginx.com/stable<br>helm repo update<br>helm install ingress-nginx nginx-stable/nginx-ingress<br>helm install ingress-nginx nginx-stable/nginx-ingress --set <br>rbac.create=true</pre><ul><li>Now verify the external-dns pod logs it will be the same as expected</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*VBcHaD1fa999Fkav" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*FQw7HIvRxcbdjOPX" /></figure><p>Hurraaaah 😎</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/0*8-kJtgDIYq-U3Xuo" /></figure><p>THANK ME LATER……….</p><h3>Conclusion:</h3><p>Time to conclude the blog:&gt;&gt; I wrote this blog because There was a requirement of this kind of setup and i couldn’t find the expected results on web so it took more than enough time to make it happen so i thought there should be a proper documentation/blog for this setup.</p><p>References — <a href="https://blog.opstree.com/wp-content/uploads/2022/01/2af3b-0awkga9zlgxfxwklv.gif"><strong>GIF </strong></a>, <a href="https://www.incredibuild.com/wp-content/uploads/2021/07/kubernetes_CI_logo_heptagon_blue.jpg"><strong>Image 1 </strong></a>,<strong> </strong><a href="https://blog.opstree.com/wp-content/uploads/2022/01/2af3b-0awkga9zlgxfxwklv.gif"><strong>Image 2</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a43c75050da" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>