<?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"><channel><title><![CDATA[Abishek Gautam | Cloud & DevOps]]></title><description><![CDATA[Expect practical insights, step-by-step guides, and real-world solutions for AWS Cloud, DevOps, automation, and infrastructure.]]></description><link>https://blog.abishekgautam.com.np</link><generator>RSS for Node</generator><lastBuildDate>Thu, 08 Oct 2026 10:44:53 GMT</lastBuildDate><atom:link href="https://blog.abishekgautam.com.np/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[AWS Client VPN with Mutual Authentication: A Complete Guide to Securely Access Private Resources]]></title><description><![CDATA[Introduction
Securely accessing cloud resources is a common challenge for many IT professionals. AWS Client VPN is a managed client-based VPN service that enables us to securely access our AWS resourc]]></description><link>https://blog.abishekgautam.com.np/aws-client-vpn</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/aws-client-vpn</guid><category><![CDATA[aws client vpn ]]></category><category><![CDATA[privateconnection]]></category><category><![CDATA[vpn]]></category><category><![CDATA[networking]]></category><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Mon, 17 Aug 2026 09:30:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/82a3be71-ad12-4f51-b3f2-5f8d67491fb1.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>Introduction</h3>
<p>Securely accessing cloud resources is a common challenge for many IT professionals. <strong>AWS Client VPN</strong> is a managed client-based VPN service that enables us to securely access our AWS resources and resources in our on-premises network. With Client VPN, we can access our resources from any location using an OpenVPN-based VPN client.</p>
<h3>Architecture</h3>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/e3d45cfe-f4bf-4e0a-810d-ead569c8e463.jpg" alt="" style="display:block;margin:0 auto" />

<p><em>Architecture Diagram: Client VPN Connection</em></p>
<h3>Procedure</h3>
<p><strong>Prerequisites</strong></p>
<p>Before we begin, we need to have the following:</p>
<ul>
<li><p>The permissions required to work with Client VPN endpoints.<br />Generate an appropriate IAM Role or if you have Administrator Access role that is sufficient.</p>
</li>
<li><p>The permissions required to import certificates into AWS Certificate Manager.<br />We will be using AWS CLI, Consequently Access key and Secret key are required.</p>
</li>
<li><p>A VPC with at least one subnet and an internet gateway. The route table that's associated with our subnet must have a route to the internet gateway.</p>
</li>
</ul>
<p><strong>Step 1: Choose your endpoint type</strong></p>
<p>AWS Client VPN supports two endpoint types:</p>
<ul>
<li><p><strong>VPC subnet association</strong> for single-VPC access, and</p>
</li>
<li><p><strong>Transit Gateway association</strong> for multi-VPC and hybrid network scenarios.<br />In this Blog we will configure using VPC-associated endpoints.</p>
</li>
</ul>
<p><strong>Step 2: Generate server and client certificates and keys</strong></p>
<p>We will setup <strong>EasyRSA</strong> for generating the certificates and use mutual authentication, where Client VPN uses certificates to perform authentication between clients and the Client VPN endpoint.</p>
<p><strong>Install the EasyRSA,</strong> from the link below.</p>
<p><a href="https://github.com/OpenVPN/easy-rsa/releases">https://github.com/OpenVPN/easy-rsa/releases</a></p>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/c9eba42d-373e-4028-8be1-eb2e879264cb.png" alt="" style="display:block;margin:0 auto" />

<p>Download the ZIP file appropriate for your operating system, extract it, navigate to the extracted directory, and open the <mark class="bg-yellow-200 dark:bg-yellow-500/30">easyrsa.bat</mark> file. These Easy-RSA commands initialize the <strong>Public Key Infrastructure (PKI)</strong>, create a <strong>Certificate Authority (CA)</strong>, and generate the <strong>server and client certificates</strong> required for mutual TLS authentication.</p>
<pre><code class="language-plaintext">#easyrsa.bat

# Easy RSA Configuration
	 ./easyrsa init-pki
	 ./easyrsa build-ca nopass
	 ./easyrsa build-server-full server.domain.tld nopass
	 ./easyrsa build-client-full client1.domain.tld nopass
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/c9432bfd-98f3-4dbe-839d-7ee53d922221.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/8d759cfe-1a67-41ea-8eec-b237e5858e1c.png" alt="" style="display:block;margin:0 auto" />

<p>Now, For ease, what we do is create an new folder and copy the certificates and key into that folder and upload those certificates to the AWS ACM.</p>
<p>Open a PowerShell new terminal and go into that EasyRSA directory where we previously ran commands and copy the certificates and key into a <mark class="bg-yellow-200 dark:bg-yellow-500/30">VPNDemo</mark> Directory.</p>
<pre><code class="language-plaintext">#POWERSHELL

cd C:\Users\Acer\Downloads\EasyRSA-3.2.6-win64\EasyRSA-3.2.6
mkdir ~/VPNDemo
cp .\pki\ca.crt ~/VPNDemo/
cp .\pki\issued\server.domain.tld.crt ~/VPNDemo/
cp .\pki\private\server.domain.tld.key ~/VPNDemo/
cp .\pki\issued\client1.domain.tld.crt ~/VPNDemo/
cp .\pki\private\client1.domain.tld.key ~/VPNDemo/
cd C:\Users\Acer\VPNDemo\
</code></pre>
<p>After Creating client, server keys and certificates along with ca.crt. We will copy it into the new directory VPNDemo and from here we shall import Client and Server Certificates to the AWS ACM.</p>
<p><em><mark class="bg-yellow-200 dark:bg-yellow-500/30">NOTE: Before importing, Please run aws configure and Enter your Access key and Secret key.</mark></em></p>
<pre><code class="language-plaintext"># Import server certificate to aws acm

aws acm import-certificate --certificate fileb://server.domain.tld.crt \     
--private-key fileb://server.domain.tld.key \
--certificate-chain fileb://ca.crt \
--region us-east-2
</code></pre>
<pre><code class="language-plaintext"># Import Client certificate to aws acm

aws acm import-certificate --certificate
fileb://client1.domain.tld.crt \
--private-key fileb://client1.domain.tld.key \
--certificate-chain fileb://ca.crt \
--region us-east-2
</code></pre>
<ul>
<li>Go to the AWS Management Console, Search for ACM and you shall see the Certificates there.</li>
</ul>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/28e3f6b5-4413-49f4-918c-c54c1a7dbfbe.png" alt="" style="display:block;margin:0 auto" />

<p><strong>Step 3: Create a Client VPN endpoint</strong></p>
<p>Before we create a Client VPN endpoint, We need to have a VPC with Private Subnet and we shall associate the endpoint to that private subnet.</p>
<p>Here, I have created a VPC named <mark class="bg-yellow-200 dark:bg-yellow-500/30">"demo-vpc"</mark>. For this blog I shall not cover creating VPC, You can easily create one.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/8d320523-bf6c-43f1-9836-2d1497072f13.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/50e1dec3-4c9a-49a8-9bad-f9042fd6c89e.png" alt="" style="display:block;margin:0 auto" />

<ul>
<li>For creating Client VPN Endpoint, In the AWS Console, go to <strong>VPC and click on Create Client VPN Endpoint</strong>.</li>
</ul>
<p>we can set the VPN endpoint Name and Description (both are optional). we will select the "demo-vpc" and the default security group.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/3c5769b2-d485-4ef0-ae06-02ae8d64ab3a.png" alt="" style="display:block;margin:0 auto" />

<p>we need to specify the Client VPN CIDR range between /12 and /22 and can't overlap with the target network, VPC address range or routes.</p>
<p>for now, we'll use <strong><mark class="bg-yellow-200 dark:bg-yellow-500/30">10.0.0.0/12</mark></strong></p>
<p><strong>under Authentication:</strong></p>
<ul>
<li><p>Select the <strong>Server certificate ARN</strong> from drop down that we have previously imported.</p>
</li>
<li><p>use mutual authentication for <strong>Authentication options</strong>.</p>
</li>
<li><p>Similarly, Select the <strong>Client certificate ARN</strong> from drop down that we have previously imported.</p>
</li>
</ul>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/6f72991a-7622-407e-b868-9eb9fe353501.png" alt="" style="display:block;margin:0 auto" />

<ul>
<li><p>Enable <strong>Self-service</strong> Portal, under Client Interface</p>
</li>
<li><p>Select <strong>split-tunnel</strong>, From the Connection protocol</p>
</li>
</ul>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/e3a6d278-3ada-4813-8f4b-d7e2a23e33c5.png" alt="" style="display:block;margin:0 auto" />

<p><strong>Step 4: Associate a target network</strong></p>
<p>It’s important to note that once created, the endpoint will remain in the pending-associate state until a target network association is added. This means you’ll need to associate the endpoint with at least one subnet in your VPC before it becomes operational.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/9b2306ff-8ab1-4531-ab90-f966ae60e7a4.png" alt="" style="display:block;margin:0 auto" />

<p><strong>Step 5: Add an authorization rule for the VPC</strong></p>
<p>By default, nothing is accessible. we must explicitly allow access.</p>
<p>Authorization rules define what resources out VPN users can access. we can find this under the ‘Authorization Rules’ tab in our Client VPN endpoint settings.</p>
<p>Navigate to Authorization Rules. Add a rule that permits traffic to our VPC CIDR range (e.g., 192.168.0.0/16) and not our Client VPN CIDR range.</p>
<p><strong>Step 6: Configure Route Table</strong></p>
<p>The route table configuration determines where our VPN traffic should be directed.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/79451fdf-a89d-4413-8087-62d9357723d2.png" alt="" style="display:block;margin:0 auto" />

<p><strong>Step 7: Verify security group requirements</strong></p>
<p>Make sure your resources’ security groups allow inbound traffic from the Client VPN CIDR block.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/ffa963c5-5496-40ec-9686-24f63442e3d3.png" alt="" style="display:block;margin:0 auto" />

<p>For example:</p>
<ul>
<li><p>Allow RDP (3389) for Windows instances.</p>
</li>
<li><p>Allow SSH (22) for Linux instances.</p>
</li>
<li><p>Allow ICMP if you want to test with ping.</p>
</li>
</ul>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/ffa963c5-5496-40ec-9686-24f63442e3d3.png" alt="" style="display:block;margin:0 auto" />

<p><strong>Step 8: Download the Client VPN endpoint configuration file and Configure it.</strong></p>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/cb9b6df4-5c78-4989-b142-d5e05e00d314.png" alt="" style="display:block;margin:0 auto" />

<p>When all settings are configured and Client VPN state is available, download the client configuration file from the top of the dashboard by clicking on <strong>Download client configuration.</strong></p>
<p>Before we use this configuration file, we need to modify it and add the certificate and key of the client.</p>
<p>Open the <mark class="bg-yellow-200 dark:bg-yellow-500/30">.ovpn</mark> file in a text editor and add the following blocks at the end, replacing the placeholders with the actual certificate and key content form your client cert and key file.</p>
<pre><code class="language-plaintext">    &lt;cert&gt;
    -----BEGIN CERTIFICATE-----
    [Your client certificate content]
    -----END CERTIFICATE-----
    &lt;/cert&gt;

    &lt;key&gt;
    -----BEGIN PRIVATE KEY-----
    [Your client private key content]
    -----END PRIVATE KEY-----
    &lt;/key&gt;
</code></pre>
<p><strong>Step 9: Connect to the Client VPN endpoint</strong></p>
<p>To connect using the AWS provided client for Windows x64-based or Windows Arm64-based systems:</p>
<p>if you have downloaded yet please download from client VPN Endpoints.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/49a241ab-ce6d-4f34-b61b-6395518a90a8.png" alt="" style="display:block;margin:0 auto" />

<ul>
<li><p>Open the AWS VPN Client app.</p>
</li>
<li><p>Choose File, Manage Profiles.</p>
</li>
<li><p>Choose Add Profile.</p>
</li>
<li><p>For Display Name, enter a name for the profile.</p>
</li>
</ul>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/724f5360-119d-40ca-b660-e43af82a46d4.png" alt="" style="display:block;margin:0 auto" />

<ul>
<li>For VPN Configuration File, browse to and then select the configuration file that you received from your Client VPN administrator, and choose Add Profile.</li>
</ul>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/ee7d8173-bf00-4041-80e3-389af5b6c09e.png" alt="" style="display:block;margin:0 auto" />

<p>I have created an AWS EC2 instance on Private Subnet which has private IP <strong>192.168.128.81</strong> and with security group with ICMP and SSH Protocol allowed.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/e5e44539-c6de-49dc-bcc2-bd1c83f927c8.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/5cfdcbe0-6e3c-4c53-8202-74c05bc8c6e2.png" alt="" style="display:block;margin:0 auto" />

<p>The instance is reachable from the VPN client and can also access the internet, which is enabled by the <strong>split-tunnel configuration</strong> that we have implemented.</p>
<p>Once connected, We can also see the Connection that had been created on the Client VPN Endpoint, under the connections tab.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6459e94af9c6f511b4f65264/6a07abbd-4099-4349-97d3-decd4231d7d4.png" alt="" style="display:block;margin:0 auto" />

