<?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 Eric Musyoki on Medium]]></title>
        <description><![CDATA[Stories by Eric Musyoki on Medium]]></description>
        <link>https://medium.com/@ecmusyoki?source=rss-0c7a4c2cba70------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kZKyxfsYGCGWQasqujx7Og.jpeg</url>
            <title>Stories by Eric Musyoki on Medium</title>
            <link>https://medium.com/@ecmusyoki?source=rss-0c7a4c2cba70------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 22:38:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ecmusyoki/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[Creating a VPN in Azure]]></title>
            <link>https://medium.com/@ecmusyoki/creating-a-vpn-in-azure-65018d9ee537?source=rss-0c7a4c2cba70------2</link>
            <guid isPermaLink="false">https://medium.com/p/65018d9ee537</guid>
            <category><![CDATA[vpn]]></category>
            <category><![CDATA[azure-vpn-gateway]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Eric Musyoki]]></dc:creator>
            <pubDate>Fri, 02 Feb 2024 07:27:33 GMT</pubDate>
            <atom:updated>2024-02-02T07:27:33.362Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*5IgLrsCVTzqK3o6DbalmSw.jpeg" /><figcaption>Fig. Creating a VPN in Azure</figcaption></figure><p>Welcome to my blog! In today’s post, we’ll dive into the world of cloud networking and explore how to set up a Virtual Private Network (VPN) in Microsoft Azure. Before we jump into the technical details, let’s briefly discuss the concept of Azure Virtual Networks. Virtual Networks in Azure allow you to securely connect your on-premises network to the cloud and enable communication between various resources within the Azure environment.</p><p>Azure supports different VPN configurations, including Site-to-Site VPNs and Point-to-Site VPNs. Understanding the differences and use cases for each will help you choose the right setup for your specific requirements. For this blog, we will look into Point-to-Site VPN</p><h4>Step 1. Creating a Virtual Network Gateway</h4><p>Log in to the <a href="https://portal.azure.com/">Azure portal</a>.</p><ol><li>In the left-hand navigation pane, click on “Create a resource.”</li><li>In the search bar, type “Virtual Network Gateway” and select it from the results list.</li><li>Click the “Create” button to start the creation process.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*d_K7xTRQxBKfGE4Nuyg_Ug.png" /><figcaption>Fig. Create virtual gateway</figcaption></figure><p><strong><em>Configure Basic Settings</em></strong></p><p>In the “Basics” tab, fill in the necessary information:</p><ol><li>Name: Provide a unique name for Virtual Network Gateway.</li></ol><p>2. SKU: Select the SKU based on your performance and scalability needs. For this case, we will select VpnGW1 which is rated at 650mbps</p><p>3. Select the Virtual Network you want to connect to. We have selected a virtual network we created before with Address space: 10.0.0.0/16</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*Lw4j3mKT_XuKoDsPqwRYdw.png" /><figcaption>Fig. Create Virtual network gateway</figcaption></figure><p>4. Define the address range for the gateway subnet within the selected Virtual Network. We have configured10.0.1.0/24</p><p>5. Provide a unique name for the public IP address</p><p>6. Disable the active-active mode</p><p>7. Review the configuration settings in the “Review + create” tab.<br>Click the “Create” button to start the deployment process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*RIOcfbP1x7AaKKGvedPLjA.png" /></figure><p>Deployment complete!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*19Ygre3IDt-AsiY2tISgJw.png" /><figcaption>Fig. deployment complete</figcaption></figure><h4>Step 2. Configure <strong>point-to-site VPN.</strong></h4><p>Navigate to the Virtual Network Gateway we created.</p><ol><li>Under the “Settings” section, click on “Point-to-site configuration.”</li><li>Click on the “Configure now” button.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*A7xmYnh7Nl4NlaUdp8_k7w.png" /><figcaption>Fig. Configure point to site VPN</figcaption></figure><ol><li>After clicking on “Configure now” it will take us to configure an address pool we will use a different address space 172.16.1.0/24 This is the range of IP addresses that will be assigned to connecting clients.</li></ol><p>2. Choose the tunnel type for the Point-to-Site connection</p><p>3. Authentication type, select Azure certificate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*AFzQ3mvgKbv0s_-ZHQycMA.png" /></figure><p>Let’s go ahead and create a root certificate as well as a client certificate</p><p>Open up the power shell as an Administrator and enter the code below to Create Certificates</p><pre>#Create the root cert<br>$cert = New-SelfSignedCertificate -Type Custom -KeySpec Signature `<br>-Subject &quot;CN=AzureRootCert&quot; -KeyExportPolicy Exportable `<br>-HashAlgorithm sha256 -KeyLength 2048 `<br>-CertStoreLocation &quot;Cert:\CurrentUser\My&quot;  `<br>-KeyUsageProperty Sign -KeyUsage CertSign</pre><pre> # Create Client Cert<br>New-SelfSignedCertificate -Type Custom -DnsName P2SChildCert -KeySpec Signature `<br>-Subject &quot;CN=AzureClientCert&quot; -KeyExportPolicy Exportable `<br>-HashAlgorithm sha256 -KeyLength 2048 `<br>-CertStoreLocation &quot;Cert:\CurrentUser\My&quot; `<br>-Signer $cert -TextExtension @(&quot;2.5.29.37={text}1.3.6.1.5.5.7.3.2&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*wXy6mvO_HWMD9-x6tadJVA.png" /><figcaption>Fig. Generate certificates</figcaption></figure><p>Let’s go ahead and open up our client certificate on our local user</p><p>Open manage user certificates</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*XosFA4h4OCNaLMOrtMPHeQ.png" /><figcaption>Fig. Open manage user certificates</figcaption></figure><p>Click on the Personal folder then Certificates, and we will find the certificates we have just created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*Gtg6DIbTjfSAZfgAbvomXw.png" /><figcaption>Fig. Open generated certificates</figcaption></figure><ol><li><strong>Lets export the root certificate</strong></li></ol><p>Right-click on the Root cert and export.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*Vo6uE_nr0jO8_5H8tCo3Sw.png" /><figcaption>Fig. Export root certificate</figcaption></figure><p>Then hit next</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*MRw29bALrZmQTvmbe8QtUg.png" /></figure><p>Select Do not export private key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*FrvTuCURbw8X75Ik7AHx4w.png" /></figure><p>Select base 64 encoded X.509 (.CER)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*oc2Ej9hPxXSmPbQC9p7mNA.png" /></figure><p>Select the path where we will save the certificate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*Bq7KI3xhcfx-raXRs9ybfg.png" /></figure><p>Click Finish to save the certificate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*mHYnDA8DyGPxyEMvmfX0dQ.png" /></figure><p><strong>2. Let us now export the client certificate.</strong></p><p>Right-click on the Root cert and export.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*zNh9Fe3217SXb5dqfV0blg.png" /><figcaption>Fig. Export client certificate</figcaption></figure><p>For the client we will export the private key</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*2L5LmCUPiPbmRbBTI5t8UQ.png" /></figure><p>Ensure the personal information exchange is selected</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*bYhxUCgusahluk_qMXa27A.png" /></figure><p>Enter and confirm password the we’ll hit next</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*EmRGz9__ScF166aPYfT1iQ.png" /></figure><p>Enter the path where we will store the client certificate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*mS5HnmQxf3koNzif9KNqTw.png" /></figure><p>Hit finish to save the certificate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*nQrxuhnVqnG-LTP0eJub_Q.png" /></figure><p>At this point, we should have saved both the root and client certificates on the desktop.</p><p>Let us go to the desktop, right-click on the root certificate then open with notepad</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*DSINAtUwq88FQp7Pjk1d4g.png" /><figcaption>Fig, azure root certificate</figcaption></figure><p>Let us copy and go back to Azure and name and the certificate data we had just copied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*7QGuEbZJexP0iv3Qx445eg.png" /><figcaption>Fig, save certificate data on azure</figcaption></figure><p>Once done with save, let us download the VPN client</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*Ns1njoWFXSpH4sO2HuzEeQ.png" /></figure><p>After we have download, extract and install</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*6tx7ZoDx5HG18GVi3UJtVA.png" /></figure><p>After installing, let us open VPN from PC</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*crING5pl5rdZ6Qv94QVAvQ.png" /></figure><p>Then let us connect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*MIhMKfZ1Y0eqNjFh72Aoxg.png" /></figure><p>We have successfully connected to the VPN</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*7-oZ6PjGMw_hIDB2eo8_-w.png" /><figcaption>Fig. VPN connected</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*lff2R0UxACCslkfm_OTxIQ.png" /></figure><p>We have successfully configured a Point-to-Site VPN connection in Azure, allowing secure remote access to resources in your Azure Virtual Network.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65018d9ee537" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Virtual Machine in Azure]]></title>
            <link>https://medium.com/@ecmusyoki/creating-a-virtual-machine-in-azure-7ef3c36adc42?source=rss-0c7a4c2cba70------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ef3c36adc42</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[azure-virtual-machines]]></category>
            <dc:creator><![CDATA[Eric Musyoki]]></dc:creator>
            <pubDate>Wed, 31 Jan 2024 11:10:03 GMT</pubDate>
            <atom:updated>2024-01-31T11:10:03.959Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*RuXlzAI4K0qVAuBBlT4mzA.jpeg" /><figcaption>Figure: Architecture of Azure Virtual Machine</figcaption></figure><p>Cloud computing has emerged as the key component of modern IT infrastructure in today’s digital environment. Microsoft Azure is a well-known and flexible cloud service provider with many services. The creation and management of virtual machines (VMs), which enable users to deploy and scale applications with ease, is a fundamental building block of Azure’s capabilities.</p><p>Let’s dive into the world of Azure Virtual Machines and unlock the potential of cloud-based computing for your projects and enterprises</p><h4>Step 1. Sign in to the Azure Portal</h4><p>Open your web browser and navigate to <a href="https://azure.microsoft.com/en-in/get-started/azure-portal/">Azure Porta</a>l.<br>Sign in with your Azure account.</p><h4>Step 2. Navigate to the Virtual Machines service</h4><p>Once logged in, you will find dashboard on the left-hand side. Look for the “Create a resource” option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*fuNWlPmsva6kPTFwf8LxDw.png" /><figcaption>Figure: Resource groups are logical groupings of resources in Azure. These groups provide the capability to manage, secure, and monitor resources efficiently.</figcaption></figure><p>In the search bar we are going to look up for “Resource groups”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*gk0NsmggKTQHOHXlWfCDWg.png" /><figcaption>Figure: Search for “Virtual machine” in the Marketplace</figcaption></figure><p>Fill in the basic details for your new resource group:<br><strong>Subscription: </strong>Choose the Azure subscription to associate with the resource group.<br><strong>Resource group:</strong> Enter a unique name for your resource group.<br><strong>Region: </strong>Select the Azure region where you want the resource group to be located.<br><strong>Review + Create</strong><br>After entering the details, click on the “Review + Create” tab to review the configuration settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*NhUe6gAHQ6xCCC2e5iqCBw.gif" /><figcaption>Figure: Create Resource Group</figcaption></figure><h4>Step 3. Creating a Network Security Group</h4><p>In the “Search” box, type “Network Security Group.”<br>Click on “Network Security Group” under the “Services” section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*KT1AUA8vkWizjAoIr82qng.png" /></figure><p>In the “Network Security Group” section, click the “+ Add” button to start creating a new NSG.</p><p>Fill in the basic details for your new NSG:<br><strong>Subscription:</strong> Choose the Azure subscription to associate with the NSG.<br><strong>Resource group: </strong>Select an existing resource group or create a new one.<br><strong>Name:</strong> Enter a unique name for your NSG.<br><strong>Region</strong>: Choose the Azure region where you want the NSG to be located.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*hj-FwC7sWmqtfwUu1L0FSQ.gif" /><figcaption>Figure: Creating a Network Security Group (NSG) in Azure</figcaption></figure><h4>Step 4. Creating a Virtual Network</h4><p>A Virtual Network allows you to logically isolate and segment your resources in the Azure cloud. Here’s a step-by-step guide on creating a Virtual Network in the Azure Portal.</p><p>In the “Search” box, type “Virtual Network.”<br>Click on “Virtual Network” under the “Networking” section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*zWaih6H6k2eOHi4qRoJZ-A.png" /><figcaption>Figure: Creating a Virtual Network</figcaption></figure><p>In the “Virtual Network” section, click the “+ Add” button to start creating a new Virtual Network.</p><p>Fill in the basic details for your new Virtual Network(VNet)<br><strong>Subscription:</strong> Choose the Azure subscription to associate with the VNet.<br><strong>Resource group:</strong> Select an existing resource group or create a new one.<br><strong>Name:</strong> Enter a unique name for your VNet.<br><strong>Address space:</strong> Define the IP address range for your VNet (e.g., 10.0.0.0/16).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*cO4AtLmxp4X0WRfeqdDLLw.gif" /></figure><h4>Step 5. Creating a Virtual Machine</h4><p>In the “Search” box, type “Virtual Machine.”<br>Click on “Virtual Machine” under the “Services” section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*Wm4eoihZy1oqIxi2oKPMXQ.png" /></figure><p>Click the “Create” button to begin configuring your VM.</p><p>Fill out the basic information for the VM, including:</p><p><strong>Subscription: </strong>Choose your Azure subscription.</p><p><strong>Resource Group:</strong> Create a new one or use an existing resource group.</p><p><strong>Virtual Machine Name:</strong> Choose a name for your VM.</p><p><strong>Region: </strong>Choose the Azure region where your VM will be located.</p><p><strong>Image: </strong>Select an operating system image.</p><p><strong>Size: </strong>Choose the size of the VM based on your requirements.</p><p>Enter a username and password for the administrator account.<br>You can also use SSH keys for Linux VMs.</p><p>Configure the networking settings, including Virtual Network, Subnet, Public IP (if needed), and Network Security Group.</p><p>Review your settings and click the “Review + create” button.</p><p>Wait for the deployment to complete. You can monitor the progress on the Azure Portal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*iVMMX0bOK4sFcLDHOt_9vg.gif" /><figcaption>Figure: Creating a virtual machine (VM) in Microsoft Azure</figcaption></figure><p>Once the VM is deployed, you can access it using Remote Desktop Protocol (RDP) for Windows or SSH for Linux.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*60EJ4DtMDLxyz2mlbhYlqg.png" /><figcaption>Figure: VM dashboard</figcaption></figure><p>Creating a virtual machine in Azure is a straightforward process that allows you to leverage the power of the cloud for your applications and workloads. By following these steps, beginners can get started with Azure virtual machines and explore the flexibility and scalability offered by cloud computing. As one becomes more familiar with Azure, you can explore advanced configurations and services to optimize your cloud infrastructure further.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ef3c36adc42" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating an AWS EC2 Auto Scaling Group using Load Balancer]]></title>
            <link>https://medium.com/@ecmusyoki/creating-an-aws-ec2-auto-scaling-group-using-load-balancer-d0b7378940ee?source=rss-0c7a4c2cba70------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0b7378940ee</guid>
            <category><![CDATA[aws-auto-scaling]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws-load-balancer]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Eric Musyoki]]></dc:creator>
            <pubDate>Wed, 31 Jan 2024 10:50:44 GMT</pubDate>
            <atom:updated>2024-01-31T10:50:44.976Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*27Eh2-IgSsTAY_RsKGj3xg.jpeg" /><figcaption>Figure: Architecture of Auto Scaling feature on an Application Load Balancer (ALB)</figcaption></figure><p>This post will go a little further in explaining a scenario using an Auto Scaling feature on an Application Load Balancer (ALB). These features of AWS can used separately or together for elasticity and high availability. Amazon EC2 Auto Scaling automates the process of launching (scaling out) and terminating (scaling in) Amazon EC2 instances based on the traffic demand for your application. Auto Scaling helps ensure you have the correct number of EC2 instances available to handle the application load.</p><p><strong>Prerequisites</strong><br>Before we begin, make sure you have the following prerequisites in place:</p><ol><li>AWS Account: You’ll need an active AWS account. If you don’t have one, you can sign up for a free trial at <a href="https://aws.amazon.com/free/">https://aws.amazon.com/free/</a></li><li>Basic Cloud Knowledge: Familiarity with fundamental cloud computing concepts will be helpful.</li></ol><h4><strong>Step 1 . </strong>Creating a Virtual Private Cloud (VPC)</h4><p>In the AWS Management Console, locate the “Services” dropdown menu.<br>Under the “Networking &amp; Content Delivery” section, click on “VPC.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*vYd9MmXSoBPLKAF5KZhEUA.png" /><figcaption>Figure: Select VPC on AWS services</figcaption></figure><p>In the VPC Dashboard, click on the “Create VPC” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*sh1b6MuW_AYHaQsgk6uyRg.png" /><figcaption>Figure: Create VPC</figcaption></figure><p>In the VPC creation wizard, enter the following details:<br>Name tag: Provide a descriptive name for your VPC.<br>IPv4 CIDR block: Specify the IP address range for your VPC using CIDR notation 10.0.0.0/16.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*KwUmWnRoZE7VKUM9-SQErw.gif" /><figcaption>Figure: Creating VPC</figcaption></figure><h4>Step 2. Create Internet Gateway and attach to your VPC</h4><p>In the VPC Dashboard, select “Internet Gateways” from the left sidebar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WpEscYtKBwfFf_qdzdbwrA.png" /><figcaption>Figure: Internet Gateway</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*ezRRV_maNCLqS0FUo-KvLw.png" /><figcaption>Figure: Internet Gateway name</figcaption></figure><p>Select the newly created Internet Gateway.<br>In the “Actions” dropdown, choose “Attach to VPC.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kn62kBWFrKcFlOYqXen48g.png" /><figcaption>Figure: attach igw</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*QJnWgNfgSclltdvVwD467g.png" /><figcaption>Figure: attach igw</figcaption></figure><h4>Step 3. Create Subnets</h4><p>In the VPC Dashboard, select “Subnets” from the left sidebar.</p><p>Click on the “Create subnet” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*xdjp8tmTiJ6hgQal0T0VGA.png" /><figcaption>Figure: Subnets</figcaption></figure><p>Select the previously created VPC</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*8o8w9ZaEfHAZo68EpWko6Q.png" /><figcaption>Figure: Create Subnet</figcaption></figure><p><strong><em>Create subnet 1</em></strong></p><p><strong>Name:</strong> Give a meaningful name to your subnet.</p><p><strong>Availability Zone:</strong> Select the Availability zone. We will use us-east-1a</p><p><strong>IPv4 VPC CIDR block:</strong> Choose the VPC CIDR block. For this case, we will use, 10.0.1.0/24.</p><p><strong>IPv4 Subnet CIDR block:</strong> Assign a CIDR block to the subnet. For this case, we will use, 10.0.0.0/16.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*6UCToNfYMfpEwFhDpGDBKg.png" /><figcaption>Figure: Enter subnet 1 details</figcaption></figure><p><strong><em>Create subnet 2</em></strong></p><p><strong>Name:</strong> Give a meaningful name to your subnet.</p><p><strong>Availability Zone:</strong> Select the Availability Zone. We will use us-east-2a</p><p><strong>IPv4 VPC CIDR block:</strong> Choose the VPC CIDR block. For this case, we will use, 10.0.2.0/24.</p><p><strong>IPv4 Subnet CIDR block:</strong> Assign a CIDR block to the subnet. For this case, we will use, 10.0.0.0/16.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*-pytw1XGx5RLjlgBNuiUdg.png" /><figcaption>Figure: Enter subnet 2 details</figcaption></figure><p><strong><em>Create subnet 3</em></strong></p><p><strong>Name:</strong> Give a meaningful name to your subnet.</p><p><strong>Availability Zone:</strong> Select the Availability Zone. We will use us-east-3a</p><p><strong>IPv4 VPC CIDR block:</strong> Choose the VPC CIDR block. For this case, we will use, 10.0.3.0/24.</p><p><strong>IPv4 Subnet CIDR block:</strong> Assign a CIDR block to the subnet. For this case, we will use, 10.0.0.0/16.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*mQkg9y5zqAs6dzQZuk-8DA.png" /><figcaption>Figure: Enter subnet 3 details</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*w5Wkh1SMPDzJx84pEycxPw.png" /><figcaption>Figure: Subnets after creation</figcaption></figure><h4>Step 4. Configure Route Tables</h4><p>Let’s navigate to the “Route Tables” section and configure route tables as needed for each subnet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*l6jBWYlLSULCrTSSbIRXGg.png" /><figcaption>Figure: Creating route table</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gFc97sSyOVilelEvto8YsA.png" /><figcaption>Figure: Associate route tables with sunets</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*OtKppt0XcIAqEwh6kgQxtw.png" /><figcaption>Figure: Select all subnets to be associated with route table</figcaption></figure><p>To associate route tables to the internet</p><p>In the “Actions” dropdown, click on “Edit routes.”</p><p>Add a new route with a destination CIDR block of 0.0.0.0/0 and set the target to the Internet Gateway ID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CETR6zppP-1tnd1aCavXvQ.png" /><figcaption>Figure: edit routes</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*l3blES4DT417wz1mdcQbtg.png" /><figcaption>Figure: configure routes</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sIR2cTpIMJ6bVmPDbsNVOA.png" /><figcaption>Figure: internet route created</figcaption></figure><h4>Step 5. Create a Target Group</h4><p>In the “Services” dropdown, go to “Compute,” and click on “EC2.”<br>In the left sidebar, under “Load Balancing,” click on “Target Groups.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Qs2dDbLyQPBnnc_e2J49xw.png" /><figcaption>Figure: Find target group</figcaption></figure><p>There will no be instances after creating the target group. They will be created by auto-scaling policy</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e4bUZWkXzZ4OefMIBxnU0g.gif" /><figcaption>Figure: Create a target group</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*USpL-qQduX8j-zJOueJQPQ.png" /><figcaption>Figure: Blank target group</figcaption></figure><h4>Step 6. Create Security Groups</h4><p>In the left sidebar, under “Network &amp; Security,” click on “Security Groups.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*UwybWa7cb_tIqWvJ2P3Scw.png" /><figcaption>Figure: Find security group</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gIV7qnFuh6AXyi8xlB3I3g.png" /><figcaption>Figure: Basic details</figcaption></figure><p>Define inbound rules to allow traffic to your instances. Click on “Add Rule” for each rule you want to add.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qI3XBht25bgWI8L2tSxdxw.png" /><figcaption>Figure: Configure inbound rule to allow traffic internally</figcaption></figure><p>Hit Create Security Group</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nc0CkCUOzQODqdsjDFKbvA.png" /></figure><p><strong>Create another security group</strong> to allow SSH and HTTP requests to instances</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*pliPMMMQ0_r7u-xDB8EWxA.png" /><figcaption>Figure: Enter basic details</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PkOrj6-3UijZFkn52uMnyw.png" /><figcaption>Figure: allow HTTP and SSH inbound traffic</figcaption></figure><p>Click on “Create Security Group”.</p><h4>Step 7. Create an Application Load Balancer</h4><p>In the “Services” dropdown, go to “Compute,” and click on “EC2.”</p><p>In the left sidebar, under “Load Balancing,” click on “Load Balancers.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*r-zuZQSoIkNdIdY1GgD5lw.png" /><figcaption>Figure: Find load balancer</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XumoZ5_v5dPQP3p2N5EwQA.png" /><figcaption>Figure: Create a load balancer</figcaption></figure><p>Choose “Application Load Balancer.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ed9kXjag-3xgqymxTt3Yg.png" /><figcaption>Figure: choose ALB</figcaption></figure><p><strong><em>Configure Load Balancer:</em></strong></p><p>Name: Enter a unique name for your load balancer.</p><p>Scheme: Choose “internet-facing” for public accessibility.</p><p>IP address type: Choose “ipv4.”</p><p>Network Mapping, choose the VPC we created</p><p>Choose the availability zones where your instances are located.</p><p>Choose an existing security group or create a new one for your load balancer.</p><p>Configure the listener settings (e.g., HTTP or HTTPS, port).</p><p>Under Listener and routing: Choose “Existing Target Group” and select the target group(s) created in a previous response.</p><p>Review the configured settings.</p><p>Click on the “Create” button to create the Application Load Balancer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y5JLmvUAjTgXPLSsYrvHkA.gif" /></figure><h4>Step 8. Creating a launch template</h4><p>In the “Services” dropdown, go to “Compute,” and click on “EC2.” Then on left sidebar, under “Instances,” click on “Launch Templates.”</p><p><strong><em>Configure Launch Template Details</em></strong></p><p>Enter a unique name for your launch template.</p><p>Choose the AMI ID identified for this case we will choose “Linux”.</p><p>Select the instance type, and choose t2. micro</p><p>Choose a key pair for SSH or RDP access or create a new one.</p><p>Select existing security groups and select the security group we created for the instances.</p><p>On Advanced network configuration click “Add Network interface”, select enable for Auto-assign public IP and leave rest as default.</p><p>On Advanced details Scroll down to User data and enter the code below.</p><pre>#!/bin/bash<br>yes | sudo apt update<br>yes | sudo apt install apache2<br>echo &quot;&lt;h1&gt;Server Details&lt;/h1&gt;&lt;p&gt;&lt;strong&gt;Hostname:&lt;/strong&gt; $(hostname) &lt;/p&gt;&lt;p&gt;&lt;strong&gt;IP Address:&lt;/strong&gt; $(hostname -I | cut -d&quot; &quot;-f1)&lt;/p&gt;&quot;&gt; /var/www/html/index.html<br>sudo systemctl restart apache2</pre><p>Review the configured settings.<br>Click on the “Create launch template” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KGFluSRohkWMTY3UZwM0YA.gif" /><figcaption>Figure: Creating a launch template for EC2 instances</figcaption></figure><h4>Step 9. Create an Auto Scaling Group</h4><p>Open the <a href="https://aws.amazon.com/">AWS Management Console</a>.</p><p>In the “Services” dropdown, go to “Compute,” and click on “EC2.”</p><p>In the left sidebar, under “Auto Scaling,” click on “Auto Scaling Groups.”</p><p>Enter a unique name for the Auto Scaling group name</p><p>Select the launch template or launch configuration that defines the AMI, instance type, and other settings.</p><p>Under <strong>Network</strong> Choose the VPC and one or more subnets where your instances will be launched</p><p>Under <strong>Load balancing</strong> Select “Attach to an existing load balancer” and <strong>Attach to an existing load balancer </strong>Select the load balancer that we had created before.</p><p>Leave VPC “Lattice integration options” as default</p><p><strong>Tick on</strong> Turn on Elastic Load Balancing health checks - monitors whether instances are available to handle requests</p><p>Under Health “Check Grace Period”: Set the time for which ASG waits before checking the health of an instance after it comes into service. For this case, we will set 20 seconds.</p><p>Configure group size and scaling, where we specify Desired capacity as 2 Min desired capacity as 1 and Max desired capacity 3.</p><p>Add notifications<em> — optional</em></p><p>Tags (Optional)</p><p>Review the configured settings for Auto Scaling group.</p><p>Click on the “Create Auto Scaling group” button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7zTtmYjGKqMHGT941xfs5A.gif" /><figcaption>Figure: Create auto-scaling group</figcaption></figure><p>Let’s see whether the instances have been created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tRIPJnO-feHjFPwS51mGYw.png" /><figcaption>Figure: Instance launched by auto-scaling group</figcaption></figure><p>Test the Auto Scaling Group.</p><p>Copy the DNS link on the load balancers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7o7spVqLDE7pC_dhWdm5FQ.png" /><figcaption>Fig: copy DNS link</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*h6WLqEYfWzkWv1asJkPjdQ.png" /><figcaption>Figure: Test web app</figcaption></figure><p>The Auto Scaling Group will automatically adjust the number of instances based on the defined policies or metrics, providing scalability and high availability for your applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0b7378940ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Static Website Hosting on AWS]]></title>
            <link>https://medium.com/@ecmusyoki/static-website-hosting-on-aws-142629e37dd5?source=rss-0c7a4c2cba70------2</link>
            <guid isPermaLink="false">https://medium.com/p/142629e37dd5</guid>
            <dc:creator><![CDATA[Eric Musyoki]]></dc:creator>
            <pubDate>Sun, 21 Jan 2024 18:41:57 GMT</pubDate>
            <atom:updated>2024-01-21T18:41:57.022Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello Readers,</p><p>My name is Eric and I will demonstrate how to build a static website using Amazon Web Services. Making a website that showcases your ideas, offerings, or products is one method to achieve this. Static websites hosted on cloud platforms such as AWS present a strong alternative, even though dynamic websites with server-side processing have advantages.</p><p>There aren’t many prerequisites needed to construct a website on AWS; all we need to do is adhere to these simple instructions.</p><h4>Step 1: Create an AWS Account</h4><p>If you don’t have an AWS account, sign up at AWS and create a new account.</p><h4>Step 2: Set Up an S3 Bucket</h4><p>Log in to the AWS Management Console.</p><p>Navigate to the Amazon S3 service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/1*_RqwM80fkwtOal--cHzR-A.png" /></figure><p>Click “Create Bucket” and follow the prompts to configure your bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*QHffdp2-emskyazhK6qS5A.png" /><figcaption>Click on create bucket</figcaption></figure><p>Ensure the bucket name is unique</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*Y4r4gwakGgPMKO4Y0eFYtA.png" /></figure><p>Uncheck the Block All Public Access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*uXjyQOOYDqvHGZnIXjer6w.png" /></figure><p>Click on Create bucket button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*0b1AIQzdc0AZ9rsymX3LCA.png" /></figure><h4>Step 3: Upload Your Website Files</h4><p>Return to the S3 list page, choose the created bucket, and then click Upload to add your static website files (HTML, CSS, JavaScript, etc.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3HG2uggzblKzjcAiJ4tN6A.png" /></figure><p>After you have successfully uploaded your files. Return to your bucket and click properties to enable static website then get the website link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*LZwu27A3UJJQ69r6X0WMKw.png" /></figure><p>Scroll down to Static website hosting the click on the edit button</p><p>Enable Static website hosting</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*r9_S7G4sY-3MYPJeHEKw6w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*ng20HZg2dVis1uHfiR1uiw.png" /><figcaption>Enter index.html as default webpage</figcaption></figure><p>Return to properties then Scroll down to Static website hosting</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*C4wiZs0agrpfGiVm5GKWtQ.png" /></figure><p>Open a new tab on your browser and get AWS generated domain link.</p><h4>Step 4: Enabling Access: Resolving the 403 Error for Your AWS Static Website</h4><p>After setting up your static website on AWS, you might encounter a 403 error even with static website hosting enabled. This issue arises because, by default, access to your static pages is restricted. To resolve this, you’ll need to configure the necessary permissions to make your S3 bucket contents accessible.</p><p>Return to your bucket and click on permissions to enter bucket policy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*sk0IvSuF07L_UP5RndaqQw.png" /></figure><p>Scroll down to bucket policy and click on the edit button. Enter the JSON code below to create a policy. Remember to edit the Resource with the bucket ARN provided above</p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;AllowPublicRead&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Principal&quot;: &quot;*&quot;,<br>            &quot;Action&quot;: &quot;s3:GetObject&quot;,<br>            &quot;Resource&quot;: &quot;&lt;BUCKET_ARN&gt;/*&quot;<br>        }<br>    ]<br>}</pre><p>Click <strong>Save Changes</strong>.</p><p>Refresh the browser tab with the static website opened earlier.</p><h3>Create CloudFront distribution</h3><p>What is CloudFront?</p><p>CloudFront is a CDN (Content Delivery Network). The CloudFront retrieves data from the Amazon S3 bucket and distributes it to multiple datacenter locations. The data that is delivered through network of data centers is called edge locations.</p><p>The nearest edge location is routed when the user requests for data, so we will get some benefits like the lowest latency, low network traffic, fast access to data, etc.</p><h4>Step 1: Sign in to AWS Console</h4><p>Navigate to the AWS Management Console.</p><p>Sign in to your AWS account</p><h4>Step 2: Open CloudFront Console and Create a distribution</h4><p>In the AWS Management Console, navigate to the “Services” dropdown and select “CloudFront” under the “Networking &amp; Content Delivery” section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*t423NP-vy5FLtnTa1R5ypw.png" /></figure><p>In the CloudFront dashboard, click on the “Create Distribution” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*kxR8Zo-8UDOs8XuKy3Sjmg.png" /></figure><h4>Step 3: Choose a Delivery Method</h4><p>Choose the settings based on your requirements:<br>Origin Settings: Select the S3 bucket or custom origin where your content is stored.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*cqFvXYKCI-1ajACRkfm8Sg.png" /></figure><p>Viewer Protocol Policy: Choose whether viewers should use HTTP or HTTPS.</p><h4>Step 4: Configure Distribution Settings</h4><p>Configure settings security protection, AWS WAF</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*JzXEXWuFjSrPfRXf0HOI0A.png" /></figure><p>The “Default root object” in the context of AWS S3 and CloudFront refers to the default file that should be served when a user accesses the root URL of your website (e.g., <a href="https://yourdomain.com/">https://yourdomain.com</a>) without specifying a specific file or path</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*0ooJgd524gk4PSdTlpLLZQ.png" /><figcaption>Default root object is set to “index.html,”</figcaption></figure><p>Click on the “<strong>Create Distribution</strong>” button.</p><h4>Wait for Distribution Deployment</h4><p>The CloudFront distribution may take some time to deploy.</p><p>Once the distribution is deployed, the CloudFront domain name will appear. This is the domain used to access content through CloudFront.</p><p><strong>Congratulations!</strong> We’ve successfully created a CloudFront distribution, and the content is now being delivered globally with low latency. Keep in mind that it may take some time for changes to propagate and for CloudFront to start serving content efficiently.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=142629e37dd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>