<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mohamed Jawad P on Medium]]></title>
        <description><![CDATA[Stories by Mohamed Jawad P on Medium]]></description>
        <link>https://medium.com/@jawad846?source=rss-f4b23cb96e3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BufUQiLCgKDGtxTxdckfKg.jpeg</url>
            <title>Stories by Mohamed Jawad P on Medium</title>
            <link>https://medium.com/@jawad846?source=rss-f4b23cb96e3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 20:26:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jawad846/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Azure Inventory — Multi-Tenant using Powershell]]></title>
            <link>https://medium.com/@jawad846/azure-inventory-multi-tenant-using-powershell-d1975ea417a3?source=rss-f4b23cb96e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1975ea417a3</guid>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[inventory]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Mohamed Jawad P]]></dc:creator>
            <pubDate>Wed, 12 Apr 2023 11:35:58 GMT</pubDate>
            <atom:updated>2023-04-12T11:42:18.772Z</atom:updated>
            <content:encoded><![CDATA[<h3>Azure Inventory — Multi-Tenant Subscriptions using Powershell</h3><h4>One major hurdle you may encounter while operating Azure Multi-Tenant Subscriptions is retrieving the inventory. However, you can overcome this challenge by using Powershell. This guide will help you how to fetch inventory for Azure Multi-Tenant Subscriptions.</h4><p>To get started, you need to install AzModule on your terminal, which can be done by executing the commands below. This process works on all operating systems, and there are no additional requirements when using PowerShell 7.0.6 LTS or PowerShell 7.1.3 or higher.</p><blockquote>Install the <a href="https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell">latest version of PowerShell</a> available for your operating system.</blockquote><pre>#check the version of the powershell<br>$PSVersionTable.PSVersion<br><br>#Set execution policy<br>Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser<br><br>#Install Azure Powershell Module<br>Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force</pre><p>To access your Azure subscriptions using Powershell, please log in using the following steps:</p><pre>#To login with single Tenant<br>Connect-AzAccount<br><br>#To login with specific Tenant<br>Connect-AzAccount -Tenant &quot;xxxxxxx-xxxxxxxx-xxxxxxx&quot;<br><br>#To login with specific subscription in the Tenant<br>Connect-AzAccount -Tenant &quot;xxxxxxx-xxxxxxxx-xxxxxxx&quot;-Subscription &quot;xxxxxxx-xxxxxxxx-xxxxxxx&quot;</pre><p>After you have logged in with all your subscriptions, you can simply view the list of subscriptions by running the below command;</p><pre>Get-Azcontext -listavailable</pre><p>The subscription names appear in a wide format, which may not be easily comprehensible to users. To make the names more user-friendly, you can use the following commands to rename them.</p><pre>#Rename the session names<br>Rename-AzContext -SourceName &quot;&lt;Azure Subscription 1 (xxxxx-xxxxx-xxxxx)&gt;&quot; -TargetName &quot;&lt;mysub01&gt;&quot;</pre><p>Another challenge is that if you close or clear the terminal, all of your logins will be lost. To avoid having to log in to Azure multiple times, you can save these sessions to a JSON file by following the steps below. However, it is important to keep this file in a secure location.</p><pre>#Save all the session<br>Save-AzContext -Path &quot;$pwd\AzContextProfile.json&quot;<br><br>#Clear all the session<br>Clear-AzContext -Force<br><br>#Import all the save session<br>Import-AzContext -Path &quot;$pwd\AzContextProfile.json&quot;</pre><p>After completing the necessary steps outlined above, you can retrieve the inventory by executing the PowerShell script. This guide provides instructions on how to obtain the inventory for all of your multi-tenant subscriptions.</p><pre>#Assign all the subscriptions to a variable<br>$subs = @(Get-Azcontext -listavailable)<br><br>$date = (Get-Date -Format &quot;yyyy_MM_dd&quot;)<br>$filename = &quot;azure_vm_inventory_$date.csv&quot;<br><br>#start for loop<br>foreach ($sub in $subs) {<br>    #Select each subscriptions<br>    Select-AzContext -Name $sub.Name -Scope Process<br>    #Tittle for the inventory sheet<br>    $tittle = &quot;&quot; | Select-Object AccountName, VMName, Region, VMSize, vCPU, TotalMemory, OperatingSystem<br>    #Get all the VMs of this subscription<br>    $vms = (Get-AzVm)<br>    foreach ($vm in $vms){<br>        $tittle.AccountName             = $sub.Name<br>        $tittle.VMName                  = $vm.Name<br>        $tittle.Region                  = $vm.Location<br>        $tittle.VMSize                  = $vm.HardwareProfile.VmSize<br>        $tittle.vCPU                    = (Get-AzVMSize -Location $vm.Location | Where-Object {$_.name -eq $vm.HardwareProfile.VmSize}).NumberOfCores<br>        $totalmem                       = (Get-AzVMSize -Location $vm.Location | Where-Object {$_.name -eq $vm.HardwareProfile.VmSize}).MemoryInMB<br>        $tittle.TotalMemory             = [math]::Truncate($totalmem/1000)<br>        $tittle.OperatingSystem         = (Write-Output $vm.StorageProfile.ImageReference.Publisher,$vm.StorageProfile.ImageReference.Offer,$vm.StorageProfile.ImageReference.Sku | Join-String -Separator &#39;-&#39;)<br><br>        $rep+=$tittle<br>        $rep | Export-Csv -Path &quot;$pwd\$filename&quot; -Append<br>        $rep = $null<br>    }<br>}</pre><p>This script will create a single .csv file that provides comprehensive details on all Virtual Machines, organized by Azure subscription.</p><p>Follow me for more blogs: <a href="https://medium.com/@jawad846">https://medium.com/@jawad846</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1975ea417a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Computer restarted unexpectedly, Windows installation cannot proceed — AWS]]></title>
            <link>https://medium.com/@jawad846/the-computer-restarted-unexpectedly-windows-installation-cannot-proceed-aws-36e2aca22bf7?source=rss-f4b23cb96e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/36e2aca22bf7</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[ec2-instance]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <dc:creator><![CDATA[Mohamed Jawad P]]></dc:creator>
            <pubDate>Tue, 23 Aug 2022 08:45:19 GMT</pubDate>
            <atom:updated>2022-08-23T08:45:19.536Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Computer restarted unexpectedly, Windows installation cannot proceed — AWS</h3><p>Have you ever faced “The Computer restarted unexpectedly or encountered an unexpected error, Windows installation cannot proceed” while accessing the windows servers on EC2 Instances?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*QikQGP7l8nYG2NMoye7Dmg.png" /></figure><p>This is one of the challenges when trying to access Windows servers on AWS EC2 instance. The instance is running, and the 2/2 check also passed, but the Windows server is not accessible.</p><p>When we took the screenshot for instance we saw the above error was prompting after the restart and stop &amp; start.</p><p>You have two solutions: first, you can use a recent backup and restore, the second option is to stop the server and detach the volume and troubleshoot as below.</p><p><strong>Steps:</strong></p><ul><li>You have to stop the instance and detach the root volume and copy the volume id (for ex. vol-12345)</li><li>Launch new windows instance and attach the root volume which is vol-12345 as a secondary volume.</li><li>Login to the server, and download the EC2 Rescue tool using the PowerShell command</li></ul><pre>wget -o EC2_Rescue_tool.zip <a href="https://s3.amazonaws.com/ec2rescue/windows/EC2Rescue_latest.zip?x-download-source=docs">https://s3.amazonaws.com/ec2rescue/windows/EC2Rescue_latest.zip?x-download-source=docs</a></pre><ul><li>Extract the EC2_Rescue_tool.zip and run the EC2 rescue application</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*WE0a6sAFm7TdR5gl5DZtuQ.png" /></figure><ul><li>Just click on “Next” from the window and then select “Offline instance” and click Next</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*d4XWwMycnC7vSmA-S0k0sQ.png" /></figure><ul><li>Select offline disk and Next.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*QpRUMTctc8iT6GXX6LXBMg.png" /></figure><ul><li>You will get a prompt that says “Volume successfully loaded”. Just click OK and continue.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*1Jf_UA779YilIIY4Wrgglg.png" /></figure><ul><li>On the below window just select “Diagnose and Rescue” and click on Next.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*Gw3NEcmM7qMQqhbMQky0yQ.png" /></figure><ul><li>EC2 Rescue will check all the components and report the summary. On this page just click on Next.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*LJC54rNmp1pBj-TkNAO3IQ.png" /></figure><ul><li>On this page, you have to select all warnings which are listed and click Next.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*GqeSxtNDmWE4qWCZO9fklg.png" /></figure><ul><li>Just verify and click on “Rescue”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*hljWVILTFP-phqQ7R-9Nrw.png" /></figure><ul><li>Once the rescue is completed you have to click on “Finish” and on the next prompt window click “OK”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*cO8YYGAmZMnl19AXcpLiMA.png" /></figure><ul><li>Once the above steps are completed successfully, You have to open the “registry”.</li><li>To open the registry, you have to run “regedit” on the Run Command.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*m776a_qWgdeniSlte2uiDw.png" /></figure><ul><li>Once the registry is opened, expand the “HKEY_LOCAL_MACHINE” and click on “Load Hive” from the file menu.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*0IYZo2uOfztcjhfr7r0RCg.png" /></figure><ul><li>On the Load Hive prompt, you have to select “&lt;AttachedDiskLetter&gt;:\Windows\System32\config\SYSTEM” and Open.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*jmcY7MrNd0AmKp0B2lRNCA.png" /></figure><ul><li>You have to give some names to the Hive.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*EmXJI9pcrajY95rmGp_o4Q.png" /></figure><ul><li>You have to expand that loaded hive and go to Setup → Status → ChildCompletion.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*zxU4w9F93KeALlQroSwdhA.png" /></figure><ul><li>Click on setup.exe and Modify.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*krh0AV_Y249IfCpybKs5zQ.png" /></figure><ul><li>On the modification prompt, you have to give “value data” as“3” and click on OK.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*qMsRMRs9t0t52-q6UXwqlg.png" /></figure><ul><li>Now you have to Unload the Loaded Hive. To do this, you have to select the hive and then file → Unload Hive.</li><li>It will ask for confirmation, just click “yes” and close the registry.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*3OZoCc7jNgrCnwo53JuemA.png" /></figure><ul><li>Once all the above steps are completed successfully, you have to detach and attach the disk to the original instance and start the instance.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36e2aca22bf7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Direct Connect: VGW & TGW]]></title>
            <link>https://medium.com/@jawad846/aws-direct-connect-vgw-tgw-b7cc35eb8943?source=rss-f4b23cb96e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7cc35eb8943</guid>
            <category><![CDATA[direct-connect]]></category>
            <category><![CDATA[aws-direct-connect]]></category>
            <category><![CDATA[transit-gateway]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[vpc]]></category>
            <dc:creator><![CDATA[Mohamed Jawad P]]></dc:creator>
            <pubDate>Wed, 08 Apr 2020 08:18:49 GMT</pubDate>
            <atom:updated>2020-04-08T08:54:54.001Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS Direct Connect: VGW and TGW</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*AeDgPzC5u3vM59Qqj4RZTQ.jpeg" /></figure><p>AWS Direct Connect is an aws cloud service, that establishes a dedicated network connection from your on-premises DC to the AWS Environment. This will helps you to connect securely with the AWS resources like Amazon EC2, RDS, S3, etc.. from the on-premises datacenters, offices or colocation environment through a private connection.</p><h3>Direct Connection</h3><p>There are mainly two types of connection,</p><h4><strong><em>Dedicated Connection:</em></strong></h4><p>This is a physical Ethernet connection associated with a single customer. You can create a dedicated connection from the AWS console as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*p8E-SsM_xJQ9a8Dg2Bnh3Q.jpeg" /></figure><p>Once you have created the dedicated connection, you need to download ‘LOA-CFA’ from direct connect console and complete your cross-network connection with the help of the service provider. For more information <a href="https://docs.aws.amazon.com/directconnect/latest/UserGuide/Colocation.html">click here</a>.</p><h4><strong><em>Hosted Connection:</em></strong></h4><p>This is also a physical Ethernet connection, It will provision by the AWS Direct Connect Partner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*vyLefMyYaINoWBvAQPEzRg.jpeg" /></figure><p>You can select any of the service providers depends on the availability to create a hosted connection. Once you had created the connection from the AWS console, you need to contact with service provider for connection availability. Once the hosted connection is ready, you need to accept the connection from the console.</p><h3>Virtual Interface</h3><p>To use Direct Connection with the aws resources, you need to create a virtual interface (VIF). If you are using a dedicated connection, you can create multiple VIF from the AWS console. You can also create a VIF with in the same account called as Standard VIF or with another AWS account called Hosted VIF. In the Hosted Direct Connection type, the AWS Direct Connect Partner creates VIF for you.</p><blockquote>Types of VIF:</blockquote><h4><strong><em>Private virtual interface:</em></strong></h4><p>Private VIF is used to create access to Amazon VPC using the private IP address. Private VIF’s are created either using a <a href="https://docs.aws.amazon.com/vpn/latest/s2svpn/SetUpVPNConnections.html#vpn-create-vpg">virtual private gateway</a> or with a direct connect gateway. Using virtual private gateway type, you can associate only a single Amazon VPC to the private VIF, while using with direct connect gateway type, you can associate multiple Amazon VPC’s to the single or multiple private VIF.</p><p>Before moving to the creation of the private VIF, you should create a virtual private gateway or a direct connect gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m3HfAD0grnHxvrTe2XCglw.jpeg" /></figure><h4><strong><em>Public virtual interface:</em></strong></h4><p>Public VIF is used to access all public AWS services like S3 using public IP addresses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gC1vTIBSZJ3jmoaYCmtAuQ.jpeg" /></figure><h4><strong><em>Transit virtual interface:</em></strong></h4><p>Transit VIF used to connect <a href="https://medium.com/tensult/aws-transit-gateway-1c7bb1ef702b">AWS Transit Gateways</a> with Direct Connect Gateway. Before creating the transit VIF you should create a direct connect gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SVokA720uNFusEzfC6damg.jpeg" /></figure><p>Once you are done with VIF creation, download the router configuration and share it with your service provider to make VIF available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1CNVlCnwGQ-s-WlOPnLSNw.jpeg" /></figure><h3>LAG</h3><p>Link Aggregation Group (LAG) is a logical interface used to combine multiple direct connect connections into a single connection using Link Aggregation Control Protocol. This will mainly help to increase the Bandwidth.</p><h3><strong>Direct Connect Gateway</strong></h3><p>Using Direct Connect Gateway you can associate multiple virtual private gateways and transit gateways into a single or multiple private VIF or to a transit VIF. A Direct Connect Gateway is a globally available resource. The association of the virtual private gateways and transit gateways into the direct connect gateway, can be done from the same account or across the accounts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1pge68PYNX27A-mVDa-Zug.jpeg" /></figure><p>Once you have created the direct connect gateway, you need to create a single or multiple VIF’s as mentioned above.</p><h4>Virtual Private Gateway Associations:</h4><p>As mentioned above, you can associate virtual private gateways to the direct connect gateway within the same account or across the account.</p><p><strong><em>Virtual Private Gateway Associations — the same account:</em></strong></p><p>Create Amazon VPC’s in region A and region B, once you have completed VPC creations, next you need to create a virtual private gateway for both the VPC’s. For more information to create a virtual private gateway <a href="https://docs.aws.amazon.com/vpn/latest/s2svpn/SetUpVPNConnections.html#vpn-create-vpg">click here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*6L1ahgX0jPJkVIUr3Nndug.jpeg" /></figure><p>To associate the virtual private gateway, go to the Direct Connect gateway → click on Gateway association tab → Associate gateway</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2CZuuaUY6svLS4v2IChzdg.jpeg" /></figure><p>On the Gateway association page, you can see all the virtual private gateways of that account. Select the appropriate gateway and specify the VPC CIDR ranges to advertise through direct connect gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*exmCfhYFOmBHsyfy3_OOQA.jpeg" /></figure><p><strong><em>Virtual Private Gateway Associations — across the account:</em></strong></p><p>To associate virtual private gateways across the account, you need to create Amazon VPC’s in multiple AWS accounts, then create virtual private gateways for all the Amazon VPC’s as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*Hy9w9KQiC4Idy6vBrz-pBg.jpeg" /></figure><p>To associate the virtual private gateway of account A, go to the Direct Connect page of account A → click virtual private gateways plane → go to the appropriate virtual private gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r4HqIZ2K2zOQTDUnj3N_HQ.jpeg" /></figure><p>From the next page, click on the Direct Connect gateway association tab → Associate Direct Connect gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eudWIiDUrzaqLgnKAcgnNw.jpeg" /></figure><p>From the association page, you need to select the Account owner as Another account, then provide the information of the direct connect gateway as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OQoMsDYN1j43flHTeJgpDg.jpeg" /></figure><blockquote>Note: Here Direct Connect gateway is in account D</blockquote><p>You can associate up to 10 virtual private gateways per direct connect gateway.</p><h4>Transit Gateway Associations</h4><p>To associate the transit gateway, you need to create transit gateway from the AWS Console, CLI or through API. To know more information about AWS Transit Gateway <a href="https://medium.com/tensult/aws-transit-gateway-1c7bb1ef702b">click here</a>.</p><p>Once you have done with the transit gateway, create a direct connect gateway with transit VIF as discussed above.</p><p><strong><em>Transit Gateway Associations — the same account:</em></strong></p><p>Create Amazon VPC’s and transit gateway in the region A, attach all the VPC’s into the transit gateway as shown below. To know more about creation and attachment of VPC’s to the transit gateway <a href="https://medium.com/tensult/aws-transit-gateway-1c7bb1ef702b">click here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*ES-VIRrXGC1IQ4lhbUdNfA.jpeg" /></figure><p>Once you have done with the above steps, you need to go to the Direct Connect page from the console → click Transit Gateways</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gxCzsWOyJXrqCbIBHQp-oQ.jpeg" /></figure><p>Click on the transit gateway id → Direct Connect gateway association → Associate Direct Connect gateway</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jqp9CjhBChJkTzGXKDiSCg.jpeg" /></figure><p>From the association page, select as My Account and select the direct connect gateway from the list and specify the VPC CIDR to advertise through direct connect gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DMsE63ts9F2vF_3gFjlXzA.jpeg" /></figure><p><strong><em>Transit Gateway Associations — across the account:</em></strong></p><p>Create Amazon VPC’s in the multiple AWS accounts and here, created a transit gateway in account B, attach all the VPC’s into the transit gateway as shown below. To know more about creation and attachment of across account Amazon VPC’s into the transit gateway <a href="https://medium.com/tensult/aws-transit-gateway-1c7bb1ef702b">click here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*AUiz1AA_p_UgN49iKgNuJQ.jpeg" /></figure><p>Once you have done with VPC’s and transit gateway creation as shown in the above figure, go the Direct Connect console of the account B → Transit gateways →click the transit gateway →Direct Connect gateway association → Associate Direct Connect gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l58jE7fS11KoXgaHkuaeyg.jpeg" /></figure><p>Select the Account owner as Another account and provide the direct connect gateway ID from the account D and also specify the account ID of the account D as shown above.</p><p>You can associate 3 transit gateways per direct connect gateway. To know more about the limitation of the Direct Connect <a href="https://docs.aws.amazon.com/directconnect/latest/UserGuide/limits.html">click here</a>.</p><h3>Conclusion</h3><p>Using Direct Connect service, you establish private link connectivity between AWS environment and your on-premises DC with secure, low latency, elasticity, and low bandwidth cost.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7cc35eb8943" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Network Error: Connection refused — AWS]]></title>
            <link>https://medium.com/@jawad846/network-error-connection-refused-aws-ef43b7a3b17e?source=rss-f4b23cb96e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef43b7a3b17e</guid>
            <category><![CDATA[ec2-instance]]></category>
            <category><![CDATA[application]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[error]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Mohamed Jawad P]]></dc:creator>
            <pubDate>Tue, 28 May 2019 07:49:39 GMT</pubDate>
            <atom:updated>2022-05-24T07:31:15.619Z</atom:updated>
            <content:encoded><![CDATA[<h3>Network Error: Connection refused — AWS</h3><p>Have you faced a Fatal Error while accessing your AWS EC2 instances? What are the alternatives if the SSH access fails to the EC2 instance?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xw6mhKtaVuyDDCKcrevZTg.jpeg" /><figcaption>Figure — 1</figcaption></figure><p>Suppose you are an AWS infra deployment person in your organization and if suddenly one of your customers says that he can’t access his application server and also gets the Fatal Error — <em>“Network error: Connection refused”, </em>then what should be the response from you to the customer?</p><p>Firstly, you will check the security groups and network connectivities to the instance, once it’s ok, then you need to try and connect to the instance using AWS SSM Session Manager if all the prerequisites are met.</p><p>In this scenario, If you connected with AWS SSM Session Manager, still you can’t able to access any users of that instance. This could be very challenging because there are no other methods to connect that instance.</p><p><strong><em>Error Details:</em></strong></p><p>While the customer is setting up their application on the Linux machine, there are multiple application files and folders created on the machine. Usually, the application files will be in /mnt or /opt directories. Some of the customers keep their application configuration files in /etc folder.</p><p>Here, some of the applications will create an application user, and the application will run and access the application files using this application user. This application user also tries to access the application configuration file which is inside /etc folder. You will get the error as <em>“permission denied” </em>because folder /etc can only be accessed by root users.</p><blockquote>So, Some of the clients who are not familiar with Linux file permissions, they will perform “<strong><em>sudo chmod -R 777 /”</em></strong> or “<strong><em>sudo chmod -R 777 /etc</em></strong>” commands to allow the permission to the application users to access the /etc folder, which sounds pretty straightforward, right?</blockquote><p>Many don’t realize that the above step will do more harm than good.</p><p><strong><em>Solution:</em></strong></p><p>There is only one solution for this error which is detaching the root volume of that instance and attaching that root volume to the newly launched Linux instance. Then mount that volume into the Linux machine and change the permission of the files and folders as previously.</p><p><strong><em>Conclusion:</em></strong></p><p>The configuration file of the application is not mandatory to be kept inside /etc. You can also use other directories to keep the application configuration files as well. The only thing you need to change is the configuration file path in the application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef43b7a3b17e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Domain Join Automation: AWS SSM & Terraform]]></title>
            <link>https://medium.com/@jawad846/domain-join-automation-aws-ssm-terraform-96a031c70f40?source=rss-f4b23cb96e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/96a031c70f40</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[sms]]></category>
            <category><![CDATA[domain-join]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Mohamed Jawad P]]></dc:creator>
            <pubDate>Thu, 14 Feb 2019 06:25:40 GMT</pubDate>
            <atom:updated>2021-02-02T08:33:13.251Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog will help you to automate the domain join process by using Amazon System Manager and Terraform.</p><p>Let&#39;s talk about what is a domain?</p><p>The domain is a logical security boundary that holds all the information of the objects within its boundary. Now, to manage all the objects within the boundary you need centralized management. Active Directory (AD) is a Directory service that provides you with a centralized platform for managing Users, Computers, Groups, OUs, Group Policies, and several other things that administrators require to manage on daily basis. A server running Active Directory Domain Services (AD DS) is called a Domain Controller.</p><p>In AWS Environment, you can easily set up AD by launching AWS EC2 instance with windows server or you can use AWS Directory Service. To know more about AWS Directory Service read our previous blog on the topic <a href="https://medium.com/tensult/microsoft-ad-with-aws-directory-service-63ce47823c74">here</a>.</p><p>Once the AD setup is completed, you need to join the computers/workspaces, servers, and other devices to the domain. There are a few steps for the domain join process:</p><ol><li>Change/Assign the DNS Entry</li><li>Change the Hostname</li><li>Reboot the system</li><li>Join the domain using the credentials</li><li>Again reboot</li></ol><p>This is a process that will consume a lot of time if you have thousands of workspaces in your company. You can easily automate this process using the Amazon Systems Manager (SSM). To know more about AWS SSM read our previous blog on the topic <a href="https://medium.com/tensult/aws-ssm-introduction-e045b40e57e8">here</a>. To set up AWS System Manager you need to follow the <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-setting-up.html">prerequisite</a> document.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*pZBD9y3TRIUxEIXhKTEB9g.jpeg" /></figure><p>Here the challenge is to install the Amazon-SSM-Agent in the target instance as per the prerequisite of the AWS SSM document. In most of the AWS AMI already pre-installed Amazon-SSM-Agent, if it is not installed you can use “<a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html">user data</a>” while launching the instance or else install Amazon-SSM-Agent in a newly launched instance on all the flavors of OS and create an image on it. Use this image to spin the instances.</p><p><a href="https://www.terraform.io/">Terraform</a> automation tool is used to automate the creation process of the SSM Documents and SSM Parameter stores in AWS Account. SSM Parameter store is used to store credentials and other domain information. These parameter store values are used for Domain join in SSM Document scripts.</p><p>Use the below link, to store the domain join credentials values like domain name, username, password, etc.. in the SSM Parameter store using terraform script.</p><pre><a href="https://github.com/tensult/terraform/blob/master/aws/domain-join-setup/ssm.tf">https://github.com/tensult/terraform/blob/master/aws/domain-join-setup/ssm.tf</a></pre><p>The first step in this process is to change the DNS entry of the target instances. To change DNS entry, run a terraform script from the below link to set the VPC “<a href="https://docs.aws.amazon.com/vpc/latest/userguide/VPC_DHCP_Options.html">DHCP Options Sets</a>” using the IP Address of the AD and VPC DNS.</p><pre><a href="https://github.com/tensult/terraform/blob/master/aws/domain-join-setup/dhcp.tf">https://github.com/tensult/terraform/blob/master/aws/domain-join-setup/dhcp.tf</a></pre><p>Next, you need to install a few services in all the target instances like AWS-CLI, realm, sssd, etc… For that, you need to create an SSM run command document to install these services.</p><p>In Windows, you require only AWS-CLI service for this domain join process. Use the below terraform script link for creating an SSM run command document to install the AWS-CLI service.</p><pre><a href="https://github.com/tensult/terraform/blob/master/aws/agent-install/aws-cli.tf">https://github.com/tensult/terraform/blob/master/aws/agent-install/aws-cli.tf</a></pre><p>In Linux, you need to install services like AWS-CLI, realm, sssd, etc. for that you need to create an SSM run command document to install these services. Use the terraform script link shown below to create the document.</p><pre><a href="https://github.com/tensult/terraform/blob/master/aws/domain-join-setup/dependencies.tf">https://github.com/tensult/terraform/blob/master/aws/domain-join-setup/dependencies.tf</a></pre><p>Once the SSM document is created, you can run this document from AWS System Manager Console → Run Command. You can run this document to multiple target instances at the same time.</p><p>Coming to the domain join process, the first step is to change the hostname of the machine. Here the hostname will be different for each instance. This challenge is solved using the EC2 instance tag. Add a hostname tag in all the EC2 instances as “key=hostname value=&lt;hostname&gt;”. AWS CLI will fetch this tag value and change the hostname of the Instance using the SSM document. Find the terraform script below the link to create an SSM run command document for changing the hostname.</p><pre><a href="https://github.com/tensult/terraform/blob/master/aws/domain-join-setup/hostname.tf">https://github.com/tensult/terraform/blob/master/aws/domain-join-setup/hostname.tf</a></pre><p>Run this document with respect to the OS type. Once the process is successful, the target instances will be restarted.</p><p>After a successful reboot of the target instance, you need to perform the domain join step. For that, visit the GitHub link shown below, to create an SSM run command document using a terraform script and run it with respect to the OS type of the target instance to join the domain.</p><p>For Windows:</p><pre><a href="https://github.com/tensult/terraform/blob/master/aws/domain-join-setup/windows.tf">https://github.com/tensult/terraform/blob/master/aws/domain-join-setup/windows.tf</a></pre><p>For Linux:</p><pre><a href="https://github.com/tensult/terraform/blob/master/aws/domain-join-setup/linux.tf">https://github.com/tensult/terraform/blob/master/aws/domain-join-setup/linux.tf</a></pre><h4><strong>Conclusion</strong></h4><p>Once all the SSM documents are run successfully, the domain join process will be completed. You can also verify using the “nslookup” command.</p><p>Instead of running the terraform script separately, You can also run and create the entire SSM run document in a single step by downloading the entire script from our GitHub link shown below:</p><pre><a href="https://github.com/tensult/terraform/tree/master/aws/domain-join-setup">https://github.com/tensult/terraform/tree/master/aws/domain-join-setup</a></pre><p>In the above processes, you need to run 3 SSM run command documents to complete this Domain join process. Instead of using the SSM Run Command document, you can also use the AWS SSM Automation document to complete it in a single step. Go to the below link to create an SSM Automation document for the domain join process using terraform script.</p><pre><a href="https://github.com/tensult/terraform/tree/master/aws/ec2-launch-automation">https://github.com/tensult/terraform/tree/master/aws/ec2-launch-automation</a></pre><p>This script also helps you to automatically trigger the domain join automation process once the instance is launched successfully. To trigger this automation you need to use <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html">AWS Cloudwatch Event Rule</a> and <a href="https://docs.aws.amazon.com/lambda/latest/dg/welcome.html">AWS Lambda</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96a031c70f40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Transit Gateway]]></title>
            <link>https://medium.com/@jawad846/aws-transit-gateway-1c7bb1ef702b?source=rss-f4b23cb96e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c7bb1ef702b</guid>
            <category><![CDATA[vpc]]></category>
            <category><![CDATA[transit]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[routing]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[Mohamed Jawad P]]></dc:creator>
            <pubDate>Wed, 02 Jan 2019 07:46:33 GMT</pubDate>
            <atom:updated>2020-04-12T05:33:18.756Z</atom:updated>
            <content:encoded><![CDATA[<p>Transit Gateway is an awesome feature announced by Amazon Web Service to simplify the network connectivity. In the previous scenario, you had to use VPC Peering or Transit VPC concept to form transitive nature. Using peering connection you had to implement a full mesh topology with the AWS VPC’s to make communication between each other. In VPC Peering you can’t create or connect VPN connections with an on-premises network. To know more about VPC Peering <a href="https://medium.com/tensult/vpc-peering-26346a4c0b9c">click here</a>.</p><p>In the Transit VPC concept you need to launch an AWS Marketplace VPN Appliance to the EC2 instance and connect all the network (VPC’s and on-premises) to the VPN Appliance using the VPN connection. This will increase the cost and maintenance. To know more about the Transit VPC concept <a href="https://medium.com/tensult/transit-vpc-7301ac57240a">click here</a>.</p><p>Using AWS Transit Gateway, you can easily implement the transitive network architecture within a few clicks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*0Bs7LyDUP3LqHsSeyXr7qw.jpeg" /><figcaption>Figure — 1</figcaption></figure><p>To implement the transitive network using Transit Gateway first, go to the VPC Console and Create VPCs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tll3mcsZysbX4F0IFpjBzg.png" /><figcaption>Figure — 2</figcaption></figure><p>Next, create Transit Gateway for that: VPC console → Transit Gateway → Create Transit Gateway</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FNrUUi-XYYx-ugYU35Kv0g.png" /></figure><p>Fill the Field with Name and Description. <strong>ASN</strong> is the Autonomous System Number of your Transit Gateway, You can use the range from 64512–65534 or 4200000000–4294967294. <br><strong>Equal-Cost Multi-Path</strong> (ECMP) is a routing strategy for forwarding the packets to the next-hop using the best path. You can check for creating ‘Default route table association and propagation’ or else you can create it later.<br>If you are planning to connect the VPCs from a different account you need to check ‘<strong>Auto accept shared attachments’ </strong>to see the cross-account transit gateway attachments automatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wIo9dCVPZYtWgiLlcym3kA.png" /></figure><p>After creating the Transit Gateway, you need to attach the VPCs or create VPNs to make a transitive nature. For that,<br>VPC Console → Transit Gateway Attachments → Create Transit Gateway Attachment</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3qSba79vw_GB6cd4QrHmgA.png" /></figure><p>Select the Transit Gateway from the ‘Transit Gateway ID’ list and check either VPC or VPN attachment.</p><p><strong><em>VPC Attachment:</em></strong><br>In VPC Attachment, specify the attachment name and then select the VPC from the ‘VPC ID’ list which you want to attach with transit gateway. You need to select at least one subnet from the list of subnets, but you can select only one subnet per Availablity Zone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f35656l_HHut-pIkE7Gnqg.png" /></figure><p><strong><em>VPN Attachment:</em><br></strong>In VPN Attachment, you need to define Customer Gateway to create a VPN connection to On-Premises or other Routing devices in the cloud. You can create a new Customer Gateway or select from the ‘Customer Gateway ID’ if you had already created. After creating the VPN Connection you need to download the configuration file from the ‘VPN Connection’ console. To know more about VPN Connection <a href="https://medium.com/tensult/shared-service-vpc-5698d743d95b">click here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OW6g6jUYbS_rL4ClKT4_tQ.png" /></figure><p>Once the attachment is completed, you can see the attached VPCs or VPNs on the ‘Transit Gateway Attachment’ console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VYVH_9IDw7oz7-8z41At8w.png" /></figure><p>If you had already checked ‘Default route table association’ and ‘Default route table propagation’ in the above steps, it will create automatically ‘Transit Gateway Route Table’ with Propagations and Associations.<br>If not checked, you need to create a ‘Transit Gateway Route Table’ with Associations and Propagations for each Attachment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kt6XVIoCGObEDKJYxjhbyg.png" /></figure><p>You can also create more route entries in the Transit Gateway Route Table with Transit Gateway Attachments. To create new Routes,<br>Transit Gateway Route Tables → Select ‘Route Table’ → ‘Routes’ Tab</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZIGahDx3dBurIdojAU15Vw.png" /></figure><p>Once you complete this, you need to update VPC Route Table.<br>VPC Console → Route Tables → Select the route table belonging to the VPC which is attached to Transit Gateway → tab ‘Routes’ → Edit Routes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dxCJen0q9c06ZR_-e_UgPA.png" /></figure><p><strong>Cross-Account:</strong></p><p>If you want to connect VPCs to the Transit Gateway from outside of the AWS Account within the same region, you need to share the Transit Gateway using Resource Access Manager. For that,<br>AWS Console → Resource Access Manager → Resource share → Create resource share.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KdozMELMwC-yd5pdsPWnhg.png" /></figure><p>From the new window, Give the name for the resource to share and ‘select resource type’ as ‘Transit Gateway’. Select the transit gateway which would like to share from the list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U9-B1IW45xtfC-4tA2pd2g.png" /></figure><p>Provide the AWS Account ID of the account for which you want to share the resource and also mention the tag. Then click ‘Save changes’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZjtDOolkiTVNQhnFr2_QAQ.png" /></figure><p>Now, log in to the AWS account where you have shared the Resources, and go to the AWS Console → Resource Access Manager → Resource shares.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9YzU3d-qkOR_7YpMLGzxdg.png" /></figure><p>You will get a resource invitation with account id, from the account which you had shared the resource. Select the resource from the page, and click ‘Accept resource share’ to avail this resource in the AWS Account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GSM7kjyd59KHuHwU36UV7Q.png" /></figure><p>Once you have completed the process, the Transit Gateway which you have shared will be available on this AWS Account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iftjuVxgK9-7DuZSKhjiEw.png" /></figure><p>Now, you can follow the same steps as above to attach the VPC’s and VPN’s of this account to the shared Transit Gateway.</p><p><strong>Limitations:</strong></p><ol><li>Transit VPC can’t initiate the Traffic</li><li>You can’t share the Transit Gateway to a different region in a single account or cross-account.</li></ol><h4>Conclusion</h4><p>You can easily create a <a href="https://medium.com/tensult/transit-vpc-7301ac57240a">transitive network</a> in the AWS infra using the AWS Transit Gateway service instead of using the AWS Marketplace VPN Appliance. This way you can easily connect VPC’s and VPN’s to the AWS Transit Gateway within the account or cross-account within the same region.</p><p><em>This Blog has been moved from Medium to </em><a href="https://blogs.tensult.com/2019/01/02/aws-transit-gateway/"><em>blogs.tensult.com</em></a><em>. All the latest content will be available there. Subscribe to our </em><a href="https://blogs.tensult.com/newsletter"><em>newsletter</em></a><em> to stay updated.</em></p><h4>Related blogs</h4><p><a href="https://medium.com/tensult/transit-vpc-7301ac57240a">Transit VPC Using Cisco CSR 1000v — AWS</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c7bb1ef702b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FortiGate IPSec Remote VPN: AWS]]></title>
            <link>https://medium.com/@jawad846/fortigate-ipsec-remote-vpn-aws-9783ade723cd?source=rss-f4b23cb96e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/9783ade723cd</guid>
            <category><![CDATA[firewall]]></category>
            <category><![CDATA[remote-working]]></category>
            <category><![CDATA[vpn]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[fortinet]]></category>
            <dc:creator><![CDATA[Mohamed Jawad P]]></dc:creator>
            <pubDate>Wed, 19 Dec 2018 06:07:26 GMT</pubDate>
            <atom:updated>2021-03-14T05:18:10.857Z</atom:updated>
            <content:encoded><![CDATA[<h3>Fortinet FortiGate IPSec Remote VPN: AWS</h3><p>To know more about launching and Configuring of Fortinet FortiGate Firewall in AWS EC2 Instance <a href="https://medium.com/tensult/transit-vpc-using-fortinet-fortigate-vm64-aws-2386bfcb1658">click here</a>. This blog is a part of <a href="https://medium.com/tensult/transit-vpc-using-fortinet-fortigate-vm64-aws-2386bfcb1658">Transit VPC</a>.</p><p>OS: FortiOS<br>Version: 6.0+</p><p>You can easily connect to your Corporate Network from your home network remotely using Fortigate Firewall and FortiClient in a secure connection over TCP/IP network. The Internet Security Association and Key Management Protocol(ISAKMP), also called IKE, is the protocol used to connect corporate Networks and a Remote PC. Each ISAKMP is divided into two sections called Phase1 and Phase2. To know more about VPN protocols <a href="https://medium.com/tensult/vpn-configuration-aws-c60d9eb0059d">click here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*7v57BwuYZBAcB1nJuob_xA.png" /><figcaption>Figure — 1</figcaption></figure><p>To Setup Client-to-Site VPN over IPSec in AWS Environment, open the below-mentioned port numbers in the FortiGate Firewall’s Security Group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-kLP5yvJHi47YPh8SHKjvg.png" /><figcaption>Figure — 2</figcaption></figure><p>Login to the FortiGate Firewall using the username and password and define an AWS Subnet range which belongs to Fortigate instance.<br><strong>Policy &amp; Object → Addresses → Create New → Address</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2pyEe3uF1MUjJqZxhKG7ZQ.png" /><figcaption>Figure — 3</figcaption></figure><p>Mention the Local IP Range with CIDR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*o7x8cmyz7J7RBx2KHJV2hQ.png" /><figcaption>Figure — 4</figcaption></figure><p>Now Create a Remote user to Authenticate with FortiGate Firewall. You can also create users with your AD users, This blog creates a Local User:<br>Go to <strong>User &amp; Device &gt; User Definition</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*YGcA9gvAnXF6TSV_ONAegg.png" /><figcaption>Figure — 5</figcaption></figure><p>Give the Username and Password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*Z5dyNutWqozeaNypKeaaOg.png" /><figcaption>Figure — 6</figcaption></figure><p>Email Address is optional</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*CErUB9Xp0LT_M5zpgrU7_g.png" /><figcaption>Figure — 7</figcaption></figure><p>If you had already created Groups, you need to specify the group which this user belongs to. For that specify in the ‘User Group’ field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*Ua_mUSdcWTCllTNApYlu-Q.png" /><figcaption>Figure — 8</figcaption></figure><p>If you have not already created any groups, <br>Go to <strong>User &amp; Device &gt; User Groups</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*TloKP_tYKwLf9wTCyCkyzg.png" /><figcaption>Figure — 9</figcaption></figure><p>You need to specify the users who belong to this Group in the ‘Members’ field.</p><p>Next, let’s create a Remote Access VPN Connection. For that go to VPN → IPSec Tunnels → Create New</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*znolPOukqUpU3klxmOwvsg.png" /><figcaption>Figure — 10</figcaption></figure><p>Mention the Name and select the Template type as Remote Access. Specify the Client type from the ‘Remote Device type’. You can also configure using the ‘Custom’ Template. This blog is about FortiClent.</p><p>Here if you launch the FortiGate Firewall by default, there will be only a single interface called ‘port1’. You can use either the same or attach one more interface into the instance and reboot the FortiGate Firewall.</p><p>Select the ‘Incoming Interface’ and mention the Authentication Method as ‘Pre-Shared Key’ and specify the pre-shared key.</p><p>Define the User Group which is created using the above steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*Ssc6UEQlDmkU8M8tihc1pQ.png" /><figcaption>Figure — 11</figcaption></figure><p>Next, select the ‘Local Interface’ and Mention the ‘Local Address’ that is created by the above step.</p><p>Specify the ‘Client Address Range’ to assign Remote PC. The IP Range should differ from the Corporate Network Range.</p><p>Enable ‘Enable IPv4 Split Tunnel’ if you want to restrict the internet traffic going through FortiGate Firewall from Remote PC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*Q5sGGFWbd4OB8nEommQ10w.png" /><figcaption>Figure — 12</figcaption></figure><p>Next, create the Remote VPN.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*d0DzTBe19si3x0rvGAk8VA.png" /></figure><p>By default, a policy will be created once the Remote VPN setup is done. If you want to communicate with networks other than Local Network, create new policies for those networks also. To know more about creating policies <a href="https://medium.com/tensult/vpn-setup-using-fortinet-fortigate-firewall-vm64-aws-c4555eb3d86a">click here</a>.</p><blockquote>Note: Disable the NAT while creating the policies.</blockquote><p>Next: Add Static Route, Go to Network → Static Routes → Create New</p><p>Add Client Address Range with CIDR in the ‘subnet’ part and mention the interface as a remote VPN interface. Here,</p><p>Subnet: 192.168.31.0/24<br>Interface: remote VPN</p><p>It looks good, Now access the Remote PC and download &amp; Install FortiClient on it. After installing, open FortiClent and go to Remote Access → Click on Configure VPN.</p><p>Select VPN → IPSec VPN, and give a connection name. Mention the Public IP Address of the interface in Remote Gateway, which is specified in Incoming Interface in the above steps. The Pre-shared key must be the same as to mention in the configuration of Remote VPN in the FortiGate Firewall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*_dr7eXjllF-FH75q5s9FZg.png" /><figcaption>Figure — 14</figcaption></figure><p>Click on ‘Save login’ and enter the username of the user which was created in User Definition in Fortigate Firewall and Save it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*ZM20JOTjzEOAUBnHNc-vlg.png" /><figcaption>Figure — 15</figcaption></figure><p>Enter the password and click on ‘connect’.<br>If everything is properly done, you should be able to see a window just like the below screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*QEhh0QJSRegYhSwkrRcacw.png" /><figcaption>Figure — 16</figcaption></figure><p>Once the connection becomes successful, Fortigate Firewall will assign you an IP Address from the ‘Client Address Range’.</p><p><strong>Conclusion:<br></strong>Now you have learned about to setup Client-to-Site IPSec VPN using Fortigate Firewall. Follow these above steps to connected with your corporate network using your remote PC in the home network. Please try it out and in case you face any issues, feel free to contact me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9783ade723cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Transit VPC Using Fortinet FortiGate-VM64]]></title>
            <link>https://medium.com/@jawad846/transit-vpc-using-fortinet-fortigate-vm64-aws-2386bfcb1658?source=rss-f4b23cb96e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/2386bfcb1658</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[vpn]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[firewall]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Mohamed Jawad P]]></dc:creator>
            <pubDate>Thu, 20 Sep 2018 07:50:32 GMT</pubDate>
            <atom:updated>2019-12-09T12:00:47.418Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Pre-requisites</strong></p><p>To understand some of the concepts discussed in this post, familiarity with Transit VPC concepts and Terminology is recommended before you start. Please go through our other post titled “<a href="https://medium.com/tensult/connect-vpcs-to-make-network-of-networks-in-aws-f44ab3ded0ed"><em>Connect VPCs to make Network of Networks in AWS</em></a>”.</p><p>The transitive network can also be achieved by using the high-performance Routers, such as Cisco CSRs in the Transit VPC. To know more about the set-up and configuration of Transit VPC using Cisco CSR 1000v router, read our earlier blog post <a href="https://medium.com/tensult/transit-vpc-7301ac57240a">here</a>.</p><p>However, the main purpose of running VPN tunnels is to have security and encryption in transit. You also won’t be able to achieve advanced filtering and protection by using the Routers. For that, you need to use a Next-Generation Firewall which also does L7 Application controls, Anti-virus, IPS, Web filtering and VPN, etc. This blog focus on to explain the set-up of <a href="https://aws.amazon.com/marketplace/pp/B00PCZSWDA"><strong><em>Fortinet FortiGate Next-Generation Firewall</em></strong></a> on Transit VPC instead of using a Router.</p><p>This is a 2 part blog where we cover the launching of the Fortinet device and initial AWS transit VPC setup here. The <a href="https://medium.com/tensult/vpn-setup-using-fortinet-fortigate-firewall-vm64-aws-c4555eb3d86a">second part</a> will describe the configuration steps to be done on the FortiGate Firewall to create VPN connections with other VPCs and on-premise networks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*WvqCtOymnOpsMgn-lwnJHw.jpeg" /><figcaption>Figure — 1</figcaption></figure><p>First, log in to the AWS console and set-up your VPC’s as required. And consider one VPC as public-facing and the other as a Private VPC. Treat the public-facing VPC as Transit VPC and other(s) will be Spoke VPCs. To know more about VPC set-up, you should read the AWS provided VPC administrator guide <a href="https://docs.aws.amazon.com/vpc/latest/adminguide/Welcome.html">here</a>.</p><p>To launch Fortinet FortiGate Next-Generation Firewall on your Transit VPC, you need to select the required AMI from the AWS Marketplace and launch it into an EC2 instance. For that Please follow the below steps:</p><p>Go to EC2 console → Instance → Launch Instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vvWdKTAAFYaUiVvm9MJxkg.png" /><figcaption>Figure — 2</figcaption></figure><p>Click on AWS Marketplace → Type Fortigate on Search bar → And Select the Fortinet Flavors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S_b04eZevuFt3P_Pm8MMTw.png" /><figcaption>Figure — 3</figcaption></figure><p>You will get a pop window, it explains the pricing and Instance type of the FortiGate Firewall. Click on Continue</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w3HhfuXO2mCc0WdK1_YXEA.png" /><figcaption>Figure — 4</figcaption></figure><p>Next: Select the VPC (Transit VPC) and Subnets. Make it auto-assign Public IP “Disable” (you should attach an Elastic IP later). If you need to specify any particular private IP assign it, else leave blank. Then click on Next: Add Storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aJKHup9g5X1AVYZMQq3uAQ.png" /><figcaption>Figure — 5</figcaption></figure><p>Next: By default, storage will be added and make it Root volume as SSD. Also if you have any specifications or any other requirements on storage volumes, you can specify here. Then click on Next: Add Tags.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L2FhXei479C1ar59LJ6jcQ.png" /><figcaption>Figure — 6</figcaption></figure><p>Add Tags and Click on “Next: Configure Security Group”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-JQg6dopm6N0bT_y_Az3GQ.png" /><figcaption>Figure — 7</figcaption></figure><p>By default, Fortigate Firewall AMI allows the port numbers as per its requirements. You can also add more rules as per your specific requirements. Then, Click on Review and Launch → Click on Launch from the next window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MYo6mHmd8eSYwfHgRgeIFA.png" /><figcaption>Figure — 8</figcaption></figure><p>After Clicking on “Launch” Select or Create a new key pair and then, Launch the instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SBNJsfN4AS7n-VUZwZWi-g.png" /><figcaption>Figure — 9</figcaption></figure><p>To access the FortiGate Firewall, create an Elastic IP and Assign to the instance. For that, Go to EC2 console → Elastic IP →Allocate new address</p><p>After that, Assign this Elastic IP to the Instance or Network Interface</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uJzqmoCSPQrjaztg84KEAA.png" /><figcaption>Figure — 10</figcaption></figure><p>From next window, Select the Fortigate instance and associated private IP and then Click on Associate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SBevixDmb18rIup4PRgq2Q.png" /><figcaption>Figure — 11</figcaption></figure><p>Using this Elastic IP, Access Fortigate Firewall through the web browser, for example, <a href="https://1.2.3.4/">https://1.2.3.4</a>.<br>From next window on your browser Click on ADVANCED → Proceed to 1.2.3.4 (unsafe)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PsvIcuw98gnmCk3iLlncUQ.png" /><figcaption>Figure — 12</figcaption></figure><p>Next, You will get an authentication Page.<br>Username: admin<br>Password: &lt;you FortiGate instance ID&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*hF-4UvsWMGdEIxhACV8AXw.png" /><figcaption>Figure — 13</figcaption></figure><p>After the successful authentication, you will get the following window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*POv7mgvQGnh2NIaiMS5OWA.png" /><figcaption>Figure — 14</figcaption></figure><p>Next, you need to set-up VPN tunnels with Spoke VPC’s and On-premises DC to achieve a transitive nature.</p><p><strong>VPN Setup: Transit VPC — Spoke VPC</strong></p><p>To Set-up a VPN tunnel with Spoke VPC’s: First, you need to configure AWS Managed VPN in all the Spoke VPC’s by using the FortiGate Firewall Elastic IP as Customer Gateway. To know more about the set-up of AWS Managed VPN <a href="https://medium.com/tensult/shared-service-vpc-5698d743d95b">click here</a>.<br>Download the VPN configuration file from the “VPN Connection Console” and select the vendor: Fortinet → Platform: Fortigate 40+ Series → Software: FortiOS 5.0+ (GUI), which will help to set-up the VPN tunnel in Fortigate Firewall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-msnB3HXv5S7AizULzP5Rg.png" /><figcaption>Figure — 15</figcaption></figure><p>After that, Set-up VPN connection in the FortiGate Firewall for the configuration file of the AWS Managed VPN set-up. <a href="https://medium.com/tensult/vpn-setup-using-fortinet-fortigate-firewall-vm64-aws-c4555eb3d86a">Click here</a> to know more about the VPN set-up in the FortiGate Next-Gen Firewall.</p><blockquote>Note: Disable Source/Destination Check</blockquote><p><em>AWS EC2 Console → Select the FortiGate Firewall instance → Actions → Networking → Change Source/Dest. Check → Yes, Disable</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cbFmBPojWzxJCknCG-VgOg.png" /><figcaption>Figure — 16</figcaption></figure><p><strong>VPN Setup: Transit VPC — On-premises DC</strong></p><p>To set-up a VPN between Transit VPC and On-premises Data Center (DC) L3 device, you first need to create a VPN configuration in the On-premises L3 device with the details of the FortiGate Firewall public IP. Use our previous blog on <a href="https://medium.com/tensult/vpn-configuration-aws-c60d9eb0059d">VPN Configuration</a> as a reference.</p><p>Once the on-premise configuration is completed, use the public IP and Tunnel IP details, configure the VPN, routing protocols, and policies in the AWS FortiGate Next-Gen Firewall (launched above) to form the VPN tunnel with the On-premises L3 device. To know more about the set-up of FortiGate Next-Gen Firewall and VPN, read the second part <a href="https://medium.com/tensult/vpn-setup-using-fortinet-fortigate-firewall-vm64-aws-c4555eb3d86a">here</a>.</p><p><em>This Blog has been moved from Medium to </em><a href="https://blogs.tensult.com/2018/09/20/aws-transit-vpc-using-fortinet-fortigate-vm64/"><em>blogs.tensult.com</em></a><em>. All the latest content will be available there. Subscribe to our </em><a href="https://blogs.tensult.com/newsletter"><em>newsletter</em></a><em> to stay updated.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2386bfcb1658" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS VPN Setup Using Fortinet FortiGate Firewall-VM64]]></title>
            <link>https://medium.com/@jawad846/vpn-setup-using-fortinet-fortigate-firewall-vm64-aws-c4555eb3d86a?source=rss-f4b23cb96e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4555eb3d86a</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[vpn]]></category>
            <category><![CDATA[fortinet]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Mohamed Jawad P]]></dc:creator>
            <pubDate>Thu, 20 Sep 2018 07:12:48 GMT</pubDate>
            <atom:updated>2019-04-30T06:05:59.761Z</atom:updated>
            <content:encoded><![CDATA[<p>FortiGate Next-Generation Firewall technology delivers complete content and network protection by combining stateful inspection with a comprehensive suite of powerful security features. Application control, antivirus, IPS, Web filtering and VPN along with advanced features such as an extreme threat database, vulnerability management and flow-based inspection work in concert to identify and mitigate the latest complex security threats. To know more about FortiGate Next-Generation Firewall <a href="https://aws.amazon.com/marketplace/pp/B00PCZSWDA">click here</a>.</p><p>This blog helps you to configure a VPN set-up with AWS VPC’s/On-premises Data Center (DC) by using FortiGate Next-Generation Firewall in the AWS <a href="https://medium.com/tensult/connect-vpcs-to-make-network-of-networks-in-aws-f44ab3ded0ed">Transit VPC</a>.</p><p>To know more about the launching of the FortiGate Next-Generation Firewall in AWS EC2 instance <a href="https://medium.com/tensult/transit-vpc-using-fortinet-fortigate-vm64-aws-2386bfcb1658">click here</a>.</p><p>To access the FortiGate Firewall, Use Public IP of the AWS EC2 instance and access through a web browser.<br>For example — <a href="https://1.2.3.4/">https://1.2.3.4</a></p><p>Before starting, Make sure that you had configured AWS Managed VPN in the AWS VPC’s and Downloaded the Configuration file. Using the AWS Managed VPN set-up configuration file follow the below steps:<br>(To know more about AWS Managed VPN set-up <a href="https://medium.com/tensult/shared-service-vpc-5698d743d95b">click here</a>)<br>VPN → IPsec Tunnels → Create New</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u8RBBBWfh6miBoH3AX-fnQ.png" /><figcaption>Figure — 1</figcaption></figure><p>Next, Click on Custom and the give a tunnel name. Then click on “Next”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h8RgyYCg6n1u2_DDEJAzEQ.png" /><figcaption>Figure — 2</figcaption></figure><p>After that, Select Remote Gateway as <em>Static IP Address</em> and the IP address will be the end router IP of the AWS, which is mention in the downloaded configuration file of the AWS Managed VPN set-up.<br>Next, Select Interface as <em>port1</em>. By default, there will is only a single interface.<br>Enable the “Local Gateway” and select “Primary IP”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uLV6VDTppXXC0yGNEf3UiQ.png" /><figcaption>Figure — 3</figcaption></figure><p>Next, go down to Authentication. Copy the Pre-shared Key from the AWS Managed VPN configuration file and paste it here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sn385iBgUvobNl3WtXUG7w.png" /><figcaption>Figure — 4</figcaption></figure><p>As per the AWS Managed VPN configuration files, configure the Encryption, Diffie-Helmans Groups, and Key Lifetime in Phase 1 Proposal and Phase 2 Proposal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kM5mAcx3KmIcguPh1pExeQ.png" /><figcaption>Figure — 5</figcaption></figure><p>Phase 2 Proposal,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CB-Y8dMhoN52KmShxWcuwQ.png" /></figure><p>After Successful VPN Creation, A virtual tunnel interface is created in Network → Interfaces.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Id1Myf6lUeei3grnQQWvg.png" /></figure><p>Go to the tunnel interface, and configure the IP address of the tunnel as mentioned in AWS Managed VPN Configuration file.<br>Then, select the Administrative Access that you required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gHVl05JiVTfNq4UcEHC2CQ.png" /></figure><p>Next, Configure the Routing Protocol. In this blog, BGP routing protocol has been used.<br>To configure Routing Protocol, go to Network → BGP<br>As per the AWS Managed VPN Configuration file, enter the values of the AS number and the Router ID. And also using the same configuration file, create neighbors with remote AS number.<br>In Networks, Mention the local (Private) Networks with IP address and Mask</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RTux3Ia5470-hROcNK_O2w.png" /></figure><p>To configure Redistribution, Go to Network → BGP → Expand Advanced Options as shown in the figure below (Optional).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jhvy0PYVAncAJh1mo-WVgw.png" /></figure><p>To set-up MTU, MSS, and default routes you need configure through CLI. For that go to CLI terminal as shown in below figure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pPmkka9uq3CGxx4oo2DPgQ.png" /><figcaption>Figure —</figcaption></figure><blockquote>Note: Take the values and IP Address as per the AWS Managed VPN downloaded configuration file.</blockquote><p>Set MTU and MSS on the tunnel:</p><blockquote># config global<br># config system interface<br># edit “forte-spoke-a” → <em>change tunnel name here</em><br># set mtu 1427 <br># set tcp-mss 1379<br># next<br># end</blockquote><p>The Customer Gateway may announce a default route (0.0.0.0/0) to us, for that:</p><blockquote># config router bgp<br># config neighbor<br> # edit 172.10.10.5<br> # set capability-default-originate enable<br> # end<br> # end</blockquote><blockquote># config router prefix-list<br> # edit “default_route”<br> # config rule<br> # edit 1<br> # set prefix 0.0.0.0 0.0.0.0<br> # next<br> # end<br> # set router-id 1.2.3.4<br># end</blockquote><blockquote># config router route-map<br> # edit “routemap1”<br> # config rule<br> # edit 1<br> # set match-ip-address “default_route”<br> # next<br> # end<br> # next<br># end</blockquote><p>Next, you need to create policies to allow/deny the traffic. <br>Policy &amp; Objects → IPv4 Policy → Create New</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NSPpdKBe8GSGxw7_s1KU-Q.png" /></figure><p>Set a policy for incoming traffic from port1 and outgoing traffic through the VPN tunnel. Allow all the services from any source to any destination. Also, enable the Security Profiles.</p><blockquote>Note: You can also restrict the services from here.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AgifZYF40J9UdTjqC9FeaA.png" /></figure><p>Create another policy for incoming traffic from the VPN tunnel interface to outgoing traffic through the port1 interface. Also, enable the security profiles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0BBbLgMd8oufGTQMtAakXg.png" /></figure><p>To bring it UP the tunnel interface, go to Monitor → IPsec Monitor → Select the tunnel → Bring UP</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0sBaBhO5bMiY6fmLGNaNnQ.png" /></figure><p>After a few minutes, check the routes from Monitor → Routing Monitor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZensLluP7vouD5WvE7n-hQ.png" /></figure><p>Also, check in the AWS VPC Console.<br>AWS VPC Console → VPN Connection → Select the VPN tunnel → Tunnel Details</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z6pmwJ2NlBRtcGON4jFe6g.png" /></figure><p>Also, follow the same steps to set-up the tunnel with On-premises DC with the help of On-premises DC Router configuration.</p><p><strong>Conclusion</strong></p><p>Using the above steps, we are able to create a Transit</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4555eb3d86a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Amazon EC2: Auto Scaling]]></title>
            <link>https://medium.com/@jawad846/amazon-ec2-auto-scaling-884ea50d2d?source=rss-f4b23cb96e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/884ea50d2d</guid>
            <category><![CDATA[amazon-ec2]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[autoscaling]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Mohamed Jawad P]]></dc:creator>
            <pubDate>Tue, 24 Jul 2018 13:29:16 GMT</pubDate>
            <atom:updated>2018-07-27T11:07:17.212Z</atom:updated>
            <content:encoded><![CDATA[<p>In traditional IT world, there are limited number of servers to handle the application load. When the number of requests increases the load on the servers also increases, which causes latency and failures.</p><p>Amazon Web service provides Amazon EC2 Auto Scaling services to overcome this failure. Auto Scaling ensures that Amazon EC2 instances are sufficient to run your application. You can create an auto-scaling group which contains a collection of EC2 instances. You can specify a minimum number of EC2 instance in that group and auto-scaling will maintain and ensure the minimum number of EC2 instances. You can also specify a maximum number of EC2 instances in each auto scaling group so that auto-scaling will ensure instances never go beyond that maximum limit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*uS9J8btKCQaMOhnUXp62aA.jpeg" /></figure><p>You can also specify desired capacity and auto-scaling policies for the Amazon EC2 auto-scaling. By using the scaling policy, auto-scaling can launch or terminate the EC2 instances depending on the demand.</p><h4><strong>Auto Scaling Components</strong></h4><ol><li>Groups</li></ol><p>Groups are the logical groups which contain the collection of EC2 instances with similar characteristics for scaling and management purpose. Using the auto scaling groups you can increase the number of instances to improve your application performance and also you can decrease the number of instances depending on the load to reduce your cost. The auto-scaling group also maintains a fixed number of instances even if an instance becomes unhealthy.</p><p>To meet the desired capacity the auto scaling group launches enough number of EC2 instances, and also auto scaling group maintains these EC2 instances by performing a periodic health check on the instances in the group. If any instance becomes unhealthy, the auto-scaling group terminates the unhealthy instance and launches another instance to replace it. Using scaling policies you can increase or decrease the number of running EC2 instances in the group automatically to meet the changing conditions.</p><p>2. Launch Configuration</p><p>The launch configuration is a template used by auto scaling group to launch EC2 instances. You can specify the Amazon Machine Image (AMI), instances type, key pair, and security groups etc.. while creating the launch configuration. You can also modify the launch configuration after creation. Launch configuration can be used for multiple auto scaling groups.</p><p>3. Scaling Plans</p><p>Scaling plans tells Auto Scaling when and how to scale. Amazon EC2 auto-scaling provides several ways for you to scale the auto scaling group.</p><p><strong>Maintaining Current instance level at all time</strong>:- You can configure and maintain a specified number of running instances at all the time in the auto scaling group. To achieve this Amazon EC2 auto-scaling performs a periodic health check on running EC2 instances within an auto scaling group. If any unhealthy instance occurs, auto-scaling terminates that instance and launches new instances to replace it.</p><p><strong>Manual Scaling</strong>:- In Manual scaling, you specify only the changes in maximum, minimum, or desired capacity of your auto scaling groups. Auto-scaling maintains the instances with updated capacity.</p><p><strong>Scale based on Schedule</strong>:- In some cases, you know exactly when your application traffic becomes high. For example on the time of limited offer or some particular day in peak loads, in such cases, you can scale your application based on scheduled scaling. You can create a scheduled action which tells Amazon EC2 auto-scaling to perform the scaling action based on the specific time.</p><p><strong>Scale based on demand</strong>:- This is the most advanced scaling model, resources scales by using a scaling policy. Based on specific parameters you can scale in or scale out your resources. You can create a policy by defining the parameter such as CPU utilization, Memory, Network In and Out etc. For Example, you can dynamically scale your EC2 instances which exceeds the CPU utilization beyond 70%. If CPU utilization crosses this threshold value, the auto scaling launches new instances using the launch configuration. You should specify two scaling policies, one for scaling In (terminating instances) and one for scaling out (launching instances).</p><p>Types of Scaling polices:-</p><ul><li>Target tracking scaling:- Based on the target value for a specific metric, Increase or decrease the current capacity of the auto scaling group.</li><li>Step scaling:- Based on a set of scaling adjustments, increase or decrease the current capacity of the group that vary based on the size of the alarm breach.</li><li>Simple scaling:- Increase or decrease the current capacity of the group based on a single scaling adjustment.</li></ul><blockquote>Setup</blockquote><p>As a pre-requisite, you need to create an AMI of your application which is running on your EC2 instance.</p><ul><li><strong>Setup: Launch Configuration:</strong></li></ul><ol><li>Go to EC2 console and click on Launch Configuration from Auto Scaling</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zTpw8ukrAw5P0cQU3qN4yg.png" /></figure><p>2. From Choose AMI, select the Amazon Machine Image from My AMIs tab, which was used to create the image for your web application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k_-_WMteux_B8XS6gDaLEw.png" /></figure><p>3. Then, select the instances type which is suitable for your web application and click Next: Configure details.</p><p>4. On Configure details, name the launch configuration, you can assign if any specific IAM role is assigned for your web application, and also you can enable the detailed monitoring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LPeHBlPeKQ9066IzyL-A3g.png" /></figure><p>5. After that, Add the storage and Security Groups then go for review.<br>Note: Open the required ports for your application to run.</p><p>6. Click on Create launch configuration and choose the existing key pair or create new key pair</p><ul><li><strong>Setup: Auto Scaling Group:</strong></li></ul><ol><li>From EC2 console click on Auto Scaling Group which is below the launch configuration. Then click on create auto scaling group.</li><li>From Auto scaling Group page, you can create either using launch configuration or Launch Template. Here I have created using Launch Configuration. You can create new Launch Configuration from this page also. Since you had already created the launch configuration, you can go for creating auto scaling group by using “Use a existing launch configuration”.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F8OS8zMOgu_OJUbNYFkF1g.png" /></figure><p>3. After clicking on next step, you can configure group name, group initial size, and VPC and subnets. Also you can configure load balance with auto scaling group by clicking Advanced Details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hA3j55kDtm7kpYrYKYi3EQ.png" /></figure><p>After that click on next to configure scaling policies</p><p>4.On scaling policy page, you can specify the minimum and maximum number of instance in this group. Here you can use target tracking policy to configure the scaling policies. In metric type you can specify such as CPU utilisation and Network In or Out and also you can give the target value as well. Depending on the target value the scaling policy will work. You can also disable scale-in from here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4z7qRjvLbJ824O5yNlrUkg.png" /></figure><p>You can also use Step and simple scaling policies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dmAz80bV3AhD8duQH4eYEw.png" /></figure><p>It works based on alarm, so first create the alarm by clicking on ‘add new alarm’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*X54s-sYVXND1kZLVXBXLIw.png" /></figure><p>Here the alarm created is based on CPU utilisation above 65%. If CPU utilisation crosses 65% the auto scaling launches new instances based on the step action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IeCK5dpeaUW2ib8rx7D3FA.png" /></figure><p>You can specify more step actions based on your load, but in simple policy you can’t categorise depending on the percentage of CPU utilisation. Also you need to configure scale-in policies once the traffic become low, as it reduces the billing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FzUD1wpB5-G5ZRjb-yIyxw.png" /></figure><p>5. Next click on ‘Next: Configure Notification’ to get the notification based on launch, terminate, and fail etc. to your mail ID, and enter the tag and click on ‘Create auto scaling group’.</p><p>Note: You need to create an Elastic Load balancer on top of an auto scaling group.</p><blockquote>From now on, there will be less chances for a downtime of your application. Also if the load increases, auto scaling will scale-out (Increases) your application server as per your configuration.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=884ea50d2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>