<p><strong>Congratulations!!</strong></p>
<p>This confirms that the VPN connection has been successfully established and that the instance in the private subnet is reachable. You can now securely connect to the server via SSH using the instance’s private IP address.</p>
<pre><code class="language-plaintext">chmod 400 &lt;path-to/keyfile.pem&gt;
ssh -i &lt;path-to/keyfile.pem&gt; &lt;userName&gt;@&lt;privateIP&gt;
</code></pre>
<p>The chmod 400 command ensures that the private key has the required permissions. The SSH username depends on the operating system/AMI used by the EC2 instance for example, ec2-user for Amazon Linux, ubuntu for Ubuntu, and admin for some Debian-based images. Replace with the appropriate username for your instance.</p>
<h3>Benefits</h3>
<ul>
<li><p><strong>Security</strong> : Implements enterprise-grade security with certificate-based authentication</p>
</li>
<li><p><strong>Flexibility</strong> : Connects AWS and on-premises resources</p>
</li>
<li><p><strong>Scalability</strong> : Automatically scales based on you needs</p>
</li>
<li><p><strong>Managed Service</strong> : AWS handles the infrastructure, We just focus on the configuration</p>
</li>
</ul>
<p><strong><mark class="bg-yellow-200 dark:bg-yellow-500/30">NOTE:</mark></strong></p>
<p><em>If you ever change settings like enabling split-tunnel or adding new routes, Please make sure to re-download the client config file and reconnect otherwise, your local profile might not reflect the new routing.</em></p>
<h3>Conclusion</h3>
<p>AWS Client VPN with mutual authentication provides a secure, controlled, and scalable way to access private resources without exposing them to the public internet. With the right configuration, secure remote access becomes simple, reliable, and production-ready.</p>
]]></content:encoded></item><item><title><![CDATA[On-premise Server Migration to AWS using AWS Application Migration Service (MGN)]]></title><description><![CDATA[Introduction:
Migrating physical or virtual machines from on-premises to AWS can feel scary but AWS Application Migration Service (MGN) makes it straightforward by continuously replicating servers to AWS and enabling test launches and cutovers with m...]]></description><link>https://blog.abishekgautam.com.np/on-prem-server-to-aws-mgn</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/on-prem-server-to-aws-mgn</guid><category><![CDATA[#onprem-to-aws]]></category><category><![CDATA[migration]]></category><category><![CDATA[#mgn]]></category><category><![CDATA[AWS]]></category><category><![CDATA[windows server]]></category><category><![CDATA[Application migration services,]]></category><category><![CDATA[Cloud Computing]]></category><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Mon, 01 Dec 2025 10:22:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1764583898486/2f726b2f-76b3-4423-a0d3-5f0676c32c3a.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-introduction">Introduction:</h1>
<p>Migrating physical or virtual machines from on-premises to AWS can feel scary but <mark>AWS Application Migration Service (MGN)</mark> makes it straightforward by continuously replicating servers to AWS and enabling test launches and cutovers with minimal downtime. Let’s start from planning to post-cutover validation.</p>
<h1 id="heading-architecture-diagram">Architecture Diagram</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764503321822/c50fac73-3b4c-4c5e-8526-94426a09df77.jpeg" alt class="image--center mx-auto" /></p>
<h1 id="heading-procedure">Procedure:</h1>
<h3 id="heading-step-1-configure-replication-in-aws-mgn">Step 1: Configure replication in AWS MGN</h3>
<ul>
<li><p>Open the <strong>AWS Application Migration Service</strong> console.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764044091757/fce9445a-202f-4b2c-8db1-c3ec511e52c6.png" alt /></p>
</li>
</ul>
<p>Confirm <strong>Replication settings</strong>:</p>
<ul>
<li><p>Under settings select the <strong>Replication template</strong> and click on edit.</p>
</li>
<li><p>Select the <strong>subnet</strong> for replication instance and <strong>instance type</strong> based on your requirement.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764044230871/ec18099c-79b2-4194-98a3-1dc40c349770.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Choose EBS volume type and Encryption method.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764044382172/c6cc1c17-103b-4505-8314-9247aef4b7d2.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Save the template</p>
</li>
</ul>
<p>Now, Select the <strong><mark>Lunch template</mark></strong> under <mark>Settings</mark>.</p>
<ul>
<li>Edit the template</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764044540085/8e953115-eb11-41be-983e-255be6efba6c.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Choose the EBS volume type, <strong>security group</strong> and <strong>EBS volume type</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764044578176/72123f28-d849-4369-bc0f-c37341881c8e.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Save the template.</li>
</ul>
<p>Under <mark>Post-launch template</mark></p>
<ul>
<li><p>Select the install the system manager agent and allow exectuting actions on launch servers.</p>
</li>
<li><p>Also, choose the <strong>Deployment option</strong> for agent to be installed on.</p>
</li>
<li><p>save the template.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764044700533/70b18061-3b26-46ec-ac38-8f26b8648364.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-step-2-agent-installation">Step 2: Agent installation</h3>
<p>The agent registers the server to your MGN service and starts sending block-level data to replication servers in your AWS account .</p>
<p>Now, Select the <strong>Source servers</strong> and click on <strong>Add server.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764044865185/4486718f-4849-4bc0-9ba9-19ef0b25b1bc.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Select the Operating system, replication preferences and</p>
</li>
<li><p>Provide the <strong>AWS Access key ID</strong> and <strong>Secret Access Key</strong>, you can generate form <strong>IAM</strong> if you haven’t generated it yet.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764045417597/1c53ef9b-0625-4de6-bcf0-764056af5826.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Copy the Installer link and paste on the browser of your physical machine, it will download an installer file.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764046940785/e9eb82c4-2d06-48fd-bc67-9fa50025195e.png" alt class="image--center mx-auto" /></p>
<p><mark>Note: </mark> remember you need to download the <strong><mark>exe file not .sha512</mark></strong></p>
<ul>
<li>Copy the Command below the installer download link and paste on the same directory where your installer is downloaded.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764584877686/bc9f89e8-3909-44bc-b8dd-6471be3050bc.png" alt class="image--center mx-auto" /></p>
<ul>
<li>In the MGN Console you should see the source server appear (with a discovered source ID).</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764057118039/22be1256-98be-48ee-9a2b-0d3b73bc8509.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Wait for the lifecycle to complete</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764057164526/d10fd593-7ba6-4391-8f91-3ea4e0edd690.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Wait until replication progress is 100%.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764057195464/058ad582-a49f-452a-b4ac-b18c898688a2.png" alt class="image--center mx-auto" /></p>
<ul>
<li>We can see the specification of physical machine on the server info</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764062468647/33e9b065-e20c-4e70-9e81-22fca5fe7d3a.png" alt class="image--center mx-auto" /></p>
<ul>
<li>After successful replication, the <mark>Lifecycle </mark> moves to <strong>Ready for testing stage</strong>.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764142453696/81660e3e-37ed-49de-94d7-ed7d9c1451e8.png" alt class="image--center mx-auto" /></p>
<ul>
<li>The new ec2 server creation for AWS Migration Service Replication Server is visible.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764142515054/df211745-817f-46fb-8601-70dd25a4350c.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-step-3-verifying-the-templates">Step 3: Verifying the Templates</h3>
<p>On the AWS Application and Migration Serve on source server</p>
<ul>
<li>Go to the <mark>launch settings</mark> and <strong>modify EC2 launch Template</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764142636011/b53cac2f-bd97-4459-adb4-5f87644923e1.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>It will redirect to the <strong>EC2 launch template</strong></p>
</li>
<li><p>Under Key Pair <mark>select or create</mark> a <strong>new key pair</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764142812954/bee8837b-1226-4f40-85de-381fc83bed58.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Under <strong>Advanced network configuration</strong> <strong>Enable</strong> <mark>Auto-assign public IP</mark></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764142852195/dc3efc94-80a3-4aca-88a5-afa8c090dbbd.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Select the <strong>template</strong> and choose <strong>Set default version</strong> from the <strong>Action</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764143075261/9276bdd3-770f-4efd-a13b-b090d6a33d53.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Choose the recent version</p>
</li>
<li><p>It’s now visible that default version is changed to 3 from 2.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764143203838/6b78e93c-836a-4151-871c-77c50a91f9ba.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-step-4-launch-the-testing-instance">Step 4: Launch the Testing Instance</h3>
<p>On the Migration Dashboard</p>
<ul>
<li>Select <mark>Test and cutover</mark> and as Lifecycle is <strong>Ready for testing, Lunch test instances.</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764143880394/3a9fb84a-37de-47cb-8fc1-1a0feb1af1f1.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Lunch the test instance</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764143997102/3f34f7ca-606d-406a-bac7-23c2a55ed1c0.png" alt class="image--center mx-auto" /></p>
<ul>
<li>View the events on the launch history on the left sidebar, wait until it’s completed.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764144064935/577d9acd-2c28-4e90-830d-68cfc62917fc.png" alt class="image--center mx-auto" /></p>
<ul>
<li>The <strong>job logs</strong> and <strong>Lifecycle</strong> for an update.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764144391983/5d02d273-eb5d-43f8-a64e-40109ffc2c98.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764150161672/c8617c64-88e5-4922-9a9c-35213da140a7.png" alt class="image--center mx-auto" /></p>
<ul>
<li>As the test instance is launched, now open the RDP port of the instance and you can connect it through the RPD</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764149721051/ba51aa32-b038-4c8f-a935-a80cf43d96bf.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Select the test instance and under <strong>Security</strong></p>
</li>
<li><p>Click on <strong>security group,</strong> <strong>edit it</strong> and</p>
</li>
<li><p>Add the <strong>RDP port</strong>.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764149698794/aac2bee3-9def-4d81-8481-a3c45037dcae.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Select the instance and click on connect</p>
</li>
<li><p>Only copy the <strong>public DNS</strong> and use the <mark>username and password</mark> of the <mark>On-prem server.</mark></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764149919306/5fc9e4ff-8f6f-46e1-ae53-6de15ef7e3bf.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764150032883/03950ca9-9ebc-4e15-994a-62a417e8ec17.png" alt class="image--center mx-auto" /></p>
<ul>
<li>All the files of on-premises on the ec2 test-instance is replicated, if everything is Perfect, we will start the final cutover.</li>
</ul>
<h3 id="heading-step-5-lunch-final-cutover-instance">Step 5: Lunch Final Cutover Instance.</h3>
<ul>
<li>Go back to <strong>AWS Application Migration</strong> server and mark ready for cutover.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764150207083/172ab240-275f-497a-8445-fa5ac7f401bf.png" alt class="image--center mx-auto" /></p>
<ul>
<li>If you find something unusual or all your data was not migrated, you can Revert to <mark>“Ready for testing“</mark> and ensure sync completed before <mark>“Lunch Test Instances”</mark>.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764150448425/edef511e-2cfa-4cef-b4f1-e5abca36a225.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>You can see that when you changed to Ready for cutover the Test-Instance is automatically deleted.</p>
<p>  Now for Cutover,</p>
</li>
</ul>
<ol>
<li><p><strong>Schedule downtime</strong> or maintenance window for the application (short maintenance window reduces final delta).</p>
</li>
<li><p>In MGN Console, <strong>Perform Cutover</strong> for selected servers:</p>
<ul>
<li><p>MGN will perform a final sync (brief pause for consistent state).</p>
</li>
<li><p>Launch the target EC2 instance(s) in AWS.</p>
</li>
</ul>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764150341813/d976880d-bc89-4abc-a3e3-ada72e0c3fc6.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>As the Lifecycle moves to the <mark>Ready for cutover</mark>,</p>
</li>
<li><p>From the <strong>Test and cutover</strong> option, click on <mark>“Lunch cutover instance”</mark></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764150518798/10d1a99e-abf3-4064-90cd-8a54d3c60435.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Wait until the cutover is completed. Meanwhile you can see the Jobs and logs from lunch history</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764150802757/45f2b6ae-b452-4fb8-97a5-4e768ac0f1a8.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Job logs.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764150828170/271d7701-8758-4a44-8ca8-dd18360f5726.png" alt class="image--center mx-auto" /></p>
<ul>
<li>After the Cutover is completed, as we can see on the Lunch history.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764152659925/4ab92da1-eab9-4f90-af3e-6f80e526475e.png" alt class="image--center mx-auto" /></p>
<ul>
<li>We can see that the <mark>Final instance</mark> has been created on the <strong>EC2 Instances</strong>.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764152714069/aab75024-f826-4f5c-8c51-afae0fff1e7c.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Now, we need to finalize the cutover after testing the Instance so that we can shutdown the source and Replication server.</p>
</li>
<li><p>Click on the <mark>Finalize cutover</mark> from the “<strong>Test and Cutover”</strong> Option.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764152838188/60d878fe-8db6-4755-b935-4edb3cb8703a.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Lifecycle transition from the <strong>Cutover in profess</strong> to <strong>Cutover complete</strong> after Finalize.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764153031931/7d0594d7-59f5-4971-aea5-13a6927fe82a.png" alt class="image--center mx-auto" /></p>
<ul>
<li>After everything is completed next step is <mark>mark as archived</mark> the <strong>source server</strong> as it is already disconnected from the service when we finalize the cutover.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764153109141/c66566c5-6f23-4994-ae63-3a5a13f62a53.png" alt class="image--center mx-auto" /></p>
<ul>
<li>we can see that only one instance is running tha is our <strong>final Cutover Production server</strong> migrated from the on-premises. Let’s connect it through the RDP</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764153209326/5230841c-52a2-4586-9bbc-6c5d54bb7195.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Copy the <mark>public-dns</mark> of the server and use the on-premises username and Password.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764153337280/6955f839-990a-4dbf-a58f-077d0c590a65.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764153444841/7ca1c640-4f40-4bf9-8414-2596f942cf93.png" alt class="image--center mx-auto" /></p>
<p>we have migrated the On-premise server to the AWS using AWS Application Migration Service (MGN).</p>
<h2 id="heading-final-tips-and-best-practices">Final tips and best practices</h2>
<ul>
<li><p><strong>Start small</strong>: do with a noncritical server to learn the process.</p>
</li>
<li><p><strong>Document everything</strong>: replication settings, custom drivers, any changes to server configurations.</p>
</li>
</ul>
<h1 id="heading-conclusion">Conclusion</h1>
<p>AWS Application Migration Service (MGN) simplifies moving on-prem servers to AWS by providing continuous block-level replication, safe test launches, and an easy cutover path. With good planning and careful testing, we can migrate mission-critical workloads with minimal downtime with predictable results.</p>
]]></content:encoded></item><item><title><![CDATA[On-Premise MySQL Migration to Amazon RDS (MySQL) using AWS DMS]]></title><description><![CDATA[Migrating your on-premises MySQL database to Amazon RDS for MySQL with AWS Database Migration Service (DMS) is a common way to move to a managed, highly available database while keeping zero downtime or minimal. In this blog, I’ll show how you can mi...]]></description><link>https://blog.abishekgautam.com.np/on-prem-mysql-migration-to-amazon-rds</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/on-prem-mysql-migration-to-amazon-rds</guid><category><![CDATA[AWS]]></category><category><![CDATA[rds]]></category><category><![CDATA[rds instance]]></category><category><![CDATA[#dms]]></category><category><![CDATA[aws dms]]></category><category><![CDATA[#aws #awsdms #awsmigration]]></category><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Tue, 14 Oct 2025 06:06:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1760422547329/1c700a30-ab41-4066-8186-7d01c488c0db.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Migrating your on-premises MySQL database to <strong>Amazon RDS for MySQL</strong> with <strong>AWS Database Migration Service (DMS)</strong> is a common way to move to a managed, highly available database while keeping zero downtime or minimal. In this blog, I’ll show how you can migrate your databases to the AWS Managed Database.</p>
<h2 id="heading-architecture"><strong>Architecture:</strong></h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758025218331/b70c0c41-afcb-448f-9154-7420a872f62b.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-assumptions-amp-prerequisites">Assumptions &amp; prerequisites</h2>
<ol>
<li><p>Network connectivity between AWS and on-prem (VPN / Public IP available).</p>
</li>
<li><p>Administrative access to source MySQL and to the AWS account (permissions to create RDS, DMS, IAM, roles, subnets, and security groups).</p>
</li>
</ol>
<h3 id="heading-step-by-step-migration-procedure"><strong>Step-by-step migration procedure:</strong></h3>
<h3 id="heading-step-1-assess-amp-plan">Step 1: Assess &amp; plan</h3>
<p>Decide migration type: <strong>Full load + ongoing replication (CDC)</strong> is recommended for production to reduce downtime.</p>
<ul>
<li>Configure MySQL for DMS (Binary Logs + Remote Access)</li>
</ul>
<p>Edit the MySQL configuration file <strong>(/etc/mysql/mysql.conf.d/mysqld.cnf</strong> on Ubuntu/Debian, or <strong>/etc/my.cnf</strong> on RHEL/CentOS/Amazon Linux).</p>
<pre><code class="lang-plaintext">bind-address = 0.0.0.0 
# AWS DMS timeout configuration
net_read_timeout=300
net_write_timeout=300
wait_timeout=300
</code></pre>
<p>Save and restart MySQL:</p>
<pre><code class="lang-bash"> sudo systemctl restart mysql
</code></pre>
<h3 id="heading-step-2-create-a-dedicated-dms-user-and-grant-privileges">Step 2: Create a dedicated DMS user and grant privileges</h3>
<pre><code class="lang-bash">CREATE USER <span class="hljs-string">'dms_user'</span>@<span class="hljs-string">'%'</span> IDENTIFIED BY <span class="hljs-string">'StrongPassword!'</span>;
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO <span class="hljs-string">'dms_user'</span>@<span class="hljs-string">'%'</span>;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, INDEX ON `abi_db`.* TO <span class="hljs-string">'dms_user'</span>@<span class="hljs-string">'%'</span>;
GRANT ALL PRIVILEGES ON awsdms_control.* TO <span class="hljs-string">'dms_user'</span>@<span class="hljs-string">'%'</span>;
FLUSH PRIVILEGES;
</code></pre>
<h3 id="heading-step-3-create-iam-roles-for-aws-dms">Step 3: Create IAM Roles for AWS DMS</h3>
<p>Create the following roles in IAM → Roles → Create role → AWS Service → DMS and attach the matching AWS managed policies:</p>
<ul>
<li><p><strong>dms-cloudwatch-logs-role</strong> → attach AmazonDMSCloudWatchLogsRole</p>
</li>
<li><p><strong>dms-vpc-role</strong> → attach AmazonDMSVPCManagementRole</p>
</li>
<li><p><strong>DMSS3AccessRole-maxdms-migration-bucket</strong> → attach AmazonS3FullAccess (or custom bucket policy for least privilege)</p>
</li>
</ul>
<p><strong>NOTE:</strong> All roles must trust dms.amazonaws.com</p>
<h3 id="heading-step-4-create-the-target-amazon-rds-for-mysql">Step 4: Create the target: Amazon RDS for MySQL</h3>
<ul>
<li><p>In the AWS Console → RDS → Create database. Choose <strong>MySQL</strong>, pick engine version compatible with your application</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760418245607/738129b8-8b1b-4d39-984d-6c1ec4c9c63c.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Choose instance class, storage, Multi-AZ (recommended for production), and set backups &amp; maintenance.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760418357074/f974e9d7-a816-43a0-b9ad-2ab2da471756.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Create or use a DB subnet group inside the VPC where your DMS replication instance will run.</p>
</li>
<li><p>Note the RDS endpoint, username, and password — you’ll use these for the DMS target endpoint.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760418703362/c12ac378-9020-42c0-bf28-5361193d2fe1.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419033571/241d30c9-61f8-4d66-b0c4-e77a6d319b36.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419058900/7f7c8aea-ba7d-481f-99ad-b1ea67589612.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419083372/8efae5f3-e741-4f46-89df-335a83611f07.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419105179/b5acc5c2-9a5d-4e23-8e2c-be8615996427.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419137369/19cf6175-dcc1-4bde-ac38-df42de3c72cf.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-step-5-networking-ensure-connectivity">Step 5: Networking: ensure connectivity</h3>
<p>Decide how DMS will reach on-prem:</p>
<ul>
<li><p><strong>Recommended (secure):</strong> AWS VPN / Direct Connect.</p>
</li>
<li><p><strong>Alternative:</strong> Open source MySQL port from DMS replication instance public IP range (less secure).<br />  Make sure:</p>
</li>
<li><p>Security groups for RDS allow inbound from the replication instance.</p>
</li>
<li><p>On-prem firewall allows inbound from replication instance or through your VPN.</p>
</li>
<li><p>If using public endpoints, consider enabling SSL for MySQL connections</p>
</li>
</ul>
<h3 id="heading-step-6-create-an-aws-dms-replication-instance">Step 6: Create an AWS DMS replication instance</h3>
<ul>
<li><p>Search for <mark>AWS DMS</mark> in the management console, select <mark>Replication instances</mark> and click on <mark>Create replication instance</mark>.</p>
</li>
<li><p>Choose instance class and storage. For large databases or heavy throughput pick a larger instance.</p>
</li>
<li><p>Place the instance in the same <strong>VPC</strong> and subnets that can reach both on-prem (via VPN) and the RDS target.</p>
</li>
<li><p>Wait for the instance to become <strong>available</strong>.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419202582/8b972395-fc5f-4a43-b5b1-63abd1736170.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419224935/50b595cf-a82f-4265-85c0-fa1c55fcd6f1.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419268004/ce74f23f-2523-4326-9a3c-8ed196841bfd.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<h3 id="heading-step-7-create-source-amp-target-endpoints-in-dms">Step 7: Create source &amp; target endpoints in DMS</h3>
<p><strong>Source endpoint (MySQL)</strong>:</p>
<ul>
<li><p>Engine: MySQL.</p>
</li>
<li><p>Hostname: your on-prem IP or hostname reachable by the replication instance.</p>
</li>
<li><p>Port: 3306 (or custom).</p>
</li>
<li><p>Username/password: the <code>dms_user</code> you created.</p>
</li>
<li><p>Test the endpoint connection from the replication instance (there’s a “Test endpoint connection” button).</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762063013026/20d76380-50e5-40b3-85ce-93fdef40a7c3.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762063133341/9cdfd354-40d4-49b2-a652-08c8ad63fdf2.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419447740/1a9dac62-e88a-4600-b15d-922bbe29cd19.png" alt class="image--center mx-auto" /></p>
<p>Similarly,</p>
<p><strong>Target endpoint (RDS MySQL)</strong>:</p>
<ul>
<li><p>Engine: MySQL.</p>
</li>
<li><p>Hostname: RDS endpoint.</p>
</li>
<li><p>Port: 3306.</p>
</li>
<li><p>Username/password: RDS master user (or another user with sufficient privileges).</p>
</li>
<li><p>Test the endpoint.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419610698/d93aa560-ce16-420a-b087-1b993bb6ddb4.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419649303/5600b0e2-ab31-438b-a21a-cb20fa1417cd.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419688656/01af8c72-03ef-4644-a1c9-36f2be84ebf0.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p>If the endpoint tests fail, check security group rules, network ACLs, and firewall rules.</p>
<h3 id="heading-step-8-create-and-configure-the-migration-task">Step 8: Create and configure the migration task</h3>
<ul>
<li><p>Search for <mark>DMS</mark> in the console, Select <mark>Database migration tasks</mark> and click on <mark>Create task</mark>.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419772145/9cf21617-77ce-4563-8594-0137bf6d0191.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p>Choose:</p>
<ul>
<li><p><strong>Replication instance</strong></p>
</li>
<li><p><strong>Source endpoint</strong></p>
</li>
<li><p><strong>Target endpoint</strong></p>
</li>
<li><p><strong>Migration type</strong>: <em>Migrate existing data and replicate ongoing changes</em> (Full load + CDC).</p>
</li>
</ul>
<ul>
<li><strong>Table mappings</strong>: choose to migrate entire schemas or select tables. You can use JSON mapping to include/exclude objects.</li>
</ul>
<p><strong>Task settings</strong>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419825870/9a7a7d6f-b1e6-425e-b28e-28cf32b1a433.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419863680/70d3e54a-0f42-4947-9f1b-2803e313c306.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Choose how to handle target table prep (e.g., <em>Do nothing</em> or <em>Drop tables and recreate</em>).</p>
</li>
<li><p>For large LOBs, select appropriate LOB mode (e.g., Full LOB mode).</p>
</li>
<li><p>Tune commit rate and parallel load options if needed.</p>
</li>
</ul>
<p>Start the task (choose <em>Start task on create</em> or start after creation).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760419915867/903c8562-5130-40b3-a7aa-5436f32a767c.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-step-9-monitor-the-migration">Step 9: Monitor the migration</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760420094049/057590ea-8a4b-4c15-9fe5-27fb30595da6.png" alt class="image--center mx-auto" /></p>
<p>In DMS Console:</p>
<ul>
<li><p>Watch task status and replication instance CPU, memory, and disk I/O.</p>
</li>
<li><p>Check <strong>Table statistics</strong> for rows loaded per table</p>
</li>
</ul>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Using AWS DMS to migrate on-prem MySQL to Amazon RDS lets you move with minimal downtime when planned and executed carefully.</p>
]]></content:encoded></item><item><title><![CDATA[EBS Volume Monitoring through CloudWatchAgent and Setting an Alarm]]></title><description><![CDATA[Introduction:
Monitoring storage utilization is critical to ensure application stability and avoid unexpected outages. In AWS, Amazon EBS does not provide built-in metrics for volume-level disk usage, which makes proactive alerting a challenge. To ad...]]></description><link>https://blog.abishekgautam.com.np/ebs-volume-monitoring</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/ebs-volume-monitoring</guid><category><![CDATA[ebs]]></category><category><![CDATA[#CloudWatch]]></category><category><![CDATA[ec2]]></category><category><![CDATA[sns]]></category><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Mon, 14 Apr 2025 18:15:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1744865124890/ecec51ba-da10-478e-ae90-f68b87023255.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction"><strong>Introduction:</strong></h2>
<p>Monitoring storage utilization is critical to ensure application stability and avoid unexpected outages. In AWS, Amazon EBS does not provide built-in metrics for volume-level disk usage, which makes proactive alerting a challenge. To address this, we can install a CloudWatch agent that publishes custom disk utilization metrics to Amazon CloudWatch, enabling us to configure alarms and receive email notifications when EBS usage reaches critical thresholds. In this blog we will setup an alarm if our EBS Volume usage is 80% and above.</p>
<h2 id="heading-architecture-diagram">Architecture Diagram:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744048368976/416dcb7e-a69d-497b-9ad0-f3d289d5b08f.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-procedure">Procedure:</h2>
<p><strong>Step 1: Launch the EC2-Instance</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744020888885/f2ce157d-ebe1-4244-b2f3-c23666aea112.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 2: Copy the Public-IP address of the Instance.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744021018323/d0ae6423-7547-44c2-acf6-e434f01a41f3.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 3: Connect the server using ssh key</strong></p>
<pre><code class="lang-bash">ssh -i /path/&lt;Keyfile.pem&gt; ec2-user@&lt;public Ip&gt;
<span class="hljs-comment">#example:</span>
ssh -i max-demo-key.pem ec2-user@18.207.190.7
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744021253689/8eee269d-c993-40d0-9cfc-5443e108d7a4.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 4: Install and configure the cloudwatch agent</strong></p>
<p>you can do  it <strong>manually</strong> or configure with with a custom script.</p>
<ul>
<li>make a script <a target="_blank" href="http://install.sh"><strong>install.sh</strong></a> and place the following code.</li>
</ul>
<pre><code class="lang-bash"><span class="hljs-meta">#!/bin/bash</span>

<span class="hljs-comment"># Update package list</span>
<span class="hljs-built_in">echo</span> <span class="hljs-string">"Updating system packages..."</span>
sudo yum update -y || sudo apt-get update -y

<span class="hljs-comment"># Install CloudWatch Agent</span>
<span class="hljs-built_in">echo</span> <span class="hljs-string">"Installing Amazon CloudWatch Agent..."</span>
sudo yum install -y amazon-cloudwatch-agent || sudo apt-get install -y amazon-cloudwatch-agent

<span class="hljs-comment"># Create CloudWatch Agent Configuration</span>
<span class="hljs-built_in">echo</span> <span class="hljs-string">"Creating CloudWatch Agent Configuration for EBS volume monitoring..."</span>
CONFIG_FILE=<span class="hljs-string">"/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json"</span>

sudo tee <span class="hljs-variable">$CONFIG_FILE</span> &gt; /dev/null &lt;&lt;EOF
{
    <span class="hljs-string">"agent"</span>: {
        <span class="hljs-string">"metrics_collection_interval"</span>: 60,
        <span class="hljs-string">"run_as_user"</span>: <span class="hljs-string">"root"</span>
    },
    <span class="hljs-string">"metrics"</span>: {
        <span class="hljs-string">"metrics_collected"</span>: {
            <span class="hljs-string">"cpu"</span>: {
                <span class="hljs-string">"measurement"</span>: [
                    <span class="hljs-string">"cpu_usage_idle"</span>,
                    <span class="hljs-string">"cpu_usage_iowait"</span>,
                    <span class="hljs-string">"cpu_usage_user"</span>,
                    <span class="hljs-string">"cpu_usage_system"</span>
                ],
                <span class="hljs-string">"metrics_collection_interval"</span>: 60,
                <span class="hljs-string">"totalcpu"</span>: <span class="hljs-literal">false</span>
            },
            <span class="hljs-string">"disk"</span>: {
                <span class="hljs-string">"measurement"</span>: [
                    <span class="hljs-string">"used_percent"</span>,
                    <span class="hljs-string">"inodes_free"</span>
                ],
                <span class="hljs-string">"metrics_collection_interval"</span>: 60,
                <span class="hljs-string">"resources"</span>: [
                    <span class="hljs-string">"*"</span>
                ]
            },
            <span class="hljs-string">"diskio"</span>: {
                <span class="hljs-string">"measurement"</span>: [
                    <span class="hljs-string">"io_time"</span>,
                    <span class="hljs-string">"write_bytes"</span>,
                    <span class="hljs-string">"read_bytes"</span>,
                    <span class="hljs-string">"writes"</span>,
                    <span class="hljs-string">"reads"</span>
                ],
                <span class="hljs-string">"metrics_collection_interval"</span>: 60,
                <span class="hljs-string">"resources"</span>: [
                    <span class="hljs-string">"*"</span>
                ]
            },
            <span class="hljs-string">"mem"</span>: {
                <span class="hljs-string">"measurement"</span>: [
                    <span class="hljs-string">"mem_used_percent"</span>
                ],
                <span class="hljs-string">"metrics_collection_interval"</span>: 60
            },
            <span class="hljs-string">"netstat"</span>: {
                <span class="hljs-string">"measurement"</span>: [
                    <span class="hljs-string">"tcp_established"</span>,
                    <span class="hljs-string">"tcp_time_wait"</span>
                ],
                <span class="hljs-string">"metrics_collection_interval"</span>: 60
            },
            <span class="hljs-string">"swap"</span>: {
                <span class="hljs-string">"measurement"</span>: [
                    <span class="hljs-string">"swap_used_percent"</span>
                ],
                <span class="hljs-string">"metrics_collection_interval"</span>: 60
            },
            <span class="hljs-string">"custom_metrics"</span>: {
                <span class="hljs-string">"measurement"</span>: [
                    <span class="hljs-string">"CustomMetricExample"</span>
                ],
                <span class="hljs-string">"metrics_collection_interval"</span>: 60,
                <span class="hljs-string">"resources"</span>: [
                    <span class="hljs-string">"*"</span>
                ],
                <span class="hljs-string">"default"</span>: {
                    <span class="hljs-string">"CustomMetricExample"</span>: 3
                }
            }
        }
    }
}

EOF
</code></pre>
<p><strong>Step 5: make the script executable and run the script</strong></p>
<pre><code class="lang-bash">chmod +x install.sh
./install.sh
</code></pre>
<p><strong>Step 6: Enable and Start CloudWatch Agent</strong></p>
<pre><code class="lang-bash">sudo systemctl <span class="hljs-built_in">enable</span> amazon-cloudwatch-agent
sudo systemctl start amazon-cloudwatch-agent
<span class="hljs-comment">#verify the agent is running, if required restart the agent</span>
sudo systemctl status amazon-cloudwatch-agent --no-pager
</code></pre>
<p><strong>Step 7: Create a role for agent to put metric about the resources :</strong></p>
<ul>
<li>Search for <strong>IAM &gt;</strong> Select <strong>Policy &gt;</strong> <strong>Create Policy</strong></li>
</ul>
<h3 id="heading-cloudwatchagentpolicy">CloudWatchAgentPolicy</h3>
<pre><code class="lang-bash">{
    <span class="hljs-string">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-string">"Statement"</span>: [
        {
            <span class="hljs-string">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-string">"Action"</span>: [
                <span class="hljs-string">"cloudwatch:PutMetricData"</span>,
                <span class="hljs-string">"cloudwatch:DescribeAlarms"</span>,
                <span class="hljs-string">"cloudwatch:GetDashboard"</span>,
                <span class="hljs-string">"cloudwatch:ListMetrics"</span>,
                <span class="hljs-string">"cloudwatch:ListDashboards"</span>,
                <span class="hljs-string">"cloudwatch:PutMetricAlarm"</span>,
                <span class="hljs-string">"logs:PutLogEvents"</span>,
                <span class="hljs-string">"logs:CreateLogGroup"</span>,
                <span class="hljs-string">"logs:CreateLogStream"</span>,
                <span class="hljs-string">"logs:DescribeLogStreams"</span>,
                <span class="hljs-string">"logs:DescribeLogGroups"</span>,
                <span class="hljs-string">"logs:PutRetentionPolicy"</span>
            ],
            <span class="hljs-string">"Resource"</span>: <span class="hljs-string">"*"</span>
        },
        {
            <span class="hljs-string">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-string">"Action"</span>: [
                <span class="hljs-string">"ec2:DescribeInstances"</span>,
                <span class="hljs-string">"ec2:DescribeTags"</span>,
                <span class="hljs-string">"ec2:DescribeVolumes"</span>,
                <span class="hljs-string">"ec2:DescribeVolumeStatus"</span>,
                <span class="hljs-string">"ec2:DescribeInstanceStatus"</span>,
                <span class="hljs-string">"ec2:DescribeRegions"</span>
            ],
            <span class="hljs-string">"Resource"</span>: <span class="hljs-string">"*"</span>
        },
        {
            <span class="hljs-string">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-string">"Action"</span>: [
                <span class="hljs-string">"logs:DescribeLogGroups"</span>,
                <span class="hljs-string">"logs:DescribeLogStreams"</span>,
                <span class="hljs-string">"logs:PutLogEvents"</span>
            ],
            <span class="hljs-string">"Resource"</span>: <span class="hljs-string">"*"</span>
        }
    ]
}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744022818926/c3768c8f-6926-44ea-a246-7853a77cb421.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p><strong>Create Policy.</strong></p>
<p>  <strong>Now</strong></p>
</li>
<li><p>Select <strong>Role</strong> and Create <strong>New Role</strong></p>
</li>
<li><p><strong>Trusted entity type to Custom trust policy</strong></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744023171879/46184958-11f5-4316-b0e6-eaef732be93d.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<pre><code class="lang-bash">{
    <span class="hljs-string">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-string">"Statement"</span>: [
        {
            <span class="hljs-string">"Sid"</span>: <span class="hljs-string">"Statement1"</span>,
            <span class="hljs-string">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-string">"Principal"</span>: {
                <span class="hljs-string">"Service"</span>: <span class="hljs-string">"ec2.amazonaws.com"</span>
            },
            <span class="hljs-string">"Action"</span>: <span class="hljs-string">"sts:AssumeRole"</span>
        }
    ]
}
</code></pre>
<ul>
<li><p>Click on <strong>Next</strong></p>
</li>
<li><p>Select the Permission you have created Recently i.e <strong>CloudWatchAgentPolicy</strong></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744049690566/3a5158e8-5664-45b2-b674-6e5445a92dd1.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Click on <strong>Next</strong></p>
</li>
<li><p>Enter the <strong>Role Name</strong></p>
</li>
<li><p>Click on <strong>Create Role</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744023433122/74c150f7-64f7-4ec9-9dd0-a73429887c74.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744023550262/fe5239f1-aaf0-4982-8ec0-4777d1af17e3.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 8: Attach the Role to the Instance</strong></p>
<ul>
<li><p>On the Instances</p>
</li>
<li><p>Select the <strong>Action</strong> &gt; choose <strong>Security</strong> &gt; Click on <strong>Modify IAM role</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744022073602/df460ae9-a49a-42c6-b483-e50069b885f2.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Choose the <strong>CloudWatchAgentInstanceProfile</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744022052799/d9df41cb-b733-43ec-922e-30a203bcb296.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 9: Restart the Agent</strong></p>
<pre><code class="lang-bash">sudo systemctl restart amazon-cloudwatch-agent
</code></pre>
<ul>
<li>view the logs of the agent</li>
</ul>
<pre><code class="lang-bash">sudo journalctl -u amazon-cloudwatch-agent --no-pager -n 50
sudo cat /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log
</code></pre>
<p><strong>Step 10: Create  a SNS Topic and make Subscription using required email address.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744024408439/e81ea738-9c5d-4cc1-ae9d-880ea93f4ff6.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Click on <strong>Create Topic</strong></p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744024673838/1a8fa655-19a4-44d5-8e1a-36520106d237.png" alt class="image--center mx-auto" /></p>
<p>  Copy the <strong>Arn</strong> value</p>
</li>
</ul>
<p><strong>Step 11: Command to create a cloudwatch alarm.</strong></p>
<ul>
<li>Change the required value also, CloudWatch metric parameter must match the dimensions.</li>
</ul>
<p><strong>Example: &lt;Private_IP&gt; and &lt;SNS_ARN_Topic&gt;</strong></p>
<pre><code class="lang-bash">aws cloudwatch put-metric-alarm \
  --alarm-name <span class="hljs-string">"Volume 80% Utilization"</span> \
  --metric-name <span class="hljs-string">"disk_used_percent"</span> \
  --namespace <span class="hljs-string">"CWAgent"</span> \
  --statistic <span class="hljs-string">"Average"</span> \
  --dimensions Name=device,Value=xvda1 Name=fstype,Value=xfs Name=host,Value=ip-&lt;Private-IP&gt;.ec2.internal Name=path,Value=/ \
  --threshold 80 \
  --comparison-operator GreaterThanThreshold \
  --evaluation-periods 1 \
  --period 300 \
  --alarm-actions &lt;SNS_ARN_Topic&gt; \
  --region us-east-1
</code></pre>
<h3 id="heading-or-manually-set-an-alarm">Or manually set an alarm.</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744028267838/fd126506-cb42-402b-a14c-01d03fb0edf5.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744028284185/0d31b583-e0c2-49e6-8292-968ad028899f.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744028325961/96104046-7ac0-436b-950e-8a852a5b3efc.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744028356571/11806c0d-1523-47ca-b607-30efe34b9e59.png" alt /></p>
<p>Now,</p>
<ul>
<li><p>Go to the <strong>CloudWatch</strong></p>
</li>
<li><p>Select <strong>All Alarms.</strong></p>
</li>
<li><p>Copy the <strong>ARN</strong> of the CloudWatch Alarm.</p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744026348042/61a7db2b-ce84-47b6-a806-b01d3669518a.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p><strong>Step 12: Attach the Access policy to the SNS Topic</strong></p>
<ul>
<li>CloudWatch need permission to publish the message,</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744024673838/1a8fa655-19a4-44d5-8e1a-36520106d237.png" alt /></p>
<ul>
<li><p>Click on <strong>Edit</strong> in SNS Topic</p>
</li>
<li><p>Under <strong>Access Policy</strong> replace the policy and <strong>change &lt;SNS ARN&gt;</strong></p>
</li>
<li><pre><code class="lang-bash">          {
            <span class="hljs-string">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
            <span class="hljs-string">"Statement"</span>: [
              {
                <span class="hljs-string">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
                <span class="hljs-string">"Principal"</span>: {
                  <span class="hljs-string">"Service"</span>: <span class="hljs-string">"cloudwatch.amazonaws.com"</span>
                },
                <span class="hljs-string">"Action"</span>: <span class="hljs-string">"SNS:Publish"</span>,
                <span class="hljs-string">"Resource"</span>: <span class="hljs-string">"&lt;SNS ARN&gt;"</span>,
                <span class="hljs-string">"Condition"</span>: {
                  <span class="hljs-string">"ArnLike"</span>: {
                    <span class="hljs-string">"aws:SourceArn"</span>: <span class="hljs-string">"CLOUDWATCH ARN"</span>
                  }
                }
              }
            ]
          }
</code></pre>
<p>  <strong>Step 13: Restart the Agent and check the metric list.</strong></p>
</li>
</ul>
<pre><code class="lang-bash"><span class="hljs-comment">#restart t-status</span>
sudo systemctl restart amazon-cloudwatch-agent
<span class="hljs-comment">#checking the metric being pushed by the CWAgent</span>
aws cloudwatch list-metrics --namespace <span class="hljs-string">"CWAgent"</span> --metric-name <span class="hljs-string">"disk_used_percent"</span> --region us-east-1
</code></pre>
<p><strong>Step 14:</strong> <strong>Creating Subscriptions for your SNS Topic</strong></p>
<ul>
<li><p>Go the <strong>SNS TOPIC</strong></p>
</li>
<li><p><strong>Create Subscriptions</strong></p>
</li>
<li><p><strong>Protocal: Email</strong></p>
</li>
<li><p><strong>EndPoint: “Enter Your Email address”</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744027098455/fc0e0d9a-091e-4242-85e9-1e66e3bd6320.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Open your Email and <strong>Confirm Subscription</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744027287720/a5eda22d-ac2f-47c9-b131-936c773b27c5.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 15: Triggering the Event by Manually utilizing the EBS Volume.</strong></p>
<ul>
<li>Creating a <strong>testfile.img</strong> with size of <strong>5GB</strong></li>
</ul>
<pre><code class="lang-bash">sudo fallocate -l 5G /testfile.img
<span class="hljs-comment">#view  the storage of the system </span>
df -h
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744027655307/26b3f049-c05d-4994-92f3-961b5b3b1efa.png" alt class="image--center mx-auto" /></p>
<p>As you can see the disk utilization is 88% on /dev/xvda1 now, we should receive an alarm.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744028189861/4a9601d0-1d53-463a-bed9-c2b23b95a537.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-congratulation">Congratulation!!!</h3>
<p>You did a great job. you have now successfully demonstrated monitoring EBS volume using CloudWatch agent and setup an alarm when the threshold met.</p>
<h2 id="heading-conclusion">Conclusion:</h2>
<p>By publishing custom disk utilization metrics to Amazon CloudWatch, we gained visibility into EBS volume usage that wasn’t available by default. This enables timely alerts and proactive storage management, helping prevent performance issues and downtime.</p>
]]></content:encoded></item><item><title><![CDATA[Managing Objects on S3 with Client-Side Encryption and Automation]]></title><description><![CDATA[Introduction:
we need to securely transfer sensitive documents to the cloud without manual intervention. A common requirement is to automatically detect file changes, apply client-side encryption, and upload only the modified files on a scheduled bas...]]></description><link>https://blog.abishekgautam.com.np/client-side-encryption-and-automation</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/client-side-encryption-and-automation</guid><category><![CDATA[#client-side-encryption]]></category><category><![CDATA[S3]]></category><category><![CDATA[encryption]]></category><category><![CDATA[gpg]]></category><category><![CDATA[automation]]></category><category><![CDATA[AWS]]></category><category><![CDATA[AWS s3]]></category><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Thu, 13 Mar 2025 18:15:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1744106102746/f0a153c7-01c8-43af-b2b0-34b53fcb76e1.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction:</h2>
<p>we need to securely transfer sensitive documents to the cloud without manual intervention. A common requirement is to automatically detect file changes, apply client-side encryption, and upload only the modified files on a scheduled basis, such as every midnight. This approach ensures strong data security, reduces unnecessary uploads, and optimizes bandwidth and storage usage. In this Blog we will go through securing our object and moving it to the S3 bucket.</p>
<h3 id="heading-architecture-diagram">Architecture Diagram</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744009937129/ffe620d5-98de-428e-b5d7-3e074e58bc94.png" alt class="image--center mx-auto" /></p>
<p>To complete this Project we will be using <strong>AWS CLI</strong> and <strong>Bash-Script</strong> for Automation and <strong>Cronjob</strong> for triggering event every-midnight.</p>
<h2 id="heading-procedure">Procedure:</h2>
<h3 id="heading-step-1-create-a-bucket-and-enable-versioning">Step 1: Create a bucket and enable versioning</h3>
<pre><code class="lang-bash">aws s3 mb s3://max-demo-abi7

<span class="hljs-comment">#enable the versioning of bucket</span>
aws s3api put-bucket-versioning --bucket max-demo-abi7 --versioning-configuration Status=Enabled
</code></pre>
<ul>
<li>Go to the <strong>AWS management console</strong> and Search for <strong>S3</strong> and also check for versioning enabled by clicking the <strong>Properties</strong> option.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744011594667/f57bfe50-7508-4822-82a8-1f91cbff2ad7.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744011667344/e9809fb5-506c-4136-845e-e56d8445a08c.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-step2-create-a-file-scriptsh">Step2: Create a file <mark>script.sh</mark></h3>
<p>This script does the following:</p>
<ol>
<li><p>Watches a file <strong>(file1.txt)</strong> for changes.</p>
<p> If modified</p>
<p> Encrypts it with <strong>GPG</strong>.</p>
</li>
<li><p>Uploads the encrypted file to an S3 bucket.</p>
</li>
<li><p>Updates a timestamp log.</p>
</li>
<li><p>If not modified: Skips processing.</p>
</li>
<li><p>If the file doesn't exist: Logs that info.</p>
</li>
</ol>
<p>Now, update the <strong>variables</strong> in the script, also update <strong>passphrase</strong></p>
<pre><code class="lang-bash"><span class="hljs-meta">#!/bin/bash</span>

<span class="hljs-comment"># Set DIRECTORY_PATH ,FILE_NAME and S3_BUCKET variables</span>
DIRECTORY_PATH=<span class="hljs-string">"/home/abi/Desktop/max-demo/"</span>
<span class="hljs-built_in">cd</span> <span class="hljs-string">"<span class="hljs-variable">$DIRECTORY_PATH</span>"</span> || { <span class="hljs-built_in">echo</span> <span class="hljs-string">"Failed to change directory to <span class="hljs-variable">$DIRECTORY_PATH</span>"</span>; <span class="hljs-built_in">exit</span> 1; }

FILE_NAME=<span class="hljs-string">"file1.txt"</span>
ENCRYPTED_FILE=<span class="hljs-string">"<span class="hljs-variable">${FILE_NAME}</span>.gpg"</span>
S3_BUCKET=<span class="hljs-string">"s3://max-demo-abi7"</span>
LAST_MODIFIED_FILE=<span class="hljs-string">"<span class="hljs-variable">$DIRECTORY_PATH</span>/last_modified.txt"</span>

<span class="hljs-comment"># Check if the file exists</span>
<span class="hljs-keyword">if</span> [ -f <span class="hljs-string">"<span class="hljs-variable">$FILE_NAME</span>"</span> ]; <span class="hljs-keyword">then</span>
    <span class="hljs-comment"># Get the current last modified time of the file</span>
    CURRENT_MODIFIED_TIME=$(<span class="hljs-built_in">stat</span> -c %Y <span class="hljs-string">"<span class="hljs-variable">$FILE_NAME</span>"</span>)

    <span class="hljs-comment"># Check last_modified.txt for previous timestamp (or empty)</span>
    <span class="hljs-keyword">if</span> [ -f <span class="hljs-string">"<span class="hljs-variable">$LAST_MODIFIED_FILE</span>"</span> ]; <span class="hljs-keyword">then</span>
        LAST_MODIFIED_TIME=$(cat <span class="hljs-string">"<span class="hljs-variable">$LAST_MODIFIED_FILE</span>"</span>)
        <span class="hljs-comment"># If the file is empty, treat as not previously uploaded</span>
        <span class="hljs-keyword">if</span> [ -z <span class="hljs-string">"<span class="hljs-variable">$LAST_MODIFIED_TIME</span>"</span> ]; <span class="hljs-keyword">then</span>
            LAST_MODIFIED_TIME=0
        <span class="hljs-keyword">fi</span>
    <span class="hljs-keyword">else</span>
        LAST_MODIFIED_TIME=0  <span class="hljs-comment"># If the file doesn't exist</span>
    <span class="hljs-keyword">fi</span>

    <span class="hljs-comment"># Compare timestamps to decide if the file was modified</span>
    <span class="hljs-keyword">if</span> [ <span class="hljs-string">"<span class="hljs-variable">$CURRENT_MODIFIED_TIME</span>"</span> -gt <span class="hljs-string">"<span class="hljs-variable">$LAST_MODIFIED_TIME</span>"</span> ]; <span class="hljs-keyword">then</span>
        <span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-subst">$(date)</span>: File <span class="hljs-variable">$FILE_NAME</span> has been modified or is new. Encrypting..."</span>

        <span class="hljs-comment"># Encrypt the file using GPG (symmetric encryption)</span>
        gpg --batch --yes --symmetric --cipher-algo AES256 --passphrase <span class="hljs-string">"max@Passw0rd"</span> -o <span class="hljs-string">"<span class="hljs-variable">$ENCRYPTED_FILE</span>"</span> <span class="hljs-string">"<span class="hljs-variable">$FILE_NAME</span>"</span>

        <span class="hljs-keyword">if</span> [ $? -eq 0 ]; <span class="hljs-keyword">then</span>
            <span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-subst">$(date)</span>: Encryption successful. Uploading to S3..."</span>

            <span class="hljs-comment"># Upload the encrypted file to S3</span>
            aws s3 cp <span class="hljs-string">"<span class="hljs-variable">$ENCRYPTED_FILE</span>"</span> <span class="hljs-string">"<span class="hljs-variable">$S3_BUCKET</span>/"</span>

            <span class="hljs-keyword">if</span> [ $? -eq 0 ]; <span class="hljs-keyword">then</span>
                <span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-subst">$(date)</span>: File successfully uploaded to <span class="hljs-variable">$S3_BUCKET</span>"</span>
                rm -f <span class="hljs-string">"<span class="hljs-variable">$ENCRYPTED_FILE</span>"</span>

                <span class="hljs-comment"># Update the last modified timestamp</span>
                <span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-variable">$CURRENT_MODIFIED_TIME</span>"</span> &gt; <span class="hljs-string">"<span class="hljs-variable">$LAST_MODIFIED_FILE</span>"</span>
            <span class="hljs-keyword">else</span>
                <span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-subst">$(date)</span>: Upload to S3 failed!"</span>
            <span class="hljs-keyword">fi</span>
        <span class="hljs-keyword">else</span>
            <span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-subst">$(date)</span>: Encryption failed!"</span>
        <span class="hljs-keyword">fi</span>
    <span class="hljs-keyword">else</span>
        <span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-subst">$(date)</span>: File <span class="hljs-variable">$FILE_NAME</span> has not been modified. Skipping encryption and upload."</span>
    <span class="hljs-keyword">fi</span>
<span class="hljs-keyword">else</span>
    <span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-subst">$(date)</span>: File <span class="hljs-variable">$FILE_NAME</span> not found in <span class="hljs-variable">$DIRECTORY_PATH</span>"</span>
<span class="hljs-keyword">fi</span>
</code></pre>
<p><mark>Note:</mark> following command is used for encrypting the object so the <strong>—passphrase</strong> <mark>“max@Passw0rd“</mark> should be noted for decrypting later.</p>
<pre><code class="lang-bash">
gpg --batch --yes --symmetric --cipher-algo AES256 --passphrase <span class="hljs-string">"max@Passw0rd"</span> -o <span class="hljs-string">"<span class="hljs-variable">$ENCRYPTED_FILE</span>"</span> <span class="hljs-string">"<span class="hljs-variable">$FILE_NAME</span>"</span>
</code></pre>
<h3 id="heading-step3-make-the-scriptsh-executable">Step3: Make the script.sh executable</h3>
<pre><code class="lang-bash">sudo chmod +x script.sh
</code></pre>
<h3 id="heading-step4-set-the-cronjob-for-automation-at-1200-am-midnight">Step4: Set the cronjob for automation at 12:00 AM midnight</h3>
<pre><code class="lang-bash"><span class="hljs-comment">#checking the status of cron</span>
systemctl status cron

crontab -e
<span class="hljs-comment">#paste the below line and change path to script.sh file</span>
00 00 * * * &lt;Path/to/scritp&gt;/script.sh &gt;&gt; &lt;Path/to/<span class="hljs-built_in">log</span>&gt;/logfile.log 2&gt;&amp;1
</code></pre>
<p>for testing set the cronjob for min after some minutes to current time.</p>
<p><mark>Example:</mark> This will run the cronjob at 1:40 PM everyday</p>
<pre><code class="lang-bash">40 13 * * * ~/Desktop/max-demo/script.sh &gt;&gt; ~/Desktop/max-demo/logfile.log 2&gt;&amp;1
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744011173220/9c2c1b89-61e3-4fbf-8212-f92ee1f497ea.png" alt class="image--center mx-auto" /></p>
<ul>
<li>After the Successful execution of the script , you will get your encrypted object with extension <strong>.gpg</strong> uploaded to bucket</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744012757938/75824777-533d-4833-9860-7371ca34b00b.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-step5-reading-the-file">Step5: Reading the File</h3>
<ul>
<li>Download the file and <strong>decrypt</strong> using the passphrase that you have set before.</li>
</ul>
<pre><code class="lang-bash"><span class="hljs-comment">#download the file from s3 to local directory</span>
aws s3 cp s3://max-demo-abi7/file1.txt.gpg .

cat file1.txt.gpg
<span class="hljs-comment">#decrypting the file using passphrase and output in file1.txt file</span>
gpg --batch --yes --passphrase <span class="hljs-string">"max@Passw0rd"</span> -o file1.txt -d file1.txt.gpg

<span class="hljs-comment">#view the file after decryption</span>
cat file1.txt
</code></pre>
<ul>
<li>View the encrypted text file using cat command</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744013236289/9fa87496-e4b4-4217-b033-fe0278a199b0.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744013388343/70a466e7-fb60-45be-8cd3-1e2cbceb8660.png" alt class="image--center mx-auto" /></p>
<p>You can also check the <strong>log_files.log</strong> and <strong>last_modified.txt</strong> files by setting <strong>cronjob without changing</strong> the context of <strong>file1.txt.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744018820814/33d4edd8-4fbc-4a09-bc1c-8ca1ec22af0b.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-congratulations">Congratulations!!!</h3>
<p>You have successfully completed this demonstration. Now you will be able to use <strong>client-side encryption</strong> into your <strong>S3-bucket</strong>.</p>
<h2 id="heading-conclusion">Conclusion:</h2>
<p>By automating file change detection, client-side encryption, and scheduled uploads, we can ensure our sensitive data is transferred securely and efficiently.</p>
]]></content:encoded></item><item><title><![CDATA[Migrating Data using AWS Storage Gateway in File Gateway mode and Enabling Cross Region Replication between Buckets.]]></title><description><![CDATA[Introduction:
Data migration and disaster recovery are key considerations for building resilient cloud architectures. A common requirement is to migrate data from an local machine to a primary Amazon S3 bucket, while ensuring that the same objects ar...]]></description><link>https://blog.abishekgautam.com.np/migrating-data-with-aws-storage-gateway</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/migrating-data-with-aws-storage-gateway</guid><category><![CDATA[#datamigration #storage #filegateway #CRR #storage-gateway]]></category><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Wed, 12 Feb 2025 11:41:46 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1744105108122/2523bdb0-42c7-4560-99ef-7099fcdf137a.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction:</h2>
<p>Data migration and disaster recovery are key considerations for building resilient cloud architectures. A common requirement is to migrate data from an <strong>local machine</strong> to a <strong>primary Amazon S3 bucket</strong>, while ensuring that the same objects are <strong>automatically replicated to a secondary bucket</strong> in <strong>another AWS region</strong>. This setup not only simplifies data migration but also provides high availability, durability, and cross-region redundancy without manual intervention.</p>
<h2 id="heading-architecture-diagram">Architecture Diagram:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739255026247/10db04a1-de6f-42d5-abd3-5b5f4e619f99.png" alt /></p>
<h2 id="heading-procedures">Procedures:</h2>
<p><strong>Step1:</strong> Login to your <strong>AWS Management Console</strong> and change the region to <strong>us-east-2.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739248423229/83874ad5-e2f3-4b14-a8d1-c566775818ad.png" alt /></p>
<p><strong>Step2:</strong> Create <strong>two S3 Bucket</strong> in <strong>different regions</strong> and <strong>enable versioning</strong> for <strong>cross region replication.</strong></p>
<ul>
<li><p>We name the <strong>Primary</strong> Bucket “<strong>abisbucket</strong>” in AWS region <strong>“us-east-2”</strong></p>
</li>
<li><p><strong>Secondary</strong> Bucket be <strong>“abisbucket101”</strong> in AWS region <strong>“us-west-2”</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739248248233/28ebd246-3e00-477f-93e3-c4763580ca8d.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Bucket versioning <strong>Enable.</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739248277609/7fc75675-b2ea-47be-8a93-daf624f4071a.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Similary, Create another bucket.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739248372274/0b7fa2c4-a059-42e9-a0b5-e721f3cb048c.png" alt class="image--center mx-auto" /></p>
<p><strong>Step3:</strong> Creating <strong>Replication Rule</strong> to the Primary Bucket.</p>
<ul>
<li><p>Select the primary bucket named, here “<strong>abisbucket</strong>“</p>
</li>
<li><p>Navigate to the <strong>Management tab</strong></p>
</li>
<li><p>Navigate to <strong>Replication rules</strong> and</p>
</li>
<li><p>Click <strong>create replication rule.</strong></p>
</li>
<li><p>Enter the <strong>Name</strong> for Replication rule. eg: “<strong>crr-full-bucket</strong>“</p>
</li>
<li><p>keep the <strong>Status Enabled</strong>.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739248582259/f859a93d-a8cb-4526-9cf9-18cb60a7a984.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Under the <strong>Source bucket</strong>, <strong>Apply to all objects in the bucket</strong></p>
</li>
<li><p>From <strong>Destination</strong> Section, <strong>Choose the bucket in this account</strong></p>
</li>
<li><p><strong>Browse S3 Bucket</strong> that you have created as <strong>Secondary.</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739248611566/d970f2ac-a34d-42ed-b98f-35f05ebdfa8e.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Under <strong>IAM role</strong>, Select <strong>Create new role</strong> or if you have already created an Role <strong>Choose existing IAM roles.</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739248671565/60b9ce62-95bb-4009-87e4-1a3721e8b06a.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>For now we have just created an bucket and doesn’t contains any objects so choose <strong>Not to replicate existing objects.</strong></p>
</li>
<li><p>Click on <strong>Submit.</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739248782253/f1d2d2d1-db27-4e1d-88b6-79422a4aee32.png" alt /></p>
<p><strong>Step4:</strong> Checking whether <strong>CRR</strong> is Successful or Not.</p>
<ul>
<li><p>Upload an file to the Primary Bucket “<strong>abisbucket</strong>“</p>
</li>
<li><p>Navigate to the Seconday Bucket “<strong>abisbucket101</strong>“, You should be able to see the objects uploaded in the primary bucket.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739248919657/267d3671-13b3-4ef9-99f8-b0ab71849ef0.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739249002418/8e5900c4-4aea-4ee3-9910-c09489d2a5c8.png" alt class="image--center mx-auto" /></p>
<p><strong>Step5:</strong> Setting up <strong>Storage Gateway</strong></p>
<ul>
<li><p>In your Management console type <strong>Storage Gateway</strong> on the search box and <strong>click it</strong> to open.</p>
</li>
<li><p>Click on <strong>create gateway</strong></p>
</li>
<li><p>Enter the Gateway name , For now “<strong>File Gateway</strong>“</p>
</li>
<li><p>Under Gateway options, Choose <strong>Amazon S3 File Gateway</strong>.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739249181765/6d8eb10a-f0b8-4887-a155-7d5c284730d8.png" alt /></p>
<ul>
<li><p>Select <strong>Amazon EC2</strong> from Platform options.</p>
</li>
<li><p>Choose <strong>Customize your settings</strong> from the Launch EC2 instance.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739249294790/4a62a9c0-2ac1-4f36-b46e-d00fe1eeee96.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Click on <strong>Launch instance</strong> under Set up gateway on Amazon EC2</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744090161967/09f04e46-4b54-4be9-b7ea-5902fe321ab7.png" alt /></p>
<p><strong>Step6:</strong> Fill out the details to <strong>create an instance.</strong></p>
<p><img src="https://miro.medium.com/v2/resize:fit:1250/1*EPq-FGkRWnGY3yLVIQ6xSg.png" alt /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744090685154/50613b14-874b-408d-b70d-24ddc95e2f21.png" alt /></p>
<ul>
<li><p>Enter the name of the instance (you can choose any name),</p>
</li>
<li><p>for the AMI it is automatically selected for you,</p>
</li>
<li><p>on the instance type select <strong>t2.micro,</strong></p>
</li>
<li><p>on the key pair you can proceed with vockey or just proceed to create your own,</p>
</li>
<li><p>on the network settings I would prefer you use a VPC that you have already created and make sure to enable elastic IP address,</p>
</li>
<li><p>choose the security group associated with the instance,</p>
</li>
<li><p>if the volume is not enough go ahead and add a new volume so that your data will be able to fit without any disruptions,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739249815614/ee16cb7e-6e4f-445b-ac94-af95968fe060.png" alt /></p>
<ul>
<li><p>after doing all of this go ahead and review all the settings and if everything is looking good</p>
</li>
<li><p>launch the instance.</p>
</li>
<li><p>You will receive a sucess message that your instance has been created successfully.</p>
</li>
<li><p>Your instance is going to take a few minutes to initialize. Monitor the deployment until the status check to complete.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739249904628/daa6b046-f337-4f72-93a5-3dba89305e55.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Copy the above instance <strong>Public IP address.</strong></p>
</li>
<li><p>On the Gateway Tab on <strong>Step2</strong> , Select IP address connection options and <strong>Paste</strong> the copied instance public ip address.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739249959869/91b9a3ba-2320-469d-9c3f-39a3f34f7336.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Choose <strong>Publicly accessible</strong> in the Endpoint options.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739250034755/b9145b6b-072b-4d91-a90b-b584417f4f41.png" alt class="image--center mx-auto" /></p>
<ul>
<li>After all of this choose next and review and activate settings and choose activate gateway. You will receive a success message as the on below and make sure the status is running.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739250160389/73d0eb37-7773-4894-b4af-574eb5e03072.png" alt class="image--center mx-auto" /></p>
<p><strong>Step7: Create file Share</strong></p>
<ul>
<li>After successfully creating the File Gateway and the status is displaying running the proceed and <strong>create file share at the top right hand side.</strong> You will happen to see the page below.</li>
</ul>
<p><img src="https://miro.medium.com/v2/resize:fit:1250/1*W0287QD0aGuhmeyJkG1EsA.png" alt /></p>
<ul>
<li>Select the Name of the Gateway you just created</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739250647099/dfea988b-55c9-45ee-bbb3-41f412b092f4.png" alt class="image--center mx-auto" /></p>
<ul>
<li>On the S3 bucket choose the <strong>primary bucket</strong> that you had already created, then choose customize configuration or you can go right ahead to create file share.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739250856572/c8480aca-e338-42b5-a50a-a51abe2e96ab.png" alt class="image--center mx-auto" /></p>
<ul>
<li>For the file share protocol, I will use <strong>NFS</strong> since am using Linux and my instance is also Linux,</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739251026823/0bebd903-edc6-4e58-8031-8272bf111d8b.png" alt class="image--center mx-auto" /></p>
<ul>
<li>You can see the File share has been created successfully and added to the gateway.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739251130945/7a15cba7-5f14-44c5-8751-e34502d70760.png" alt class="image--center mx-auto" /></p>
<p>you have successfully created a storage gateway and you are almost there, it should be running just fine.</p>
<p><strong>Now,</strong></p>
<p>We need to mount the file share to Linux instance for migrating the data.</p>
<p><strong>Step8: Connect to on premises instance and migrate the data to S3.</strong></p>
<ul>
<li>Create the directory that will be used to synchronize data with your S3 bucket.</li>
</ul>
<pre><code class="lang-bash">ssh -i &lt;/path/to/key-file&gt; ec2-user@&lt;ip-addess&gt;
sudo mkdir -p /mnt/nfs/s3
</code></pre>
<ul>
<li>Then mount the file share on the Linux instance by using the command that you located in the Storage Gateway file shares details screen at the end of the last task.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739251142787/12d784a6-76a2-49ae-9c5f-4426b0be834d.png" alt class="image--center mx-auto" /></p>
<pre><code class="lang-bash">sudo mount -t nfs -o nolock,hard 10.10.1.98:/abisbucket [MountPath]
<span class="hljs-comment">#example:</span>
sudo mount -t nfs -o nolock,hard 10.10.1.98:/abisbucket /mnt/nfs/s3*
<span class="hljs-comment">#view if the bucket is mounted to your instance mountpoint</span>
df-h
<span class="hljs-comment">#copy the data to the mountpoint</span>
cp -v &lt;file/Path&gt; &lt;/mountpoint&gt;
<span class="hljs-comment">#example</span>
cp -v /media/data/* /mnt/nfs/s3
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739251734207/edd11442-d8c2-4f5d-8733-33171207bb6d.png" alt class="image--center mx-auto" /></p>
<p><strong>Step9:</strong> <strong>Confirming Migrations</strong></p>
<p>Check whether the data have been migrated to the primary S3 bucket and also to the secondary bucket form the primary bucket.</p>
<ul>
<li><p>To verify that your data has been migrated you can go back to the management console and search for S3.</p>
</li>
<li><p>Select the Primary Bucket “<strong>abisbucket“</strong></p>
</li>
<li><p>you can see the files migrated to the bucket form the instance.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739251821985/b1c90b7c-5a02-4fc2-be14-d2a5bac30ffc.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Now, select the Seconday Bucket “<strong>abisbucket101</strong>“</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739251879207/605f24d0-73a2-4a29-9942-c0449dfd699a.png" alt class="image--center mx-auto" /></p>
<ul>
<li>you can see all the objects have been replicated from the Primary Bucket.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739251907637/8a1e8021-2684-4950-bbd4-82500a65eef0.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-conclusion"><strong>Conclusion:</strong></h2>
<p>we have successfully migrated data to Amazon S3 by using AWS Storage Gateway in File Gateway mode. Being a hybrid storage solution AWS Storage Gateway is a highly adaptable solution. It can serve a broad range of use cases, from primary backups and disaster recovery to comprehensive data migrations or cloud resources for various workloads.</p>
]]></content:encoded></item><item><title><![CDATA[Creating an Amazon EFS File System]]></title><description><![CDATA[Amazon Elastic File System (Amazon EFS) provides serverless, fully elastic file storage so that you can share file data without provisioning or managing storage capacity and performance. Amazon EFS is built to scale on demand to petabytes without dis...]]></description><link>https://blog.abishekgautam.com.np/creating-an-amazon-efs-file-system</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/creating-an-amazon-efs-file-system</guid><category><![CDATA[AWS]]></category><category><![CDATA[EFS]]></category><category><![CDATA[storage]]></category><category><![CDATA[Amazon EFS]]></category><category><![CDATA[EC2 instance]]></category><category><![CDATA[ec2]]></category><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Tue, 07 Jan 2025 14:06:03 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1735622098598/b85b10bc-7504-4d67-a943-70ec486919d8.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Amazon Elastic File System (Amazon EFS) provides serverless, fully elastic file storage so that you can share file data without provisioning or managing storage capacity and performance. Amazon EFS is built to scale on demand to petabytes without disrupting applications, growing and shrinking automatically as you add and remove files.</p>
<p>The service is designed to be highly scalable, highly available, and highly durable.</p>
<h2 id="heading-task-1-creating-a-security-group-to-access-efs-file-system"><strong>Task 1: Creating a security group to access EFS file system</strong></h2>
<p>The security group that we associate with a mount target <em>must allow inbound access for</em> <strong><em>TCP on port</em></strong> <strong><em>2049</em></strong> <em>for Network File System (NFS)</em>. This is the security group that we will now create, configure, and attach to your EFS mount targets.</p>
<ul>
<li><p>At the top of the AWS Management Console, in the search box, search for and choose <code>EC2.</code></p>
</li>
<li><p>In the navigation pane on the left, choose <strong>Security Groups</strong>.</p>
</li>
<li><p>Choose <strong>Create security group</strong> then configure:</p>
<ul>
<li><p><strong>Security group name:</strong> <code>EFS Mount Target</code></p>
</li>
<li><p><strong>Description:</strong> <code>Inbound NFS access from EFS clients</code></p>
</li>
<li><p>Select the <strong>VPC</strong></p>
</li>
<li><p>Under the <strong>Inbound rules</strong> section, choose <strong>Add rule</strong> then configure:</p>
<ul>
<li><strong>Type:</strong> <em>NFS</em></li>
</ul>
</li>
</ul>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735622741892/338e526a-cd7e-4b3d-b031-9586778eda68.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-task-2-creating-an-efs-file-system"><strong>Task 2: Creating an EFS file system</strong></h2>
<p>EFS file systems can be mounted to multiple EC2 instances that run in different Availability Zones in the same Region. These instances use <em>mount targets</em> that are created in each <em>Availability Zone</em> to mount the file system</p>
<ul>
<li><p>At the top of the AWS Management Console, in the search box, search for and choose <code>EFS</code>.</p>
</li>
<li><p>Choose <strong>Create file system</strong>.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735622149157/0fa2270e-da6a-4079-8ceb-e36a7e13bc29.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>In the <strong>Create file system</strong> window, choose <strong>Customize</strong>.</p>
<ul>
<li><p>Uncheck Enable Automatic backups.</p>
</li>
<li><p><strong>Lifecycle management</strong>:</p>
<ul>
<li>for <strong>Transition into IA</strong> Select <em>None</em>.</li>
</ul>
</li>
<li><p>In the <strong>Tags</strong> <em>optional</em> section, configure:</p>
<ul>
<li><p><strong>Key:</strong> <mark>Name</mark></p>
</li>
<li><p><strong>Value:</strong> <mark>MY First EFS File System</mark></p>
</li>
<li><p>Attach the <strong>EFS Mount Target</strong> security group to each <em>Availability Zone</em> mount target by choosing <strong>EFS Mount Target</strong> for each Availability Zone.</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735622222503/aeaa7ae2-926e-45b5-a153-fb318df075b9.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735622552363/eb0bece2-adf8-4165-9b8e-eee66ee9393f.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-task-3-creating-a-new-directory-and-mounting-the-efs-file-system"><strong>Task 3: Creating a new directory and mounting the EFS file system</strong></h2>
<ul>
<li><p>In your EC2 terminal session, run the following command to install the required utilities:</p>
<pre><code class="lang-bash">  sudo su -l ec2-user
  sudo yum install -y amazon-efs-utils
  sudo mkdir efs
</code></pre>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735623164110/034f2492-d3cc-4854-9426-b8c2fb8726fc.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>At the top of the AWS Management Console, in the search box, search for and choose <strong>EFS.</strong></p>
</li>
<li><p>Choose <strong>My First EFS File System</strong>.</p>
</li>
<li><p>In the <strong>Amazon EFS Console</strong>, on the top right corner of the page, choose <strong>Attach</strong> to open the Amazon EC2 mount instructions.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735623219860/e17c816b-2cbb-49b7-a6db-4b01a5af53e6.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735623325213/fb89fc67-425a-4e28-a2a6-d9580824d279.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Copy the above <strong>NFS client</strong> section and paste it in your terminal to mount the EFS with the system.</p>
</li>
<li><p><strong>df -hT</strong> to view the disk usage in the system, you can see the Type nfs4 with &lt;ip address&gt; in the file system.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735623487697/1dce0370-0a20-4e50-a807-dd5fa5c6e143.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-task-4-examining-the-performance-behavior-of-your-new-efs-file-system"><strong>Task 4: Examining the performance behavior of your new EFS file system</strong></h2>
<h3 id="heading-examining-the-performance-by-using-flexible-io">Examining the performance by using Flexible IO</h3>
<p>Flexible IO (fio) is a synthetic I/O benchmarking utility for Linux. It is used to benchmark and test Linux I/O subsystems.</p>
<pre><code class="lang-bash">sudo fio --name=fio-efs --filesize=10G --filename=./efs/fio-efs-test.img --bs=1M --nrfiles=1 --direct=1 --sync=0 --rw=write --iodepth=200 --ioengine=libaio
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735623842105/833a9a63-8175-4d02-81f5-8dfedf9b2e0f.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-monitoring-performance-by-using-amazon-cloudwatch"><strong>Monitoring performance by using Amazon CloudWatch</strong></h3>
<ul>
<li><p>At the top of the AWS Management Console, in the search box, search for and choose <strong>CloudWatch</strong>.</p>
</li>
<li><p>In the navigation pane on the left, choose <strong>All Metrics.</strong></p>
</li>
<li><p>In the All metrics tab, choose <strong>EFS.</strong></p>
</li>
<li><p>Choose <strong>File System Metrics.</strong></p>
</li>
<li><p>Select the row that has the <strong>PermittedThroughput</strong> Metric Name.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735623905390/8799f688-ebf5-4f9c-914c-834bd19b27fc.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735623973429/b06ce6c4-2187-4952-8eef-6af44e01938e.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Choose the <strong>Graphed metrics</strong> tab.</p>
</li>
<li><p>On the Statistics column, select <strong>Sum</strong>.</p>
</li>
<li><p>On the Period column, select <strong>1 Minute</strong>.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735624277959/08d15c22-05da-494b-a75d-439cbff39c8d.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-congratulations">Congratulations!!!</h3>
<p>You created an EFS file system, mounted it to an EC2 instance, and ran an I/O benchmark test to examine its performance characteristics.</p>
]]></content:encoded></item><item><title><![CDATA[Jenkins Installation and Configuration]]></title><description><![CDATA[Configure Jenkins on Ubuntu
Jenkins is an open-source automation server that helps automate the software development process. It is used for building, testing, and deploying software. It helps developers catch bugs early and release software faster.
...]]></description><link>https://blog.abishekgautam.com.np/jenkins-installation-and-configuration</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/jenkins-installation-and-configuration</guid><category><![CDATA[Jenkins]]></category><category><![CDATA[Jenkins-installation]]></category><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Tue, 10 Oct 2023 11:08:34 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1696935995717/69f5fca5-c593-4366-97e6-4013585e317e.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-configure-jenkins-on-ubuntu">Configure Jenkins on Ubuntu</h1>
<p>Jenkins is an open-source automation server that helps automate the software development process. It is used for building, testing, and deploying software. It helps developers catch bugs early and release software faster.</p>
<p>Some of the Benefits are:</p>
<ul>
<li><p>Easy to install and configure</p>
</li>
<li><p>Platform independent</p>
</li>
<li><p>Automates integration</p>
</li>
<li><p>Detects errors early</p>
</li>
<li><p>Rich plugin ecosystem</p>
</li>
<li><p>Open source</p>
</li>
<li><p>Great community support</p>
</li>
<li><p>Easy distribution</p>
</li>
</ul>
<p>Now, Let's begin the installation processes.</p>
<p>There are several steps to configure Jenkins on an Ubuntu machine:</p>
<ol>
<li>Install Java:</li>
</ol>
<p>Jenkins requires Java to run, so you'll first need to install OpenJDK. For Ubuntu 20.04 and later, install OpenJDK 11:</p>
<pre><code class="lang-bash">sudo apt install openjdk-11-jre
</code></pre>
<ol>
<li>Add the Jenkins repository:</li>
</ol>
<p>It's recommended to install Jenkins from the official Jenkins repository instead of the Ubuntu repository. This ensures you have the latest version.</p>
<pre><code class="lang-bash">curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee \
  /usr/share/keyrings/jenkins-keyring.asc &gt; /dev/null

sudo sh -c <span class="hljs-string">'echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/ &gt; /etc/apt/sources.list.d/jenkins.list'</span>
</code></pre>
<ol>
<li>Install Jenkins:</li>
</ol>
<pre><code class="lang-bash">sudo apt update
sudo apt install jenkins
</code></pre>
<ol>
<li>Start Jenkins:</li>
</ol>
<pre><code class="lang-bash">sudo systemctl start jenkins
</code></pre>
<ol>
<li>Open the firewall to port 8080:</li>
</ol>
<pre><code class="lang-bash">sudo ufw allow 8080
</code></pre>
<ol>
<li><p>Access Jenkins in your browser at <a target="_blank" href="http://localhost:8080"><code>http://localhost:8080</code></a></p>
</li>
<li><p>Get the initial admin password:</p>
</li>
</ol>
<pre><code class="lang-plaintext">sudo cat /var/lib/jenkins/secrets/initialAdminPassword
</code></pre>
<ol>
<li><p>Paste the password, choose plugins, and create your admin user.</p>
</li>
<li><p>Start using Jenkins! You can install more plugins, set up jobs, and configure your CI/CD pipelines.</p>
</li>
</ol>
<p>Congratulations!! start your CICD journey.</p>
]]></content:encoded></item><item><title><![CDATA[Connecting Amazon RDS To Visual Studio Code]]></title><description><![CDATA[Amazon RDS (Relational Database Service) is a managed database service provided by Amazon Web Services (AWS). It allows you to set up, operate, and scale a relational database in the cloud with ease. RDS supports several popular database engines, inc...]]></description><link>https://blog.abishekgautam.com.np/connecting-amazon-rds-to-visual-studio-code</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/connecting-amazon-rds-to-visual-studio-code</guid><category><![CDATA[amazon-rds]]></category><category><![CDATA[AWS RDS]]></category><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Tue, 13 Jun 2023 15:54:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1686671563312/72aa1370-9447-4113-9bc2-41e09ab3b623.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Amazon RDS (Relational Database Service)</strong> is a managed database service provided by Amazon Web Services (AWS). It allows you to set up, operate, and scale a relational database in the cloud with ease. RDS supports several popular database engines, including Amazon Aurora, MySQL, PostgreSQL, Oracle, and SQL Server.</p>
<h3 id="heading-lets-begin-the-demonstration"><strong><mark>Let's Begin the Demonstration</mark></strong></h3>
<p>Step 1: Go to the AWS management console, search for <strong>RDS</strong> and click on it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664150225/218f54fd-5460-4bd5-8cf3-b6124b0dadbe.png" alt class="image--center mx-auto" /></p>
<p>Step 2: Click on <strong>Create database</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664158567/61096baa-454b-46dd-b101-19d56adb7e8b.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Select the <strong>Standard create</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686668302902/81461889-b79a-47c6-8b68-8c521e24c496.png" alt class="image--center mx-auto" /></p>
<p>Step 3: From the <strong>Templates</strong>, select the <strong>Free tier</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664181055/2661820b-2534-497e-a017-564b79724192.png" alt class="image--center mx-auto" /></p>
<p>Step 4: Select <strong>MySQL</strong> from the <strong>Engine options</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664194324/0a484d8f-2554-4999-980c-9f08abdc315e.png" alt class="image--center mx-auto" /></p>
<p>Step 5: Under the <strong>Settings</strong></p>
<ul>
<li><p>Give a name to the <strong>database instance identifier</strong></p>
</li>
<li><p>enter the <strong>Master username and Password</strong>  <strong><mark>(Note it down, you need to remember this )</mark></strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686668621686/fcfe326f-1501-4cef-b995-a5b558cd1f73.png" alt /></p>
<p>Step 6: From the instance configuration, select <strong>Burstable classes</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664244001/02a07675-ac0d-4d24-8ae4-4b5c98113428.png" alt class="image--center mx-auto" /></p>
<p>Step 7: Under Storage select <strong>general purpose SSD(gp2)</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664263164/3f4bd5e6-7755-4f58-bda2-14229be5ec77.png" alt class="image--center mx-auto" /></p>
<p>Step 8: From the <strong>Connectivity,</strong></p>
<ul>
<li><p>select <strong>Don't connect to an EC2 compute resource.</strong></p>
</li>
<li><p>Select <strong>Default VPC,</strong> from the <strong>Virtual private cloud(VPC)</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664269211/4639ec9c-0b31-4b9f-8c06-74ee7ae51ef0.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p><strong>I</strong>n the <strong>Public access,</strong> select <strong>yes</strong></p>
</li>
<li><p>Under the <strong>VPC security group(firewall),</strong> you can choose existing or create new. For now, we create a new one and named it as <strong>“sec-group”</strong> and also selected <strong>“us-east-1a" Availability Zone.</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664283890/77a30091-0901-4cd8-a516-ea05e4e3ff2e.png" alt class="image--center mx-auto" /></p>
<p>Step 9: Under <strong>Database authentication</strong></p>
<ul>
<li>Choose <strong>Password authentication</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664293413/f974c664-e8d0-40db-9dfd-343be3f25ab5.png" alt class="image--center mx-auto" /></p>
<ul>
<li><strong>unselect,</strong> Enable Enhanced monitoring</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664298276/0786da6f-984b-401e-acf4-21d31c8fa9e8.png" alt class="image--center mx-auto" /></p>
<p>Step 10: In the <strong>Additional configuration</strong></p>
<ul>
<li><p>Give the <strong>initial database name. F</strong>or now say <strong>“worlddb”</strong> <mark>(NOTE the Database Name)</mark></p>
</li>
<li><p><strong>Unselect</strong> under Backup and Encryption</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664327764/22f68612-624d-401b-9eb1-6342cf14772b.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Unselect <strong>Enable auto minor version upgrade,</strong> under <strong>Maintenance</strong></p>
</li>
<li><p>Select <strong>no preference</strong> under <strong>Maintenance window</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664335726/ec377503-dd2d-44c2-8739-40bb22c7b528.png" alt class="image--center mx-auto" /></p>
<p>Step 11: Click on <strong>Create database</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686671740616/f67fea74-7318-48bb-b163-afdf1f0a9098.png" alt /></p>
<p>Step 12: You  need to have pre-installed <strong>SQLTools</strong> and <strong>SQL Server(mssql)</strong></p>
<ul>
<li>below the extensions click on <strong>SQLTools</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664349317/10d6f606-ad59-452c-b5d9-9d5a9061de16.png" alt /></p>
<p>Step 13: From the <strong>connections</strong> click on <strong>Add New Connections icon.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664363872/f834c453-068b-4c54-a6cf-9e81ef65b0fd.png" alt /></p>
<p>Step 14: Select <strong>MySQL</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664369152/c990c23c-043b-418a-81dc-15c38c32d37d.png" alt /></p>
<p>Step 15: From the database under <strong>Connectivity and security</strong> copy the <strong>endpoint</strong> address.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664375087/94e293e9-bc65-4874-a679-40667acac3ea.png" alt /></p>
<p>Step 16: In the VS code under Connection Settings</p>
<ul>
<li><p>Give a name to the connection let’s say: <strong>"justconnecting"</strong></p>
</li>
<li><p>in the Server Address: Paste the endpoint address.</p>
</li>
<li><p>Enter the database name, that you have created in the AWS RDS as <strong><mark>“initial database”</mark></strong> and noted down.</p>
</li>
<li><p>Enter the database <strong><mark>Master</mark></strong> <strong><mark>username, </mark></strong> </p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664379003/83fa56ab-8f13-48af-9127-881d2695d58c.png" alt /></p>
<ul>
<li>Click on <strong>TEST CONNECTION</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664384016/71e43daf-7b15-4faf-9d4f-9254ae3f9bcf.png" alt /></p>
<ul>
<li>Click on <strong>Allow</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664387933/337a9e0f-72eb-400a-93ad-3ff574a295cb.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Enter the <strong>Master</strong> <strong>Password</strong> that you have noted down.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664391640/232d77ba-8258-4329-a11a-89e164297585.png" alt class="image--center mx-auto" /></p>
<ul>
<li>You should be able to see the <strong>Sucessfully connected</strong> Messagae. And click on <strong>SAVE CONNECTION</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664395940/1a1b459f-6808-4cb0-9767-0ba61f29cbac.png" alt /></p>
<ul>
<li>Click on <strong>CONNECT NOW</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664399182/60c27f89-f9a8-49c6-93d5-832e41ef4f11.png" alt /></p>
<ul>
<li>Now, you should be able to see the connections and Database below <strong>CONNECTIONS</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664403669/7f89de62-0001-490d-a10a-8520eee64fb3.png" alt /></p>
<ul>
<li><p>Now click on the New SQL File on the right side on connetions</p>
</li>
<li><p>Enter the below query</p>
<pre><code class="lang-sql">  <span class="hljs-keyword">use</span> worlddb;
  <span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">TABLE</span> student(
      <span class="hljs-keyword">Id</span> <span class="hljs-built_in">int</span>, 
      <span class="hljs-keyword">Name</span> <span class="hljs-built_in">VARCHAR</span>(<span class="hljs-number">20</span>)
      );
  <span class="hljs-keyword">INSERT</span> <span class="hljs-keyword">INTO</span> student(<span class="hljs-keyword">Id</span>, <span class="hljs-keyword">Name</span>) 
  <span class="hljs-keyword">VALUES</span>(<span class="hljs-number">1</span>, <span class="hljs-string">'Abi'</span>),
  (<span class="hljs-number">2</span>, <span class="hljs-string">'Gaurav'</span>);

  <span class="hljs-keyword">SELECT</span> * <span class="hljs-keyword">FROM</span> student;
</code></pre>
</li>
<li><p>Run the query using pressing <strong>CTRL+ E+E</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686664407293/4c8e81e4-0029-41ce-85fe-c2f466104650.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-congratulations">CONGRATULATIONS!!!</h3>
<p>You have successfully connected the AWS RDS to your Visual Studio Code.</p>
]]></content:encoded></item><item><title><![CDATA[Demonstration of VPC Peering.]]></title><description><![CDATA[VPC peering is a valuable networking connection that enables two distinct VPCs to securely share resources creating the illusion of being on the same network.
This capability is crucial as it provides a cost-effective solution for resource sharing be...]]></description><link>https://blog.abishekgautam.com.np/demonstration-of-vpc-peering</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/demonstration-of-vpc-peering</guid><category><![CDATA[vpc peering]]></category><category><![CDATA[EC2 instance]]></category><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Sun, 11 Jun 2023 16:52:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1688665177274/36865392-5f37-49e6-90a6-bbc19247028c.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>VPC peering</strong> is a valuable networking connection that enables two distinct VPCs to securely share resources creating the illusion of being on the same network.</p>
<p>This capability is crucial as it provides a cost-effective solution for resource sharing between multiple VPCs located in the same or different regions eliminating the need for internet gateways. Additionally, by not relying on public IP addresses or internet access VPC peering enhances security measures.</p>
<h3 id="heading-lets-begin-the-demonstration"><mark>Let's begin the Demonstration.</mark></h3>
<p>Step 1: Go to the <strong>AWS management console</strong> search for <strong>VPC</strong>, and click on it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686489776937/2882fd1c-5db7-402f-a2c7-2db2ad4d6857.png" alt class="image--center mx-auto" /></p>
<p>Step 2: Click on <strong>Create VPC.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686489783377/fc3f6fb5-bdcb-4086-9ce8-a21f62414c62.png" alt /></p>
<p>Step 3: From <strong>VPC settings</strong></p>
<ul>
<li><p>select <strong>VPC only</strong></p>
</li>
<li><p>Enter the name of VPC. For now, say <strong><mark>“my-vpc1"</mark></strong></p>
</li>
<li><p>Enter IPv4 CIDR <mark>10.0.0.0 /16</mark></p>
</li>
<li><p>Click on <strong>Create VPC</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686489796705/65038927-fd90-473d-8c6e-f6a654b4f161.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686489799319/4d25d2db-6cf9-4edc-bda2-6611b8e7364c.png" alt /></p>
<p>Step 4: From the <strong>Dashboard</strong>, select <strong>Subnets</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686489804791/b838d55f-3ee7-4618-989d-d8066f4bef82.png" alt /></p>
<ul>
<li>click on <strong>Create subnet</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686489808403/a9c5f586-0697-4edc-af94-b7d259030de9.png" alt /></p>
<p>Step 5: From VPC ID select <mark>“my-vpc1" </mark> </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686489812653/cc23ffbc-2c23-458c-b479-fc697dcc50d5.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Give a name to the subnet. For now let’s say, <strong><mark>“subnet01”</mark></strong></p>
</li>
<li><p>Select an Availability zone: "<strong>us-east-1a"</strong></p>
</li>
<li><p>Enter the CIDR block say, <strong><mark>10.0.1.0/24</mark></strong></p>
</li>
<li><p>Click on <strong>Create subnet.</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686489816741/c1dd37b7-22d3-439d-99b0-dee3214a3667.png" alt class="image--center mx-auto" /></p>
<p>Step 6: From the <strong>Dashboard</strong>,  Select <strong>Internet gateway</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686489819819/a43ab527-0c31-40e4-9262-0495c1ae6a0e.png" alt /></p>
<ul>
<li>click on <strong>Create Internet gateway</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686489824359/e89d53c0-7544-4c91-91d4-1be5596146f6.png" alt /></p>
<p>Step 7: In the Internet gateway settings</p>
<ul>
<li><p>give a Name tag, let’s say <mark>"</mark><strong><mark>internet-gateway"</mark></strong></p>
</li>
<li><p>click on <strong>Create Internet gateway</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686489946632/ff07b6d5-0b83-4aee-b37c-774d06654ca0.png" alt class="image--center mx-auto" /></p>
<p>Step 8: On the top, you can see the <mark>“</mark><strong><mark>Attach to a VPC”</mark></strong> message, <strong>Click on it</strong> or you can attach it from the <strong>Action.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686489832587/3a722505-e89a-450e-9dae-c364cd6226cb.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686489839619/52af0719-8348-42cf-805a-12af2cd56b2a.png" alt class="image--center mx-auto" /></p>
<p>Step 9: We will create another VPC. From the dashboard, Select <strong>“Your VPCs”</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490035226/95339e95-7f7d-4670-95ff-895c8d15239a.png" alt /></p>
<ul>
<li>Click on <strong>Create VPC</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490044829/529aea0c-2099-4db8-beda-24f0625cd34c.png" alt /></p>
<ul>
<li><p>under <strong>VPC Settings</strong>, Select <strong>VPC only</strong></p>
</li>
<li><p>Enter the IPv4 CIDR block say, <strong><mark>192.0.0.0/16</mark></strong></p>
</li>
<li><p>Click on <strong>Create VPC.</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490060398/5087eb01-bc5d-406c-a640-6a560fe683ae.png" alt class="image--center mx-auto" /></p>
<p>Step 10: From the dashboard select <strong>Subnets</strong>, click on <strong>Create subnet</strong></p>
<ul>
<li>under VPC ID select <strong>“my-vpc2"</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490070714/f0429550-4363-48a9-a128-e263bdc9ae69.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Give a name to the subnet. For now let’s say, <mark>“subnet2”</mark></p>
</li>
<li><p>select an Availability zone say, <strong>"us-east-1a"</strong></p>
</li>
<li><p>Enter the CIDR block say, <mark>192.0.1.0/24</mark></p>
</li>
<li><p>Click on <strong>Create subnet</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490090435/7307804f-21ae-4c71-9713-627abe805ffc.png" alt class="image--center mx-auto" /></p>
<p>Step 11: From the dashboard, select <strong>“Peering connections</strong>”</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490099693/2cb4fac9-4ad7-412b-9f91-fffcf31d5310.png" alt /></p>
<ul>
<li>click on <strong>Create peering connection</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490166766/dfc997f9-c824-44bf-8fcb-efd33eba4208.png" alt /></p>
<p>Step 12: In peering connection settings</p>
<ul>
<li><p>give a name to the connection say, <strong><mark>“my-connection"</mark></strong></p>
</li>
<li><p>Select <strong>“my-vpc1”</strong> In the <strong>VPC ID (Request</strong>er)</p>
</li>
<li><p>Select <strong>“my-vpc2”</strong> in the <strong>VPC ID (Accepter)</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490172314/84434998-88d6-447e-9119-9b6ad94c4c7e.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490182005/a5beacb4-b9f7-4a8b-836a-daf967e88583.png" alt class="image--center mx-auto" /></p>
<ul>
<li>click on <strong>Create peering connection</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490202534/02188c15-796b-4f2b-9aa1-a49e83d5bc57.png" alt /></p>
<p>step 13: Now you can see <strong>Actions</strong> in “<strong>my-connection"</strong></p>
<ul>
<li>Click on it and <strong>Accept request</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490210109/d4bbafe9-7bca-4254-98a2-c4ff95a567fa.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490219865/9b2afbd3-a7ff-4575-aca8-9c2b2f7601f8.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490227208/de4b2a2f-3edc-481c-924d-f24617f81b99.png" alt class="image--center mx-auto" /></p>
<p>Step 13: From the dashboard, Select <strong>"Route tables"</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686489857190/91b6f42a-a3c3-4209-b802-cb2e0059a44b.png" alt /></p>
<p>step 15: In the <strong>Route table settings</strong></p>
<ul>
<li><p>Give a name say, <strong><mark>“routeTable1”</mark></strong></p>
</li>
<li><p>Select “<strong>my-vpc1"</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490004114/63d4561d-ad29-4a21-847d-99a29926fcd8.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Click on <strong>Create route table</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490012057/713ca690-fd69-4dbf-8993-b65aa362aa17.png" alt /></p>
<p>step 16: Select <strong>“routeTable1”</strong>, from the <strong>Route tables.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490376368/8b08f506-5bed-4b1c-9c9f-c2348c96beb7.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Click on <strong>Routes</strong></p>
</li>
<li><p>click on <strong>Edit routes</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490383103/191abbc2-da3c-4138-b074-57137a31ced4.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>click on Add route</p>
</li>
<li><p>under Destination enter <strong><mark>0.0.0.0/16</mark></strong> and select the <strong><mark>Internet gateway</mark></strong> in Target.</p>
</li>
<li><p>Similarly, add <strong><mark>192.0.0.0/16</mark></strong> in Destination and select <strong><mark>Peering connections</mark></strong></p>
</li>
<li><p>Click on <strong>Save changes</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490389932/efd47a0e-cc4a-48d9-9858-5d828659be04.png" alt class="image--center mx-auto" /></p>
<p>Step 17: Select the <strong>Subnet associations</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490401960/5dff4d66-066a-4dc0-9c13-1b8999fc745a.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>click on <strong>Edit subnet associations</strong></p>
</li>
<li><p>select the "<strong>subnet01"</strong></p>
</li>
<li><p>click on <strong>Save associations.</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490410261/1cf032f4-9de1-4e57-840b-27f7c0895d42.png" alt class="image--center mx-auto" /></p>
<p>Step 18: we need to create another route table. so, from the dashboard, Select <strong>Route table.</strong> Under route table settings</p>
<ul>
<li><p>Give a name to the table say, <strong><mark>"routeTable2</mark></strong><mark>"</mark></p>
</li>
<li><p>select the second VPC created, <strong>“my-vpc2”</strong></p>
</li>
<li><p>Click on <strong>Create route table</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490300967/384f4ec7-f075-4244-b465-3696b71b3a8d.png" alt class="image--center mx-auto" /></p>
<p>Step 19: Select the <strong>routeTable2</strong></p>
<ul>
<li><p>click on <strong>Routes</strong></p>
</li>
<li><p>click on <strong>Edit routes</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490313391/5c27dea8-e4d2-4955-8258-0250c52ae680.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>click on <strong>Add route</strong></p>
</li>
<li><p>enter <strong><mark>10.0.0.0/16</mark></strong> in the <strong>Destination</strong> and select <strong><mark>pairing connections</mark></strong> in the <strong>target.</strong></p>
</li>
<li><p>click on <strong>Save associations</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490327843/de5ffb2a-9043-40fd-b637-52e56e2cd41e.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>click on the <strong>Subnet associations</strong></p>
</li>
<li><p>click on <strong>Edit subnet associations</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490336046/7585f37e-9500-45e5-bbfe-f7d5ce15884b.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>select the <strong>subnet2</strong></p>
</li>
<li><p>click on <strong>Save associations.</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490343674/2cf62831-25e7-40c0-9bec-4fbcff714c17.png" alt class="image--center mx-auto" /></p>
<p>Step 20: From the <strong>AWS management console,</strong> Search <strong>EC2</strong> and <strong>click on it.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490433776/a13b5433-eeff-4359-8f0c-f771257aa1fc.png" alt class="image--center mx-auto" /></p>
<p>Step 21: Click on <strong>Launch instance</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490439026/9460c3d0-e5fc-4645-8031-14c75d0ee3d7.png" alt /></p>
<p>Step 22: Give a name to the instance, say <strong><mark>"myserver1"</mark></strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490443705/f40ddf56-015a-4078-9aa2-28e36b5e5de6.png" alt class="image--center mx-auto" /></p>
<ul>
<li>select the existing <strong>key pair</strong> or <strong>create a new key pair</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490446068/3054c980-0412-4a23-84fc-33b8f4684ddf.png" alt class="image--center mx-auto" /></p>
<p>Step 23: in the network settings, click on <strong>Edit</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490930971/58e0bbf3-08d4-46a8-b8ca-950f14faffb0.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Select your first VPC, <strong>“my-vpc1”</strong></p>
</li>
<li><p>select the subnet, <strong>“subnet01”</strong></p>
</li>
<li><p><strong>“Enable”,</strong> Auto-assign public IP</p>
</li>
<li><p>Leave the other setting as the default</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490453076/81e3ede3-0c9c-4d16-b2d1-d62357deb01e.png" alt class="image--center mx-auto" /></p>
<p>step 24: Click on <strong>launch instance</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490456831/fb7d8b29-44a0-4ae4-9457-5760a17899bf.png" alt /></p>
<p>step 25: We will create another instance named <strong>“myserver2”</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490460166/631b4b8f-875d-44b1-8940-3ed4336b7b9e.png" alt class="image--center mx-auto" /></p>
<ul>
<li>select the <strong>Key pair (login)</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490463961/322b8092-9514-4ae9-b6ef-423b6da68a82.png" alt class="image--center mx-auto" /></p>
<p>Step 26: In the network settings, click on <strong>Edit</strong></p>
<ul>
<li><p>select the second VPC created, <strong>“my-vpc2"</strong></p>
</li>
<li><p>select the subnet, <strong>“subnet2”</strong></p>
</li>
<li><p><strong>Disable,</strong> Auto-assign public IP</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490805042/9d445824-c7dc-4049-882d-0229c6497360.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Under <strong>Firewall(security groups)</strong>, Select the <strong>create security group</strong></p>
</li>
<li><p>You can give the name of the Security group and Description or leave it as the default</p>
</li>
<li><p>In the <strong>inbound security groups rules</strong></p>
</li>
<li><p>Under <strong>Type</strong> select <strong>“All traffic” or “All ICMP”</strong> and under <strong>Source type</strong> select <strong>“Anywhere”</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490471905/000ca6a3-06f8-4200-8a32-2b1ac2aa0ef1.png" alt class="image--center mx-auto" /></p>
<p>Step 27: Click on <strong>Launch instance</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686490559902/dfc8f25c-6311-420a-a3dd-92b9bf20d890.png" alt /></p>
<ul>
<li>From the Instance summary of <strong>“myserver2”,</strong> Copy the <strong>Private IPv4 addresses</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686491010865/3b8c4a35-9046-4da6-a4a1-93914892d358.png" alt class="image--center mx-auto" /></p>
<p>Step 28: In the <strong>Instances,</strong> you can see the two servers running</p>
<ul>
<li><p>select the <strong>“myserver1”</strong></p>
</li>
<li><p>Click on <strong>Connect,</strong> on the right side of the instances.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686491015209/b950a27a-2861-4629-84aa-1f5653aab5d8.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Select the <strong>EC2 Instance Connect</strong></p>
</li>
<li><p>Click on <strong>Connect.</strong></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686491018455/7bce2360-db61-49c5-887e-b2d6a2e43187.png" alt class="image--center mx-auto" /></p>
<p>Step 29: <strong>Ping</strong> the <strong>my-server2</strong> private IP address.</p>
<pre><code class="lang-bash">ping &lt;private ip addresses&gt;
</code></pre>
<p>Step 30: you should see the following output.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686491024976/42796558-a0e7-45d1-a518-48fd4e0aba73.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-congratulations">Congratulations!!!</h3>
<p>You have completed the Demonstration of VPC Peering.</p>
]]></content:encoded></item><item><title><![CDATA[How can we Monitor an EC2 Instance?]]></title><description><![CDATA[In this Demonstration we will set up an instance on Amazon Elastic Compute Cloud and create a Amazon CloudWatch alarm which will be triggered, when the CPU utilization of the EC2 instance exceeds a threshold and set up a subscription using Amazon Sim...]]></description><link>https://blog.abishekgautam.com.np/how-can-we-monitor-an-ec2-instance</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/how-can-we-monitor-an-ec2-instance</guid><category><![CDATA[ec2]]></category><category><![CDATA[#CloudWatch]]></category><category><![CDATA[AWS SNS]]></category><category><![CDATA[EC2 instance]]></category><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Tue, 30 May 2023 18:15:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1685552373634/f9da7ac6-eb1a-4a25-86b7-0bf2508d4259.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this Demonstration we will set up an instance on Amazon Elastic Compute Cloud and create a Amazon CloudWatch alarm which will be triggered, when the CPU utilization of the EC2 instance exceeds a threshold and set up a subscription using Amazon Simple Notification Service (SNS) to receive email notifications.</p>
<p><strong>Logging and monitoring</strong> are techniques used to achieve goals. They work together to ensure that system performance meets baselines and security guidelines consistently.</p>
<p><strong>Amazon SNS</strong> is a managed messaging service that enables communication.</p>
<p><strong>CloudWatch</strong> is a monitoring and observability service. It provides data and insights for monitoring applications responding to performance changes across systems and optimizing resource utilization. CloudWatch collects logs, metrics and events as part of its monitoring data collection process. By using CloudWatch you can have a view of your health and gain visibility into your AWS resources, applications and services running both on AWS and, on premises.</p>
<h2 id="heading-objectives">Objectives:</h2>
<p>After completing this Demonstration, you will be able to:</p>
<ul>
<li><p>Create an Amazon EC2 instance</p>
</li>
<li><p>Create an Amazon SNS notification</p>
</li>
<li><p>Configure a CloudWatch alarm</p>
</li>
<li><p>Stress test an EC2 instance</p>
</li>
<li><p>Confirm that an Amazon SNS email was sent</p>
</li>
<li><p>Create a CloudWatch dashboard</p>
</li>
</ul>
<h3 id="heading-lets-begin-the-demonstration">Let's begin the Demonstration:</h3>
<h3 id="heading-task-1create-an-amazon-ec2-instance"><mark>TASK 1:Create an Amazon EC2 Instance.</mark></h3>
<p>Step 1: Go to the management console and Search for Ec2 and click on it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426123718/995c19a1-e9cb-47c7-b513-ab9c3602c3ee.png" alt class="image--center mx-auto" /></p>
<p>Step 2: Give a Name to the instance. for now, we name it "<mark>Stress Test</mark>".</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426130172/6dae8734-faee-460c-908f-34912f2eebae.png" alt class="image--center mx-auto" /></p>
<ul>
<li>choose an Amazon Machine Image for now we choose Amazon Linux 2 AMI (HVM). <mark>Recommend you choose (Free tier eligible)</mark></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426132847/0065b03d-cd8d-41c0-a85e-9d0729b1f23e.png" alt class="image--center mx-auto" /></p>
<p>Step 3: For the key pair(login) we proceed without a key pair. You could choose an existing or create new key pair.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426139620/9bf0f39d-6679-4186-b706-2124bc578f8e.png" alt class="image--center mx-auto" /></p>
<p>Step 4: you could leave other settings default and click on Launch instance</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426144200/d8d8ca72-df09-47ca-b2fc-14cedc96a0cd.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-task-2configure-amazon-sns"><mark>TASK 2:Configure Amazon SNS</mark></h3>
<p>Step 3: Go to the management console and Search For SNS</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426149397/2d1cc38f-84f6-4717-9047-58e771cd8830.png" alt class="image--center mx-auto" /></p>
<p>Step 4: On the left, under Dashboard choose the Topics, and then choose Create topic.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426274462/bfb9e479-b850-44ab-b804-f388260c13c8.png" alt class="image--center mx-auto" /></p>
<p>Step 5: On the Create topic page in the Details section, configure the following options:</p>
<ul>
<li><p>Type: Choose Standard.</p>
</li>
<li><p>Name: Enter the name. For now, we say <mark>"MyCwAlarm"</mark></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426279543/e9bf5092-3410-47c4-9525-0d5bcddc274d.png" alt class="image--center mx-auto" /></p>
<p>Step 6: Choose <strong>Create topic</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426283012/0fc3557a-2710-440c-8667-e53641833fa6.png" alt /></p>
<p>Step 7: On the MyCwAlarm details page, choose the Subscriptions tab, and then choose <mark>Create subscription.</mark></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426287755/0d17207b-b3c5-40c4-a7e1-c41f88c359c8.png" alt class="image--center mx-auto" /></p>
<p>Step 8: In the <strong>Details</strong> section, configure the following options:</p>
<ul>
<li><p><strong>Topic ARN</strong>: Leave the default option selected.</p>
</li>
<li><p><strong>Protocol</strong>: From the dropdown list, choose <strong>Email</strong>.</p>
</li>
<li><p><strong>Endpoint</strong>: Enter a valid email address that you have.</p>
</li>
</ul>
<p>and Click on <mark>Create subscription.</mark></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426292778/48efb518-c971-4bfb-b429-e1bf4ee239fe.png" alt class="image--center mx-auto" /></p>
<ul>
<li>In the <strong>Details</strong> section, the <strong>Status</strong> should be <strong>Pending confirmation</strong>.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426296414/9a9416ea-e7cd-4bf9-8afc-80f9abe3070d.png" alt class="image--center mx-auto" /></p>
<ul>
<li>You should have received an <strong>AWS Notification - Subscription Confirmation</strong> email message at the email address that you provided in the previous step.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426300783/53995252-d08e-44f9-93b7-9b4ebbe5ae95.png" alt class="image--center mx-auto" /></p>
<ul>
<li>After you click on the <mark>Confirm subscription</mark> from the mail, In the <strong>Details</strong> section, the <strong>Status</strong> should be <mark>Confirmed.</mark></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426307550/abce8236-04da-4616-96ce-76946381ee6c.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-task-3-create-a-cloudwatch-alarm"><mark>Task 3: Create a CloudWatch alarm</mark></h2>
<p>Step 9: In the AWS Management Console, enter <strong>Cloudwatch</strong> in the search bar, and then choose it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426311421/f1935103-0a71-4666-b349-6efdee27d406.png" alt class="image--center mx-auto" /></p>
<p>Step 10: In the left navigation pane, choose the <strong>Metrics</strong> dropdown list, and then choose <strong>All metrics</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426360362/92f1fc02-571d-484c-9882-6a44bff50152.png" alt /></p>
<p>Step 11: On the <strong>Metrics</strong> page, choose <strong>EC2</strong>, and choose <strong>Per-Instance Metrics</strong>.From this page, you can view all the metrics being logged and the specific EC2 instance for the metrics.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426364825/adb8e9e5-148c-4601-97cd-dcd3ebc81dff.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426367691/9e8c597a-376c-4c67-8a83-ca765a3f973f.png" alt class="image--center mx-auto" /></p>
<p>Step 12: Slect the ­check box with <strong>CPUUtilization</strong> as the <strong>Metric name</strong> for the <strong>Stress Test</strong> EC2 instance that we created.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426371944/6f4bab41-deaa-496c-82f3-2bee5bbbd29e.png" alt class="image--center mx-auto" /></p>
<p>Step 13: In the left navigation pane, choose the <strong>Alarms</strong> dropdown list, and then choose <strong>All alarms.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426375722/86c71a24-af0d-4e82-8159-38b0a018d088.png" alt /></p>
<p>Step 14: Choose <mark>Create alarm.</mark></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426379234/23cd2631-9ea7-4528-8e0a-2ab592ae4c2c.png" alt class="image--center mx-auto" /></p>
<p>Step 15: Choose <strong>Select metric and click on Next</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426382151/05c04442-b9d0-4bf2-9cdd-c560664cc93e.png" alt class="image--center mx-auto" /></p>
<p>Step 16: choose <strong>EC2</strong>, and then choose <strong>Per-Instance Metrics</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426386439/90856d31-e332-4b83-b8d8-4fcd58644b65.png" alt class="image--center mx-auto" /></p>
<p>Step 17: Under the Search bar type <strong>CPUUtilization</strong> and hit Enter.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426389123/be593567-ec55-4d34-a0fb-86832245f4cd.png" alt class="image--center mx-auto" /></p>
<p>Step 18: Select the Stress Test and Click on <mark>Select metric.</mark></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426391684/b55d3e89-637f-4573-91cb-e1af34b007a5.png" alt class="image--center mx-auto" /></p>
<p>Step 19: On the <strong>Specify metric and conditions</strong> page, configure the following options:</p>
<h3 id="heading-metric">Metric</h3>
<ul>
<li><p>Metric name: Enter CPUUtilization</p>
</li>
<li><p>InstanceId: Leave the default option selected.</p>
</li>
<li><p>Statistic: Select Average</p>
</li>
<li><p>Period: From the dropdown list, choose 5minute.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685545991617/9f931010-3744-4888-b6c4-c9263a8062f4.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-conditions">Conditions</h3>
<ul>
<li><p>Threshold type: Choose Static.</p>
</li>
<li><p>Whenever CPUUtilization is...: Choose Greater &gt; threshold.</p>
</li>
<li><p>than... Define the threshold value: Enter 60</p>
</li>
</ul>
<p>and Click on <mark>Next.</mark></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685546076513/0d3dbada-835d-4fa8-88ac-f8ee9342b69f.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-notification">Notification</h3>
<ul>
<li><p>Alarm state trigger: Choose In alarm.</p>
</li>
<li><p>Select an SNS topic: Choose Select an existing SNS topic.</p>
</li>
<li><p>Send a notification to...: Choose the text box, and then choose MyCwAlarm.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685546094501/29670c94-3001-49e7-8063-415c65ad2bd5.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-name-and-description">Name and description</h3>
<ul>
<li><p>Alarm name: Enter CPUUtilizationAlarm</p>
</li>
<li><p>Alarm description - optional: Enter CloudWatch alarm for Stress Test EC2 instance CPUUtilization</p>
</li>
</ul>
<p>After that Choose <mark>Next.</mark></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685546126914/52273ed9-db84-4aba-b0e4-39db1182ccb3.png" alt class="image--center mx-auto" /></p>
<p>Step 20: Review the Preview and create page, and then choose <mark>Create alarm.</mark></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426395282/c36d0aee-d386-4df5-abad-653c0b2b8e3a.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-task-4-test-the-cloudwatch-alarm"><mark>Task 4: Test the Cloudwatch alarm</mark></h2>
<p>Step 21: In the management Console search for <strong>EC2</strong> and click on it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685547136316/6495e371-0de6-4641-a00c-04e2a6421fc0.png" alt class="image--center mx-auto" /></p>
<p>Step 22: Now, under the <strong>Instances</strong> Click on the <strong>Stress Test</strong> Instance that we created earlier and Click on <strong>Connect</strong> on the right side of Instances,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685547144975/e0b5d96f-fb50-4a2c-a247-23e3979d7d49.png" alt class="image--center mx-auto" /></p>
<p>Step 23: From the <strong>Connect to instance</strong> Choose <strong>Session Manager</strong> and Click on <strong>Connect.</strong></p>
<p>(Note: you can connect from EC2 Instance Connect as the ultimate goal is to increase the Cpu utilization so that we get notified from the Amazon SNS through mail.)</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685547360748/21ff7d78-3c1d-4424-9e99-0a5fb3762b05.png" alt class="image--center mx-auto" /></p>
<p>Step 24: To manually increase the CPU load of the EC2 instance, run the following command:</p>
<pre><code class="lang-bash">sudo stress --cpu 10 -v --timeout 200s
</code></pre>
<ul>
<li>the output from the command should look similar to the following.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685547367524/e3e95659-bb99-41f5-82a7-8a676a0dad22.png" alt class="image--center mx-auto" /></p>
<p>Step 25: Navigate back to the AWS console where you have the CloudWatch Alarms page open. Then Choose <mark>CPUUtilizationAlarm</mark> after that Monitor the graph while selecting the refresh button every 1 minute until the alarm status is <mark>In alarm.</mark></p>
<p>On the graph, you can see where CPUUtilization has increased above the 60 percent threshold.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685548433876/163a8af9-20cc-4fd8-bce5-ba35be5c7ad0.png" alt class="image--center mx-auto" /></p>
<p>Step 26: Go to your email inbox for the email address that you used to configure the Amazon SNS subscription. You should see a new email notification from AWS Notifications like this below.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685547232242/637f24be-e02f-49fe-8ba7-233af07da65d.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-task-5-create-a-cloudwatch-dashboard"><mark>Task 5: Create a CloudWatch dashboard</mark></h2>
<p>Step 27: Go to the <strong>CloudWatch</strong> in the AWS console and In the left navigation plane, choose <strong>Dashboards</strong> and Click on <strong><mark>Create dashboard.</mark></strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426429059/7ff70b4e-c424-44be-b3bc-308964f0e5ae.png" alt class="image--center mx-auto" /></p>
<p>Step 28: Give a name to the Dashboard for now we say it <strong>EC2Dashboard</strong> and click on <strong>Create dashboard.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426432288/3e1462a4-aa52-468c-a024-792bcf43df1e.png" alt class="image--center mx-auto" /></p>
<p>Step 29: Under Add widget choose <mark>Line</mark> and click on <strong>Next.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426438468/25dabe52-dcd7-4a7a-ad5b-781ab11aa805.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Choose <strong>Metrics</strong> and click on Next.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426445358/0e998e89-0541-4c56-8986-c349daca7693.png" alt class="image--center mx-auto" /></p>
<p>Step 30: Now, Choose <strong>EC2</strong> and then <strong>Per-instance Metrics.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426448214/3e9dcf71-13b0-448e-aa88-da6124371000.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426450602/895aa42f-531b-4146-978c-8fa223fd6fc7.png" alt class="image--center mx-auto" /></p>
<p>Step 31: Under the search bar type <strong>CPUUtilization</strong> and select the <strong>Stress Test,</strong> and Click on <strong>Create widget.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426453166/8a533b15-a726-43a3-b64d-3f5b8abe1d31.png" alt class="image--center mx-auto" /></p>
<p>Step 32: Finally, you can see the CPUUtilization of an Instance.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685426476002/7d436f51-894b-483f-b3e4-d8e51af63647.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-congratulations"><strong>Congratulations!</strong>!!</h3>
<p>You now have successfully:</p>
<ul>
<li><p>Created an Amazon SNS notification</p>
</li>
<li><p>Configured a Cloudwatch alarm</p>
</li>
<li><p>Stress-tested an EC2 instance</p>
</li>
<li><p>Confirmed that an Amazon SNS email was sent.</p>
</li>
<li><p>created a CloudWatch dashboard</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Demonstration of AWS Certificate Manager with Elastic Load Balancer and Route 53.]]></title><description><![CDATA[AWS Certificate Manager (ACM): Elastic Load Balancing, Amazon CloudFront, Amazon API Gateway, and other integrated AWS services are used to install ACM certificates. The most common application for this type is a secure public website with high traff...]]></description><link>https://blog.abishekgautam.com.np/demonstration-of-aws-certificate-manager-with-elastic-load-balancer-and-route-53</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/demonstration-of-aws-certificate-manager-with-elastic-load-balancer-and-route-53</guid><category><![CDATA[ACM]]></category><category><![CDATA[aws certificate manager]]></category><category><![CDATA[SSL/TLS]]></category><category><![CDATA[Load Balancing]]></category><category><![CDATA[route53]]></category><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Sat, 27 May 2023 18:15:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1685208738683/41e4a519-034d-4a3d-a108-ab41cec22ab6.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>AWS Certificate Manager (ACM):</strong> Elastic Load Balancing, Amazon CloudFront, Amazon API Gateway, and other integrated AWS services are used to install ACM certificates. The most common application for this type is a secure public website with high traffic demands. ACM also facilitates security administration by automating certificate renewal. It enhances the overall performance, reliability, and fault tolerance of applications deployed in AWS environments. Route 53 is used for managing DNS configurations and domain settings. It provides a powerful API that allows users to programmatically automate DNS management tasks.</p>
<h3 id="heading-prerequisite"><strong>Prerequisite</strong></h3>
<ul>
<li><p>Before proceeding with ACM please make sure you have a domain name.</p>
</li>
<li><p>you should be able to create an EC2 Instance (if you don't know, you can read my blog <a target="_blank" href="https://blog.abishekgautam.com.np/how-to-host-a-static-website-in-aws-ec2">click here</a>)</p>
</li>
</ul>
<h2 id="heading-lets-begin-the-demonstration">Let's begin the Demonstration</h2>
<p><strong>Step 1:</strong> You need to create an EC2 instance that contains user data. If you don't know you can read out my blog. For now, we have created an instance named "Demo server".</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684944239613/b44d7ac3-1efb-4a3d-9801-76e8fbac11c0.png" alt class="image--center mx-auto" /></p>
<ul>
<li>copy and paste the public IPv4 address in the browser.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945185417/f7c4929c-8da2-4099-a559-4c56473da46c.png" alt class="image--center mx-auto" /></p>
<ul>
<li>you can see the website being hosted</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945217990/2f41b005-3225-4a06-a76f-208d92246b9b.png" alt class="image--center mx-auto" /></p>
<ul>
<li>but it's not secure you can see that "connection not secure"</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945340381/00e5b5ab-e3d2-41fb-a102-3de8376bfd2f.png" alt class="image--center mx-auto" /></p>
<ul>
<li>so, when we try to put the https:// for the secure connection it says unable to connect.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945407319/a7b467b2-4a1f-4b60-bf49-0d441c0aff39.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 2:</strong> On the management console search for <mark>Certificate Manager</mark> and click on it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945437256/cee0cb69-6364-43c4-a840-4617a11c9047.png" alt class="image--center mx-auto" /></p>
<ul>
<li>now select the "<strong>Request a certificate</strong>" button.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945442789/501769d3-019c-4e64-bd65-a75ba60e3180.png" alt class="image--center mx-auto" /></p>
<ul>
<li>under the <strong>Certificate type</strong> choose <strong>Request a public certificate</strong> and click on <strong>Next</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945447104/e3736f4c-d6d4-477d-8d10-79102db74027.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 3:</strong> Under the Domain names give a domain name or sub-domain that you want the users to use for accessing the website and choose the DNS validation,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684950910268/8b312215-95fd-44da-b6f3-f96e2407486d.png" alt class="image--center mx-auto" /></p>
<ul>
<li>leave the Key algorithm as default and click on the <strong>Request</strong> button.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945452093/ddc242ca-0a9d-44db-b0c9-b798cf3abd78.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 4:</strong> You can see that <strong>Domains(1)</strong> but the status is Pending and under the right side you can see the <strong>"Create records in Route53"</strong> Click on it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945565828/4868d8ca-ddc3-4628-b940-9854d2153ab5.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Now select the Domain on the blue checkbox and click on <strong>Create records.</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945572152/72e5dd96-2187-4288-ad1a-c67e9c324494.png" alt class="image--center mx-auto" /></p>
<ul>
<li>You can see that the <strong>Status</strong> of the Certificate is <mark>Pending Validation</mark> wait for a few minutes.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945631169/1e61f164-b24a-4cd5-a832-ba6326fcd689.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Now the status of the Certificate is changed to <mark>Issued</mark> and you can see that the domain status is "Sucess".</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945641042/96e85633-f8e3-466e-9d0a-6a5dfcb07886.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 5:</strong> Now, under the Dashboard of EC2 select the Target Groups.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945678241/d125b0ae-efd0-4899-b0fa-2d8a18b1c252.png" alt /></p>
<ul>
<li>click on the Create target group</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945683606/4a7762dc-d0d3-4b8f-80a3-b06ae3dc3b75.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 6:</strong> Leave everything as default (choose target type <mark>Instance</mark> ) and give a target name for now we give it "<mark>acm-demo-TG</mark>" After that you will see the following window.</p>
<ul>
<li>now select the Instance ID on the checkbox and Include it as pending below.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945686816/4fbb712a-ed1a-4fe5-ba85-b21a5758b564.png" alt class="image--center mx-auto" /></p>
<ul>
<li>now Click on the Create target group.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945695298/7941972c-4a2f-4944-9896-80b8a158e847.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 7:</strong> From the Dashboard of EC2 click on Load Balancers.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945712696/ab9c78eb-4482-4c44-aae6-c5129becfab2.png" alt /></p>
<ul>
<li>Choose the Application Load Balancer and Click on <strong>Create.</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945743726/e6b51854-ce98-44d4-a8e9-dd0e36c77cbb.png" alt /></p>
<p><strong>Step 8:</strong> Under Basic configuration give a Load balancer name for now say "<mark>acm-demo-alb</mark>" and leave others default like <strong>Scheme:</strong> <mark>Internet-facing </mark> and <strong>Ip address type</strong>:<mark>IPv4</mark></p>
<ul>
<li>Under the Network mapping choose different availability zones</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945748911/2694f03a-f37e-428e-b9fb-238a7086f979.png" alt /></p>
<ul>
<li>From the Security groups choose the group created while launching the EC2 instance.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945763978/3683fe5b-6864-4aed-8b88-28df3cf56a7a.png" alt /></p>
<ul>
<li>Under the <strong>Listeners and routing</strong> choose <strong><mark>Forward to</mark></strong> of <strong>Default action</strong> and select the Target Group created for now we select the <strong>"acm-demo-TG".</strong></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945768026/8542ff0b-d30a-47b0-b934-0721d60d41b5.png" alt /></p>
<ul>
<li>After you save, click on View load balancer.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945770450/95ea3848-4b70-4cbf-93f3-a208d6aae508.png" alt class="image--center mx-auto" /></p>
<ul>
<li>As you can see that our load balancers is on <mark>provisioning</mark> State wait for few minutes</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945772726/40a9538c-0b9d-4a47-abcf-f294c353a86d.png" alt class="image--center mx-auto" /></p>
<ul>
<li>now you can see it's in <mark>Active</mark> state</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945776232/3c585c7d-f8c2-468d-8c66-1ce9722ddc91.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 9:</strong> Now under the Hosted zone details Click on <mark>Create record</mark>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945779559/e66cc954-4ed2-406f-950a-1404dd4221e9.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 10:</strong> Under the Quick create record field give a Record name, select on <mark>Alias</mark> From Route traffic to select the <mark>Alias to Application and Classic Load Balancer and choose the Availability zone same as the Network mapping</mark> we selected previously and lastly select the <mark>DNS name of our load balancer</mark>. and click on Create records.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945783411/9a9ba63d-fa84-44c7-9c6d-96c6c1a8a417.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 11:</strong> Now copy and paste our domain from Route 53. and paste it on the browser.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945792087/3713a48c-177f-4a4f-a524-4c52cf8c1263.png" alt class="image--center mx-auto" /></p>
<ul>
<li>you can see that the site is still insecure</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945800639/7167b0e5-b260-46dc-a2ae-a6b3e8491f93.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 12:</strong> From the Dashboard of EC2 &gt; Select the Load balancer &gt; Select the Listeners and click on Add listeners on the right side.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945807272/51f64e76-09ab-4833-b138-4a0e5aa3f95d.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 13:</strong> Now under the Default actions select <strong><mark>Forward to</mark></strong> and under Target group <mark>select the target group</mark> we created earlier, for now, "say acm-demo-TG"</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945819975/489ac2a0-8f17-47e6-bdd2-053d6e213aad.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 14:</strong> Under the Secure Listener settings from Default SSL/TLS certificate <em><mark>Select a certificate.</mark></em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945823740/2202ef73-e422-4e6e-acec-261bfae526e2.png" alt class="image--center mx-auto" /></p>
<ul>
<li>After selecting a certificate click on Add.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945833036/6adafa9c-738e-4a34-9766-5392b0613ab7.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 15:</strong> Now paste the domain name in the browser. you can see that it's secure under https but when you enter the domain name with http its renders and it's insecure so we must redirect the http port to https port to make it secure.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945836444/5a245d57-9155-4392-a944-b41f5abcdeeb.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945792087/3713a48c-177f-4a4f-a524-4c52cf8c1263.png" alt /></p>
<ul>
<li><p>Now to redirect the http port into https port we do the following changes.</p>
</li>
<li><p>From the <strong>Load balancer</strong> Select the <strong>Listeners</strong> and you can see the following two ports.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945839473/70a61cb9-3978-42ea-9acf-eab6aece7108.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 16:</strong> Select the HTTP:80 port and From Action select the Edite listener.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945845985/c38e1d39-a7a8-472c-aa36-577423d60b2b.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 17:</strong> Now under <strong>Listener details</strong> choose the Redirect and enter <mark>443</mark> at Port and Save changes.</p>
<ul>
<li>paste the domain name with http</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945865737/b8162d59-bbd0-40b8-8e8a-121febf25b48.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684945937904/973f7828-14b1-4d2c-a5fc-78a94a18260e.png" alt class="image--center mx-auto" /></p>
<p>Finally, you have completed the Demostration and you have made your site secure when you even try to open with http it will automatically redirect to https port.</p>
<p>CONGRATULATIONS!!!</p>
<p>Keep Learning...</p>
]]></content:encoded></item><item><title><![CDATA[What Is a VPC? A Beginner's Guide to AWS VPCs]]></title><description><![CDATA[Amazon Virtual Private Cloud (VPC) is a service that enables you to deploy AWS resources within a network that is completely isolated and customized according to your needs. With VPC you have control, over your networking environment allowing you to ...]]></description><link>https://blog.abishekgautam.com.np/what-is-a-vpc-a-beginners-guide-to-aws-vpcs</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/what-is-a-vpc-a-beginners-guide-to-aws-vpcs</guid><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Thu, 18 May 2023 06:15:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1684388905257/d527e89a-b501-4e8c-bc26-b818293da766.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Amazon Virtual Private Cloud (VPC)</strong> is a service that enables you to deploy AWS resources within a network that is completely isolated and customized according to your needs. With VPC you have control, over your networking environment allowing you to choose the IP address range create subnets and configure route tables and network gateways.</p>
<h3 id="heading-what-are-the-benefits-of-using-an-aws-vpc"><strong>What are the benefits of using an AWS VPC?</strong></h3>
<ul>
<li><p>Reduced downtime and inconvenience</p>
</li>
<li><p>Reduced risk of data breaches</p>
</li>
<li><p>Flexibility</p>
</li>
<li><p>Cost-effective</p>
</li>
</ul>
<h2 id="heading-how-do-i-create-an-aws-vpc">How do I create an AWS VPC?</h2>
<p>Most users prefer to use the AWS Management Console to create a VPC. Here’s how to set up your VPC step-by-step:</p>
<p><mark>Step 1:</mark> Go the AWS management console and search for VPC and select it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684253499682/fe8986e9-0320-40af-bab4-8e77f12c4301.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 2:</mark> Click on Create VPC</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684253536038/d81bb570-35c9-4752-9e45-7f6018817aa8.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 3:</mark> Under the VPC setting select the vpc only, give the name of the VPC and set the IPv4 CIDR for na and click on the Create VPC. For now say Name: <mark>demo-vpc</mark> IPv4-CIDR: <mark>10.0.0.0/16</mark></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255317015/b8b4ed8c-2986-4bcb-86a4-99bb9e29404f.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255372544/50a9a780-aea5-45b2-9059-e4856746eb07.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 4:</mark> Now, select the Subnet on the dashboard column.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255439539/01747fe1-dff0-49bc-8855-8600fc3392bd.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 5:</mark> Click on Create subnet and select the VPC created earlier, which is</p>
<p>(demo-vpc)</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255529158/4cd58295-2902-4a7e-b55a-019540009ab2.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 6:</mark> Give the name of the subnet and set the IPv4 CIDR block and click the create subnet.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684253274420/7dc3cf39-33cb-4cc7-9865-ca912f299823.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 7:</mark> For creating a private subnet give the name and set the CIDR block such that it doesn't overlap and click the Create subnet.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684253302923/e189b1fd-d608-46ed-b2a6-24208c208787.png" alt class="image--center mx-auto" /></p>
<p>now you can see the available subnet.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684253326026/31fdf65d-4468-47c7-aba3-a827cd284625.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 8:</mark> Now go to the Route tables under the Dashboard.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255666442/ca19125f-1227-4f28-b6f7-e9c3077df204.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 9:</mark> Now Create the route table and Name the table for the public subnet set the name and select the VPC created earlier.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255679615/a03310b1-7605-4dac-942a-d9bf8e3aae79.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255694584/d70251c7-334a-4dda-9860-ccd57e64ecf5.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 10:</mark> For the private subnet again, create the route table give a name and select the VPC created earlier.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255721638/0409a65b-a0e8-497a-a4d7-0b278bcb8e8a.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 11:</mark> Select the Internet gateways from the Dashboard and Click on Create Internet gateway in the top right corner.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255757759/172e08a8-4aac-4fc8-9d72-cc26f8a4b890.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 12:</mark> Give a name for the Internet gateway settings, this is created to connect our VPC to the Internet.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255774296/3ba104f6-a998-43f1-907a-8257b2b27e4c.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 13:</mark> At the top right corner Click on Attach to a VPC and under Available VPCs select the with the name demo-vpc created earlier and click on Attach internet gateway.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255806477/fec2226e-5c4b-4b7a-9f75-b6babf2155f2.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255852695/ddd10e4a-2ec9-4f51-a7a1-fbe360fa6da2.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 14:</mark> From the Dashboard Click on NAT gateways and on the top right corner Select the Create NAT gateway</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255904047/a548038b-b491-47d1-8927-770df8333a4e.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 15:</mark> Under the NAT gateway settings, give a Name to the NAT, under Subnet Field Select a <mark>Public subnet</mark> created earlier and, on Connectivity type select Public</p>
<p>under Elastic IP allocation ID click on the <mark>Allocate Elastic IP</mark> button. And Create NAT gateway at the end.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255924962/52ddb852-f7b4-45d2-9f0c-f2a1bac40f37.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 16:</mark> Go to the Route table and firstly select the public route table we created earlier.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684255998054/64802644-df74-4ce0-a667-d27804599f0b.png" alt /></p>
<p>under the Routes click <strong>Edit routes</strong> button on the right side of Routes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256026703/722b1cfc-a217-4aa9-a03f-40b7f12d8dc0.png" alt class="image--center mx-auto" /></p>
<p>Select the Add route and under <strong>Destination</strong> Select <mark>0.0.0.0/0</mark> and under <strong>Target</strong> select <mark>Internet Gateway</mark> that we created since we are targeting any traffic that needs to go to the internet to the IGW and Save changes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256036695/f34bac96-ce8e-463e-b1b9-16f40f1ad4b2.png" alt class="image--center mx-auto" /></p>
<p>now select the <strong>Subnet associations</strong> next to the Routes and click on the <mark>Edit subnet association</mark> under Explicit subnet associations and select the <mark>public subnet</mark> created earlier and Save associations.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256738552/09ba2d8f-1ed7-4f6f-a6a7-99b99ea01cf1.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 17:</mark> Go back to the Route tables and select the private route table and click on the Edit routes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256065871/1f471b24-a546-4e2f-b5b4-d9225f1e40a7.png" alt class="image--center mx-auto" /></p>
<p>Under the Destination select <mark>0.0.0.0/0</mark> and under Target select <mark>NAT Gateway</mark> and Save changes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256075427/df9eb910-d216-44e4-b3f9-e7a530eeb84b.png" alt class="image--center mx-auto" /></p>
<p>Click the <strong>Subnet associations</strong> and under <strong>Explicit Subnet associations</strong> click on <mark>Edit subnet associations</mark>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256800131/1c13416d-6a6c-4d1d-9086-fccc98c2355b.png" alt class="image--center mx-auto" /></p>
<p>select the private subnet we created earlier and save associations.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256928329/56838ae0-2d14-42d6-88bd-6184fa2adb2b.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 18:</mark> Under the search bar search EC2 and click on it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256118638/cdff71f8-3fe0-4b26-9d30-f15e1e22ee1a.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 19:</mark> Click on the Launch Instance</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256167886/6bf73194-dd26-497c-9df8-aeabb06dcca9.png" alt /></p>
<h2 id="heading-we-are-creating-two-instances-public-and-private-instance">we are creating two instances public and private instance.</h2>
<p>Step 20: For the first instance give a name to the instance say instance-public</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256242665/4fa73166-6718-492f-ad05-0b16e43ec663.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 21:</mark> Create a key pair for now we named it randomkey</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256262292/0c8b8425-6af8-4545-a3a4-66a5e6739cff.png" alt /></p>
<p><mark>Step 22:</mark> Under the Network settings Click on Edit</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256478980/ec10b605-39d8-4764-900c-b76896c2d957.png" alt class="image--center mx-auto" /></p>
<p>Select the VPC created earlier and under subnet field select the <mark>public subnet.</mark></p>
<p><mark>Enable</mark> the Auto-assign public IP</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256271394/ba46fc46-429b-41ff-a9f5-af37e4381fcf.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 23:</mark> Launch the Instance</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256307839/a97ce705-5b50-409b-98a7-5f9b8d038d65.png" alt /></p>
<p><mark>Step 24:</mark> we are creating a private instance for that click on Launch instance</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256320974/c3e813c2-9b65-49be-acc8-40e1a40115a8.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 25:</mark> Name the instance for now we name it <mark>instance-private</mark>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256377798/d4f538a9-7ed8-40bd-91a5-9e501167bc21.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 26:</mark> You can select the same key pair or you can create a new one. For now we use the same key pair "randomkey"</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256396876/3dec990b-ee01-47b9-9c1c-bec2880d8f54.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 27:</mark> Under the Network settings Click on Edit.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256424128/a903a537-b466-4831-a3b5-d7865bfa1cf8.png" alt class="image--center mx-auto" /></p>
<p>Select the VPC created earlier we have "demo-vpc" , on Subnet select the p<mark>rivate-vpc</mark> and <mark>Enable</mark> the Auto-assign public IP</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256435159/cd46b849-957d-476e-8579-d11ddb72a658.png" alt class="image--center mx-auto" /></p>
<p><mark>Step 28:</mark> You can see the two instances now, select the public Instance which <mark>Status is 2/2 check passed</mark>. we have "instance-public" and click on <mark>Connect</mark>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256530472/9215d14b-b0f7-4ef8-9762-ea84479c80b0.png" alt class="image--center mx-auto" /></p>
<p>Copy the Command from the SSH client</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256550975/dd4f3863-2cdd-4b5b-ae7e-e6bde968ff1b.png" alt class="image--center mx-auto" /></p>
<p>Open the Terminal and change directory where your key-pair is</p>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> Downloads
</code></pre>
<p>change the permission of the key-pair.</p>
<pre><code class="lang-bash">chmod 400 randomkey.pem
</code></pre>
<p>connect to the public-instance</p>
<pre><code class="lang-bash">ssh -i <span class="hljs-string">"key-pair_name.pem"</span> ec2-user@&lt;Public IP&gt;
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256570756/46917c5b-de81-4bc0-ae89-f04e662d6207.png" alt class="image--center mx-auto" /></p>
<p>you can ping to google to see if there's a connection established.</p>
<pre><code class="lang-bash">ping google.com
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256947067/1a1e3065-f6ad-48cf-a074-aa73768a1f55.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-connecting-private-instance-from-public-instace">Connecting Private instance from public instace</h3>
<p>you need to <mark>note down the Private IPv4 addresses</mark></p>
<p>open the keypair file and copy the text.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256971140/67c08147-33c0-4519-aaa4-f26f8baeabff.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>create a file and paste the copied keypair text inside and save and exit.</p>
</li>
<li><p>change the file permission</p>
<pre><code class="lang-bash">  chmod 400 filename.pem
</code></pre>
</li>
</ul>
<p>connect the instance using private ip address.</p>
<ul>
<li><pre><code class="lang-bash">        ssh -i filename.pem ec2-user@&lt;private_ip_address&gt;
</code></pre>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684256991215/9a486512-15a4-4c78-9b3b-e9c2b5a63625.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684257010822/d1ab718e-e4e4-49dc-bb8e-60de9bdec05a.png" alt class="image--center mx-auto" /></p>
<p>you can ping to see the Private instance is connected to internet or not .</p>
<pre><code class="lang-bash">ping facebook.com
</code></pre>
<p>you have done it.</p>
<p>CONGRATULATIONS!!!</p>
<p>© 2023, Amazon Web Services, Inc.</p>
]]></content:encoded></item><item><title><![CDATA[How to Create Multiple Users in Linux?]]></title><description><![CDATA[When working within complex systems such as within large-scale computer networks or IT operations involving multiple applications or software running simultaneously under different user's control. so, Linux OS offers to create multiple users for your...]]></description><link>https://blog.abishekgautam.com.np/how-to-create-multiple-users-in-linux</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/how-to-create-multiple-users-in-linux</guid><category><![CDATA[Linux]]></category><category><![CDATA[linux for beginners]]></category><category><![CDATA[command line]]></category><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Wed, 10 May 2023 16:55:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1683727109941/62445f2d-47ac-403d-83c7-461235cf8c68.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When working within complex systems such as within large-scale computer networks or IT operations involving multiple applications or software running simultaneously under different user's control. so, Linux OS offers to create multiple users for your system at once.</p>
<h3 id="heading-method-1-using-a-command-andamp-text-file-to-create-multiple-users-in-linux">Method 1: Using a Command &amp; Text file to Create multiple Users in Linux.</h3>
<p>Step 1: Open the Linux terminal</p>
<p>Step 2: Create <strong>.txt file to write the new user's credentials</strong></p>
<pre><code class="lang-bash">nano new_users.txt
</code></pre>
<p>step 3: Type your desired multiple-user information in syntax below.</p>
<pre><code class="lang-bash">user_name:user_password:Uid:Gid:comment:home_dir:def_shell
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683776208436/839241e6-7d7e-432b-853b-0f3b9e560dc8.png" alt class="image--center mx-auto" /></p>
<p>here, User_name: user name of the new user to be created</p>
<p><strong>user_password:</strong> password for the new user</p>
<p><strong>Uid:</strong> New user's ID</p>
<p><strong>Gid</strong>: New user's group ID</p>
<p><strong>comment:</strong> Comment section or User Full Name</p>
<p><strong>home_dir:</strong> User's home directory</p>
<p><strong>def_shell:</strong> User's default shell</p>
<p>Step 4: change the <strong>.txt file's permissions</strong> using the following command</p>
<pre><code class="lang-bash">sudo chmod 600 new_users.txt
</code></pre>
<p>Step 5: Input the password of the currently logged in user.</p>
<p>Step 6: Create desired users by typing the command bleow and press Enter.</p>
<pre><code class="lang-bash">sudo newusers new_users.txt
</code></pre>
<p>Step 7: Now, check if the desired users are created.</p>
<pre><code class="lang-bash">tail /etc/passwd
</code></pre>
<h3 id="heading-method-2-using-bash-script-to-create-multiple-users-in-linux">Method 2: Using Bash Script to Create Multiple Users in Linux.</h3>
<p>Step 1: Open the terminal or Press <strong>CTRL + ALT + T</strong></p>
<p>Step 2: Create a directory name bin in your home directory</p>
<pre><code class="lang-bash">mkdir bin
</code></pre>
<p>Step 3: After that , Create a bash Script file inside the bin directory</p>
<pre><code class="lang-bash">nano bin/create_users.sh
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683736504459/59b3e0d0-e67a-490f-b6d5-7a086b27ac10.png" alt class="image--center mx-auto" /></p>
<p>Step 4: Now, write the following script in the <strong>create_users.sh</strong> file for creating multiple users in a loop.</p>
<pre><code class="lang-bash"><span class="hljs-meta">#!/bin/bash</span>

<span class="hljs-built_in">read</span> -p <span class="hljs-string">"Enter number of Users to create:"</span> num
<span class="hljs-built_in">echo</span> <span class="hljs-string">"------------------------------------------------------"</span>
<span class="hljs-keyword">for</span> (( i=1; i&lt;=<span class="hljs-variable">$num</span>; i=i+1)); <span class="hljs-keyword">do</span>
<span class="hljs-built_in">read</span> -p <span class="hljs-string">"Enter Username no.<span class="hljs-variable">$i</span>: "</span> uname
sudo useradd <span class="hljs-variable">$uname</span>
<span class="hljs-built_in">read</span> -p <span class="hljs-string">"Enter password for user no.<span class="hljs-variable">$i</span>? [Y/N] "</span> flag
<span class="hljs-keyword">if</span> [[ <span class="hljs-string">"<span class="hljs-variable">$flag</span>"</span> == <span class="hljs-string">"Y"</span> || <span class="hljs-string">"<span class="hljs-variable">$flag</span>"</span> == <span class="hljs-string">"y"</span> ]]; <span class="hljs-keyword">then</span>
sudo passwd <span class="hljs-variable">$uname</span>
<span class="hljs-built_in">echo</span> <span class="hljs-string">"Successfully created New User: <span class="hljs-variable">$uname</span> with password."</span>
<span class="hljs-built_in">echo</span> <span class="hljs-string">"------------------------------------------------------"</span>
<span class="hljs-keyword">else</span>
<span class="hljs-built_in">echo</span> <span class="hljs-string">"Successfully created New User: <span class="hljs-variable">$uname</span> without password."</span>
<span class="hljs-built_in">echo</span> <span class="hljs-string">"------------------------------------------------------"</span>
<span class="hljs-keyword">fi</span>
<span class="hljs-keyword">done</span>
</code></pre>
<p>Step 5: To save and Exit from the Script, press <strong>CTRL + S</strong> and <strong>CTRL + X</strong> respectively</p>
<p>Step 6: Now, type the following command to permit the current user in your system.</p>
<pre><code class="lang-bash">chmod u+rwx bin/create_users.sh
</code></pre>
<p>Step 7: Finally restart your system to add the newly created bin directory to the <strong>$PATH</strong> variable</p>
<pre><code class="lang-bash">sudo reboot
</code></pre>
<p>Step 8: Now open your terminal or Press <strong>CTRL + ALT + T</strong></p>
<p>Step 9: Run the previously written script by typing the file name.</p>
<pre><code class="lang-bash">create_users.sh
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683736133890/0c773f0e-acac-42e5-8d75-c79a7b6f1417.png" alt /></p>
<p>Step 10: After entering the data, to check if the desired number of users is created.</p>
<pre><code class="lang-bash">tail /etc/passwd
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683736312691/5c669e77-75ab-4e5b-9b48-d90f779d2a7a.png" alt /></p>
<h3 id="heading-complementary-information-adding-multiple-users-in-a-group"><strong>Complementary Information</strong>: Adding Multiple Users in a Group</h3>
<p>Step 1: Open the Terminal</p>
<p>Step 2: Type the following command</p>
<ul>
<li>To create a group for now we are creating a group named "Student"</li>
</ul>
<pre><code class="lang-bash">sudo groupadd Student
</code></pre>
<ul>
<li>To add multiple users type the following command.</li>
</ul>
<pre><code class="lang-bash">sudo gpasswd -M UserA,UserB,UserC Group_Name
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683737307454/c3074ec2-ce7b-438d-baaa-899281d7058e.png" alt /></p>
<p>Step 3: To Check the Group Members</p>
<pre><code class="lang-bash">sudo less /etc/group| grep <span class="hljs-string">"Group_Name"</span>
or 
sudo grep Student /etc/group
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683736825379/8d1af833-42c0-4a8c-a059-febae8827ca7.png" alt /></p>
<p>As you can see that the users are inside the group named Student.</p>
<p>That's all for now, Happy Coding!!!.</p>
]]></content:encoded></item><item><title><![CDATA[How to Create a S3 Bucket and host your website live..]]></title><description><![CDATA[Amazon Simple Storage Service (S3):
It is an object storage service offering industry-leading scalability, data availability, security, and performance. Customers of all sizes and industries can store, manage and distribute data securely and reliably...]]></description><link>https://blog.abishekgautam.com.np/how-to-create-a-s3-bucket-and-host-your-website-live</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/how-to-create-a-s3-bucket-and-host-your-website-live</guid><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Wed, 10 May 2023 03:05:32 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1683683994149/f3d95b78-1e18-441d-b6e4-c1e0899fe746.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-amazon-simple-storage-service-s3">Amazon Simple Storage Service (S3):</h3>
<p>It is an object storage service offering industry-leading scalability, data availability, security, and performance. Customers of all sizes and industries can store, manage and distribute data securely and reliably in the cloud.</p>
<p><strong>Let's Demonstrate the live hosting of our website.</strong></p>
<p>Step 1: Go to the AWS Management Console and search s3 and click on it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685266948/d7d889a6-9e5e-4ed4-9f49-4765100a940e.png" alt class="image--center mx-auto" /></p>
<p>Step 2: Click on Create bucket.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685405364/3e964ce1-0a2d-44ee-a8b4-0ba9877877f8.png" alt class="image--center mx-auto" /></p>
<p>Step 3: Name a bucket and it must be globally unique. For now you say "abi-aws-bucket"</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685629863/c100407c-17f2-4ffe-842b-23aeb826d9cf.png" alt class="image--center mx-auto" /></p>
<p>Step 4: Under the Object Ownership you can choose ACLs enabled.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685461069/b0dd3b8d-967c-4be0-82b9-bc3120313288.png" alt class="image--center mx-auto" /></p>
<p>Step 5: Unmark Block all public access to ensure that public access to this bucket and mark the acknowledgement.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685527298/6017bcee-1862-4414-a1fe-b8bbd05a355a.png" alt class="image--center mx-auto" /></p>
<p>Step 6: Enable Bucket Versioning to keep multiple variants of an object in the same bucket.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685548991/6b33d642-23f1-4411-b48f-f4aeafdcb4eb.png" alt class="image--center mx-auto" /></p>
<p>Step 7: Now Select the create bucket.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685563808/be3ddae7-21c9-42b3-9a05-40e27a1666a1.png" alt class="image--center mx-auto" /></p>
<p>Step 8: You can see the (1) near bucket that means our bucket has been successfully created.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683686861843/21b81561-40ed-4237-a436-7e6523a50de3.png" alt class="image--center mx-auto" /></p>
<p>Step 9: Click on the Object "abi-aws-bucket" of the Name column. you can see the Objects with (0), It means we have no any objects. Now you can add objects from the upload box.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685741509/98d2f040-3d42-4500-8df2-5b99d7624abd.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685755609/8fa2273f-68df-4ea1-9be1-bcab948ce1d1.png" alt class="image--center mx-auto" /></p>
<p>Step 10: Under Permissions select Grant public-read access and tick mark on the acknowledgement.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685812176/a309489a-c811-45c8-8b52-36d14d87fe86.png" alt class="image--center mx-auto" /></p>
<p>Step 12: Click on Upload button.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685825403/4fa5285f-2146-4cb2-8190-92ca297391b0.png" alt class="image--center mx-auto" /></p>
<p>you can see upload succeeded.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685853068/831d3b29-2bc0-4936-aab1-25aa7c64cd62.png" alt class="image--center mx-auto" /></p>
<p>Step 13: Select the Properties.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685863833/2017ccf7-d49e-4606-9d9d-69db1eb0b1f3.png" alt class="image--center mx-auto" /></p>
<p>Step 14: under Static website hosting choose Edit button and Enable it. Also, name the home or default page of your website.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685877832/2c7005e4-481d-4db5-bc09-f44d1c7ae90e.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685891159/58f25a04-c52c-4873-9926-473c78483013.png" alt class="image--center mx-auto" /></p>
<p>Step 15: After that under static website hosting, you can see the link created at the bucket website endpoint.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685906821/4d5dc1c9-1b4c-4d9c-b6ef-f2b4c0d20816.png" alt class="image--center mx-auto" /></p>
<p>Copy the link and paste it in the browser.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685920503/f5e937f1-5a51-4df6-95cf-1cb6dff73aca.png" alt class="image--center mx-auto" /></p>
<p>Finally, You can see that your website is live.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683685934286/7bb34515-241b-47c5-a7b5-b6daab1a1619.png" alt class="image--center mx-auto" /></p>
<p>That's Amazing, You have finally hosted your website using Amazon S3 service.</p>
<p><code>THANK YOU!!</code></p>
]]></content:encoded></item><item><title><![CDATA[How to host a static website in AWS EC2]]></title><description><![CDATA[Amazon Elastic Compute Cloud (EC2) is a web service offered by Amazon Web Service (AWS) that provide scalable computing capacity in the cloud. EC2 allows users to launch virtual machines (instances) and run a wide range of applications on them.
Now l...]]></description><link>https://blog.abishekgautam.com.np/how-to-host-a-static-website-in-aws-ec2</link><guid isPermaLink="true">https://blog.abishekgautam.com.np/how-to-host-a-static-website-in-aws-ec2</guid><category><![CDATA[AWS]]></category><category><![CDATA[AWS,EC2]]></category><category><![CDATA[Cloud Computing]]></category><dc:creator><![CDATA[Abishek Gautam]]></dc:creator><pubDate>Tue, 09 May 2023 16:48:47 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1683639009069/55fd0170-d723-4b6a-b81d-5ae8751b321a.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Amazon Elastic Compute Cloud (EC2) is a web service offered by Amazon Web Service (AWS) that provide scalable computing capacity in the cloud. EC2 allows users to launch virtual machines (instances) and run a wide range of applications on them.</p>
<p><strong>Now let's create EC2 instance and Deploy our static website</strong></p>
<p><strong>(prerequisite: AWS account)</strong></p>
<p><strong><em>Step 1:</em></strong> Go to AWS Management Console and Search for EC2 instance also, click on it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683645539140/906db671-0510-4de6-abe6-2b3a994ac7ce.png" alt class="image--center mx-auto" /></p>
<p><strong><em>Step 2:</em></strong> Click on Launch Instance on the Dashboard.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683645760628/2127b238-0a4b-4645-9143-0980a143281b.png" alt class="image--center mx-auto" /></p>
<p><strong><em>Step 3:</em></strong> Write a name for the instance (example: MyWebServer). you can also give additional tags.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683646645646/8c8215c0-e183-400d-88ec-c68f0c68c522.png" alt class="image--center mx-auto" /></p>
<p><strong><em>Step 4:</em></strong> Choose Amazon Linux 2 and Instance type t3.micro,</p>
<p>you can always choose as you want but Recommend you to use Free tier.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683646715433/e523912b-8adc-4c72-a0ae-a2f8d9f477fa.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683646746367/b0d3d080-c775-4072-bbf9-87e5a948e7a5.png" alt class="image--center mx-auto" /></p>
<p><strong><em>Step 5:</em></strong> Select "Create a new pair" and give a name for now say "webSarver".</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683647510146/eff0220a-8703-4356-aa68-92e1ebae1ecb.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683646798184/1ff3d664-41fc-48da-8a04-cfe2f1ec300c.png" alt class="image--center mx-auto" /></p>
<p>you have to know where your key pair file is being downloaded.</p>
<p><strong><em>Step 6:</em></strong> In the Network settings,</p>
<ul>
<li><p>You can Configure the Security Group name and Description as you like but we are leaving it as default for now.</p>
</li>
<li><p>select the Inbound security groups rules you can see the Add security group rule click on it.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683647626575/7bb5f6d8-c0bf-4acc-81bd-80c2281e4856.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Add the following Type and Source type.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683647662633/5b072a04-efae-4209-8185-6656d6a5067c.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683647684172/05c62383-88e2-4a64-8d2e-e8c41a253bf7.png" alt class="image--center mx-auto" /></p>
<p><strong><em>Step 7:</em></strong> In configure storage</p>
<p>leave it as default for now but you can get upto 30 GiB in the free tier. This will be your root volume also known as 'boot' volume.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683647702288/879e28fa-5b76-4564-9b65-1914d16c6943.png" alt class="image--center mx-auto" /></p>
<p><strong><em>Step 8:</em></strong> In configure advance details</p>
<p>add the following codes in the user data field and leave other field as default.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683647720307/6fc012b4-d09f-402b-a9cd-5c8f29bedf80.png" alt class="image--center mx-auto" /></p>
<p>The Script does the following:</p>
<ul>
<li><p>Install an Apache web server (httpd)</p>
</li>
<li><p>configure the webserver to automatically start on boot</p>
</li>
<li><p>Activate the Web server</p>
</li>
<li><p>Create a simple web page</p>
</li>
</ul>
<p><strong><em>Step 9:</em></strong> Click on Lauch instance</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683647749816/15fcca90-15bf-4e46-b560-663260933ccf.png" alt class="image--center mx-auto" /></p>
<p>you can see this interface with a sucess.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683647772558/3389f4c7-2295-44ef-8176-e7451aac8502.png" alt class="image--center mx-auto" /></p>
<p><strong><em>step 10:</em></strong> Wait for some time the instance is running and the status is initializing. After some time you can see that there is 2/2 checked passed on the status check.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683647951140/9f58fbce-b204-44ce-aa98-d9cbfafd3529.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683647862965/ef613c96-28c3-4ba0-b5c3-a2d7b0de74d9.png" alt class="image--center mx-auto" /></p>
<p><strong><em>step 11:</em></strong> Now, you can click on the instance Id and copy the Public IPv4 address and paste it in the browser. you would be able to see this result which was written in the user data field inside the h1 tags.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683647820719/4258bbba-0d5b-4c91-addf-ef677787b22a.png" alt class="image--center mx-auto" /></p>
<p>That's all, you have finally hosted a static website on the AWS cloud.</p>
<p>Congratulations guys!!!</p>
]]></content:encoded></item></channel></rss>