<?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 Babatunde Oyedeji on Medium]]></title>
        <description><![CDATA[Stories by Babatunde Oyedeji on Medium]]></description>
        <link>https://medium.com/@BabatundeO?source=rss-b904b64337e0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KJlRKIagiyWw18rfY_8Vaw.jpeg</url>
            <title>Stories by Babatunde Oyedeji on Medium</title>
            <link>https://medium.com/@BabatundeO?source=rss-b904b64337e0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 05:34:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@BabatundeO/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[Create and Deploy EKS Cluster with Terraform]]></title>
            <link>https://medium.com/@BabatundeO/create-and-deploy-eks-cluster-with-terraform-905c0622cd0f?source=rss-b904b64337e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/905c0622cd0f</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Babatunde Oyedeji]]></dc:creator>
            <pubDate>Thu, 24 Nov 2022 18:46:50 GMT</pubDate>
            <atom:updated>2022-11-24T18:46:50.861Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OmHEp9XdrSvfr_S4_yNPaw.jpeg" /></figure><p>Scenario</p><p>1. Create an EKS cluster with the desired capacity of 2<br>2. Create a random string that allows 5 characters to build the cluster name<br>2. We want to output the cluster name and the IP address of the containers in the cluster.</p><p>All configurations files used for this deployment are in my GitHub <a href="https://github.com/BabatundeOye/Terraform_EKS_Cluster">repository</a></p><p>Step 1:</p><p>Let&#39;s deploy using terraform cloud</p><p>Create a new workspace</p><p>Choose your workflow (version control workflow).</p><p>In order to have all our repo reflected in our terraform cloud, we need to set up authorization. I will walk you through these few steps.</p><p>Workspaces — settings — providers — Add a VCS provider (select Github.com)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*LaMFkJrITJs2Z4LlI_0U6w.jpeg" /></figure><p>Register a new OAuth Application</p><p>Use the information provided on this page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*4ral4cEwwszyajOzQGpU2Q.jpeg" /></figure><p>to register for a new OAuth Application</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*qqTjt6xdsL0bigT4eM3u1w.png" /></figure><p>Copy the client ID and generate a new client secret. Complete the blanks and click “connect and continue”.</p><p>Continue with the workspace creation and select your repository, workspace created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Sme4i-Ttby8cM2JCQE--7w.png" /></figure><p>Step 2: Terraform cloud deployment</p><p>Start a new plan and “start run”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*lKZVYxpMdY0TmlT4RrUivA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*8FlNhgsY1vHIL9MSLulq6g.png" /></figure><p>Confirm plan</p><p>Resources deployed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*4anf4yWA13oE9Zl8EjkExg.png" /></figure><p>Confirm resources in the AWS console</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H2Fg5lE2y8dSWoB_WXYrig.png" /></figure><p>Worker instances</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D7IgM5slFxWqrzYKT1SipQ.png" /></figure><p>Job done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/231/1*vIaidYDX1U5nxe4pBA3EaQ.jpeg" /></figure><p>NB: Remember to provide your access key and secret key as variables in your workspace, otherwise you run into a roadblock with the AWS provider block. Set it as sensitive.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=905c0622cd0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Terraform Cloud as a CI/CD Tool]]></title>
            <link>https://medium.com/@BabatundeO/using-terraform-cloud-as-a-ci-cd-tool-c0e7d6e2f4cb?source=rss-b904b64337e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0e7d6e2f4cb</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform-cloud]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Babatunde Oyedeji]]></dc:creator>
            <pubDate>Fri, 11 Nov 2022 21:43:45 GMT</pubDate>
            <atom:updated>2022-11-11T21:59:14.866Z</atom:updated>
            <content:encoded><![CDATA[<p>Deployment of a highly available two-tier AWS architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*KXSHzdHP4uNGFvkxP7U5tA.jpeg" /></figure><p>Objectives</p><p><strong>1</strong>. Create a highly available two-tier AWS architecture containing the following:</p><p>· Public Subnets</p><p>· 3 Private Subnets</p><p>· 1 Bastion Host in a public subnet</p><p>· Auto Scaling Group for Web Server (in private subnets)</p><p>· Internet-facing Application Load Balancer targeting Web Server Auto Scaling Group</p><p><strong>2.</strong> Deploy this using Terraform Cloud as a CI/CD tool to check your build.</p><p><strong>3.</strong> Use module blocks for ease of use and re-usability.</p><p>What is Terraform Cloud?</p><p>Terraform Cloud is HashiCorp’s managed service offering. It eliminates the need for unnecessary tooling and documentation for practitioners, teams, and organizations to use Terraform in production <a href="https://cloud.hashicorp.com/products/terraform"><em>(reference)</em></a>. Terraform can be integrated with GitHub repositories to automate software builds, tests, and deployments. Automating Terraform with CI/CD enforces configuration best practices, promotes collaboration and automates the Terraform workflow. To learn more, click <a href="https://developer.hashicorp.com/terraform/tutorials/automation/github-actions">here</a></p><p>All the configuration codes for this project can be found <a href="https://github.com/BabatundeOye/Project-two-tier-AWS-architecture">here</a>. The two-tier infrastructure has been built, tested, and deployed without the terraform cloud. I destroyed infrastructure and deployed through terraform cloud integrated with the GitHub repository.</p><p>I will be taking you through the steps in setting up terraform cloud and using it as a CI/CD tool.</p><p>Step 1: Configure the terraform workspace and connect it to GitHub. Create a new workspace — select version control <a href="https://github.com/">(Github.com)</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*fIC7-YwaRiAKnaOCzMZukQ.jpeg" /></figure><p>Authorize terraform cloud to access your GitHub account. <em>If you have any pop-up blocker, you will have to disable it or allow pop-ups from terraform.</em></p><p>Next, you could select all repositories or a repository depending on the location of your configuration code. I selected my terraform configuration code repository and installed terraform cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*a7SDyyuwJTG37_givtLtdQ.jpeg" /></figure><p>Select the repo and configure settings by verifying the workspace name, and adding a description (optional).</p><p>The variables defined in your tfvars.tf file will be automatically added to your variable file. Click on the “…” to edit and mark it as sensitive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*ppgV5mVirNCYRYswNI8SkQ.jpeg" /></figure><p>You could create a backend.tf, however, I choose not to create. Based on the terraform documentation “<em>You do not need to configure a backend when using Terraform Cloud because Terraform Cloud automatically manages state in the workspaces associated with your configuration” </em><a href="https://developer.hashicorp.com/terraform/language/settings/backends/configuration"><em>link</em></a><em>.</em></p><p>Step 2: Deploy infrastructure from Terraform cloud.</p><p>Workspaces — Runs — Actions— Start a new run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CLL1osOkvz8TOxOs4dQF2A.jpeg" /></figure><p>Start the run, and add a reason for starting the run (optional).</p><p>I will manually apply the configuration. This serves as the last opportunity to validate the code before deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IIQIR7pCyapivj3gjaWB-w.jpeg" /></figure><p>All infrastructure has been successfully deployed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mt_hF_oVhfDClHccCCudsg.jpeg" /></figure><p>You can check all resources deployed from the terraform cloud or check through the AWS console.</p><p>Step 3: Trigger a CI/CD pipeline.</p><p>I will make some changes to my configuration code, and push the changes to GitHub.This will automatically trigger the changes in the infrastructure through the terraform cloud.</p><p>I changed the random pet name attached to VPC . the length was reduced from 3 to 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*v_-NvmJO86O8BZtvm1bEcg.jpeg" /></figure><p>This triggered the CI/CD pipeline in the terraform cloud</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v_uFphqzkuIERbPnpDNosg.jpeg" /></figure><p>VPC name changed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*NfP_uGLdjMkg-CBHyUnNEQ.jpeg" /></figure><p>Three changes were deployed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1eAOzVoOeuyfeRtxFf5qzg.jpeg" /></figure><p>All done. Thank you for reading.</p><p>All resources can be safely destroyed.</p><p>Settings — Destruction and Deletion — Queue destroy plan</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*6aUozdOzwXg_IakbbnuyJw.jpeg" /></figure><p>All destroyed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*o_CvaLIShoQ_ojJwLUuk5g.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0e7d6e2f4cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform — Deploy a two-tier architecture]]></title>
            <link>https://medium.com/@BabatundeO/terraform-deploy-a-two-tier-architecture-366009b4b332?source=rss-b904b64337e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/366009b4b332</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Babatunde Oyedeji]]></dc:creator>
            <pubDate>Mon, 24 Oct 2022 15:45:39 GMT</pubDate>
            <atom:updated>2022-10-24T15:49:01.325Z</atom:updated>
            <content:encoded><![CDATA[<h3>Terraform — Deploy a two-tier architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*JqHsL72RvMO8oBQ7SIc2jQ.jpeg" /></figure><p>Terraform is an infrastructure as code tool that lets you define and manage infrastructure resources through human-readable configuration files. Terraform allows you to use a consistent workflow over your infrastructure lifecycle, regardless of the resource provider. The infrastructure as code workflow lets you declaratively manage a variety of services and automate your changes to them, reducing the risk of human error through manual operations (source: <a href="https://www.terraform.io/intro">Terraform</a>)</p><p>Objectives</p><p>1. Deploy a VPC with CIDR 10.0.0.0/16 with 2 public subnets with CIDR 10.0.1.0/24 and 10.0.2.0/24. Each public subnet should be in a different AZ for high availability.<br>2. Create 2 private subnets with CIDR ‘10.0.3.0/24’ and ‘10.0.4.0/24’ with an RDS MySQL instance (micro) in one of the subnets. Each private subnet should be in a different AZ.<br>3. A load balancer that will direct traffic to the public subnets.<br>4. Deploy 1 EC2 t2.micro instance in each public subnet.</p><p><em>This project will hard code all resources into a single main.tf file. This is not intended to be an example of best practice, instead, it will show how to quickly provision resources with Terraform.</em></p><p>Step 1: Create a new directory and a new file (main.tf) for this project.</p><p>Step 2: I will write all codes needed for this project under this main.tf file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/877da8add34faa9c76af30bff04eae4b/href">https://medium.com/media/877da8add34faa9c76af30bff04eae4b/href</a></iframe><p>I usually validate for correctness after writing each block of code</p><pre>terraform validate</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*XRp6z_-RLl6t0Qg5bGEt0Q.jpeg" /></figure><p>I fixed all errors before proceeding to the next block of code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*Hr1dqn2g6WhCNTsXhwoQ8Q.jpeg" /></figure><pre>terraform fmt </pre><p>You can run the terraform fmt to make your code neat.</p><pre>terraform init </pre><p>To initialize the backend and all necessary plug-ins</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*8ysVObGn6N1CDBAB6TCO5A.jpeg" /></figure><pre>terraform plan </pre><p>To review resources</p><pre>terraform appply </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*HXM1V4wnDekufAnKvcuF-g.jpeg" /></figure><p>I validated my infrastructure by checking in the AWS console</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NSa60JOKNmyWXP5IRUy3Ow.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*ymE7TZwiGAe35QkXLF2QGQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*Qi-9PeMqPszrIrYUgIoZ0w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GXo2sJBdqO0ODeE3YURtgA.jpeg" /></figure><p>All have been verified and terraform successfully deployed the infrastructure.</p><p>Thank you for reading.</p><p>Run “terraform destroy” to tear everything down</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=366009b4b332" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform: Create a reusable custom module for EC2]]></title>
            <link>https://medium.com/@BabatundeO/terraform-create-a-reusable-custom-module-for-ec2-daf63206ea5e?source=rss-b904b64337e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/daf63206ea5e</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Babatunde Oyedeji]]></dc:creator>
            <pubDate>Mon, 24 Oct 2022 14:13:29 GMT</pubDate>
            <atom:updated>2022-10-24T14:17:27.213Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*M7gZl7MA-df8ECusNzIQQQ.jpeg" /><figcaption><a href="https://www.hashicorp.com/">https://www.hashicorp.com/</a></figcaption></figure><p>In this project, I will be creating a custom module for an ec2 instance with an amazon Linux 2 AMI ID</p><ol><li>1. Fork and clone this repo locally with the <a href="http://ec2.tf/">ec2.tf</a> template as a starting point to create the ec2 <a href="https://github.com/LevelUpInTech/terraformec2.git">https://github.com/LevelUpInTech/terraformec2.git</a></li><li>Create a custom module for ec2 out of the resource block that you can use as repeatable infrastructure</li><li>Push the newly created module and the <a href="http://ec2.tf/">ec2.tf</a> file to your repo</li></ol><p>Step 1: Fork and clone the repository</p><pre>git clone <a href="https://github.com/LevelUpInTech/terraformec2.git">https://github.com/LevelUpInTech/terraformec2.git</a></pre><p>Step 2: Create a custom module</p><p>I will be creating a child module and a root module.</p><p>For the child module, I will create</p><p><em>main.tf, — declare my resource to be deployed</em></p><p><em>output.tf, — my outputs for the resource(s) deployed</em></p><p><em>provider.tf — declare my provider (AWS) for terraform</em></p><p><em>variables.tf — declare my variables for this project</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/29dc1e67f54afec77a3ee0badbe5a650/href">https://medium.com/media/29dc1e67f54afec77a3ee0badbe5a650/href</a></iframe><p>Step 3: Also for the root module, I will be creating main.tf and output.tf</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/32e985b1e4b9a849f794c71201eed309/href">https://medium.com/media/32e985b1e4b9a849f794c71201eed309/href</a></iframe><p>Run <em>terraform init</em> to initialize the working directory containing configuration files and installs plugins for required providers.</p><p>I ran into some errors</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SeAWWY6bsfi7IQJv-wCElQ.jpeg" /></figure><p>I locked down my terraform version to fix this problem</p><pre>version = &quot;~&gt; 4.36.1&quot;</pre><p><em>terraform fmt</em> — to make my code readable</p><p><em>terraform validate —</em> to and check the validity of configuration files</p><pre>terraform plan  </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*sqwXVIj8wEe1p39kbPM0Zg.jpeg" /></figure><pre>terraform apply</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*Hkro66XvEGANg188bf8B4A.jpeg" /></figure><p>I confirmed deployment at the console</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*Pe12pbxum4utOtTeLhuQCw.jpeg" /></figure><p>Step 4: Add a .gitignore file to the root directory and push the newly created module and the <a href="http://ec2.tf/">ec2.tf</a> file to your repo.</p><p>NB: Don&#39;t forget to run <em>terraform destroy</em> to destroy all deployed resources.</p><p>Thank you for reading</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/191/1*zn5hXsYK07H2kyi1-kwzaA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=daf63206ea5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a deployment that runs on the Nginx image.]]></title>
            <link>https://medium.com/@BabatundeO/create-a-deployment-that-runs-on-the-nginx-image-943ea0adba59?source=rss-b904b64337e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/943ea0adba59</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Babatunde Oyedeji]]></dc:creator>
            <pubDate>Mon, 03 Oct 2022 06:15:19 GMT</pubDate>
            <atom:updated>2022-10-03T06:15:19.476Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8uDGarzc7U6UIwM0tySIzg.png" /></figure><p>Objectives</p><ol><li>Using the command line</li><li>Create a deployment that runs the Nginx image.</li><li>Display the details of this deployment</li><li>Check the event logs from the deployment</li><li>Delete the deployment</li></ol><p>Step 1: Install Kubernetes.</p><p>There are several ways of installing Kubernetes. I will be using the docker desktop. With docker desktop, go to settings and check the ‘enable Kubernetes ’box</p><p>Confirm installation</p><pre>kubectl version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*UIIOcplJyzWtgGsYr642LA.jpeg" /></figure><p>Step 2: Create a deployment that runs the Nginx image.</p><pre>kubectl create deployment &lt;name of your pod&gt; --image nginx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*ncbaD5r-R5F38sk5nY7q5Q.jpeg" /></figure><p>Check if deployment is successful</p><pre>kubectl get deployment &lt;name&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*IZuMeoAQ-FQxBPQQrN-BIQ.jpeg" /></figure><p>Step 3: Display the details of this deployment</p><pre>kubectl decsribe deployment &lt;name&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ac-j6MgTjQAEOvvwAI98Q.jpeg" /></figure><p>Step 4: Check the event logs from the deployment</p><pre>kubectl logs deployment/&lt;name&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mVdyPFu0_WBZjoZL_GxooQ.jpeg" /></figure><p>Step 5: Delete deployment</p><pre>kubectl delete deployment &lt;name&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*zoVWPSUo__Of-GTxbtnO-A.jpeg" /></figure><p>Thanks for reading</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=943ea0adba59" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scaling Nginx deployment]]></title>
            <link>https://medium.com/@BabatundeO/scaling-nginx-deployment-f0d7b0e973b7?source=rss-b904b64337e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0d7b0e973b7</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Babatunde Oyedeji]]></dc:creator>
            <pubDate>Sat, 01 Oct 2022 07:52:05 GMT</pubDate>
            <atom:updated>2022-10-01T07:52:05.338Z</atom:updated>
            <content:encoded><![CDATA[<p>In this write-up, I will be creating and scaling Kubernetes deployment running the Nginx image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*9ww4RmWMdzVM3vTL7Whv0A.jpeg" /><figcaption>credit: <a href="https://www.educba.com/kubernetes-deployment/">link</a></figcaption></figure><p>Objectives</p><p>Create the Nginx deployment using a YAML file<br>Display the details of this deployment via the command line<br>Update the YAML file to scale the deployment to 4 Nginx containers<br>Verify the change via the command line</p><p>Step 1: Create the YAML file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d40c77c11670debc7b2902ceece8a38/href">https://medium.com/media/2d40c77c11670debc7b2902ceece8a38/href</a></iframe><p>Clone the file into my ubuntu distribution using git clone &lt;url&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*kF27N29d-LerSOP04tqPOg.jpeg" /></figure><p>Create deployment based on the created YAML file</p><pre>kubectl apply -f nginx_deployment.yaml</pre><p>Confirm the creation of the deployment</p><pre>kubectl get deployment</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*twLm9BO1FtdUMCIcl6awcw.jpeg" /></figure><p>Step 2: Display details of deployment</p><pre>kubectl describe deployments</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JC_GdpEx0R1hjVn5MXpb0A.jpeg" /></figure><p>Step 3: Update the YAML file to scale the deployment to 4 Nginx containers</p><p>To do this, we change the replica from 1 to 4. I edited the source code, changed the replica to 4 and did a ‘git pull’ to update the changes in my file on my local system</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NxocB4XyFlvuOFmcUTOmTg.jpeg" /></figure><p>Verify the change</p><pre>cat nginx_deployment.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v97XxSrLclO3yfMOSHEvDw.jpeg" /></figure><p>Reran the command. This time I opened another window to monitor the deployment</p><pre>kubectl get pods -w</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*DAQT5u3nujscUogdjB8mMQ.jpeg" /></figure><p>Step 4: Verify the change via the command line</p><pre>kubectl get deployment</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*4yVyK2d0FjrwUuCEk8HVeA.jpeg" /></figure><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0d7b0e973b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CREATING CUSTOM DOCKER IMAGE AND SAVING IT TO ECR]]></title>
            <link>https://medium.com/@BabatundeO/creating-custom-docker-image-and-saving-it-to-ecr-2fd7133d1a4a?source=rss-b904b64337e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fd7133d1a4a</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Babatunde Oyedeji]]></dc:creator>
            <pubDate>Tue, 27 Sep 2022 17:21:36 GMT</pubDate>
            <atom:updated>2022-09-27T17:21:36.392Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5A4Rj7IOYYIz1qPekIMAGw.jpeg" /></figure><p><strong>OBJECTIVES</strong></p><p>1. Create your image using Nginx and add a file that will tell you the date the container has been deployed</p><p>2. Deploy your container with port 8080 open</p><p>3. Save your container data to the AWS Elastic Container Registry (ECR)</p><p>In this project, I will be using Linux to achieve my objectives.</p><p>Step 1: Create a directory for this project and change it to your newly created directory. This is best practice.</p><pre>mkdir &lt;name of directory&gt;<br>cd &lt;name of directory&gt;</pre><p>Step 2: Pull the Nginx image from the docker hub and start a container from the Nginx image</p><pre>docker pull nginx:latest</pre><p>adding ‘latest’ is optional. ‘Latest’ pulls the latest image from the hub, without adding the latest, the newest image is pulled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*KT0t63uSHyT0Wd8LnLIrCA.png" /></figure><p>verify the image has been pulled</p><pre>docker image ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*T8kaq6kueb6g1dfqHvHZmQ.jpeg" /></figure><p>Step 3: Create a Dockerfile.I used Vim as my text editor (you can use any editor)</p><p>Dockerfile starts with a “FROM” with any base image</p><p>RUN is used to execute commands within the container</p><p>autoremove anything that needs to be cleaned</p><p>apt clean — the repository information that it doesn&#39;t need any more</p><p>&amp;&amp; is used to chain commands together. Each Run command adds a layer that we may not need</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*KOgo0NMykyxHW-jfohhPTg.jpeg" /></figure><p>Step 4: Create the HTML file showing the date and time</p><p>touch index.html — create a new file ‘index.html’</p><p>vim index.html</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2623cf78e2a947470dacfa9b061f2aa3/href">https://medium.com/media/2623cf78e2a947470dacfa9b061f2aa3/href</a></iframe><p>Step 4: Build image</p><pre>docker build -t custom_nginx .</pre><p>“. ” This is for the current directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*_H968a4nlfGnNeVyRGz_Ag.jpeg" /></figure><p>Create container</p><pre>docker container run -d -p 8080:80 --name nginx_container custom_nginx</pre><p>Confirm the container and check it out on the browser</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DmDGbNhVyCMr-miJNZPzog.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*pg92sALhj2Bo81zc2VwqVw.png" /></figure><p>Step 5: Save your container data to the AWS Elastic Container Registry (ECR)</p><p>I installed and configured CLI on my ubuntu and then created a repository in AWS ECR</p><pre><strong>aws ecr create-repository --repository-name </strong><strong><em>&lt;name&gt;</em> --region &lt;</strong><strong><em>region&gt;</em></strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cACpnmYV2PzOsrip_RV_Tw.jpeg" /></figure><p>I used the documentation on AWS as a guide to push my docker image. Click <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/docker-push-ecr-image.html">here</a> for information</p><p>a) Authenticate your Docker client to the Amazon ECR registry to which you intend to push your image</p><pre>aws ecr get-login-password --region region | docker login --username AWS --password-stdin aws_account_id.dkr.ecr.region.amazonaws.com</pre><p>b) Tag the image</p><pre>docker tag e9ae3c220b23 aws_account_id.dkr.ecr.region.amazonaws.com/my-repository:tag</pre><p>c) Push the image</p><pre>docker push aws_account_id.dkr.ecr.region.amazonaws.com/my-repository:tag</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SH90v9RL9WGUxV_8p-imlw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qssiLyRRdAZO-669Xg3YBQ.jpeg" /></figure><p>All done.</p><p>Thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fd7133d1a4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[USING API GATEWAY TO INVOKE A LAMBDA FUNCTION TO SEND MESSAGES TO SQS]]></title>
            <link>https://medium.com/@BabatundeO/using-api-gateway-to-invoke-a-lambda-function-to-send-messages-to-sqs-f6eee05589b6?source=rss-b904b64337e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6eee05589b6</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Babatunde Oyedeji]]></dc:creator>
            <pubDate>Sun, 18 Sep 2022 22:20:45 GMT</pubDate>
            <atom:updated>2022-09-19T07:21:11.322Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*EpjNTFqAP_jWdxlG4axy_A.jpeg" /></figure><p>OBJECTIVES</p><ol><li>Create a Standard SQS Queue using Python.</li><li>Create a Lambda function in the console with a Python 3.7 or higher runtime</li><li>Modify the Lambda to send a message to the SQS queue. Your message should contain either the current time or a random number. You can use the built-in test function for testing.</li><li>Create an API gateway HTTP API type trigger.</li><li>Test the trigger to verify the message was sent.</li></ol><p>I have already installed and configure AWS CLI and installed boto3. Click <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html">here</a> on how to install boto3. Cloud9 was used as my IDE.</p><p>Step 1: Create SQS and get the SQS URL using python.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e85f7593d5d73f78d70186b65c4eb3b/href">https://medium.com/media/0e85f7593d5d73f78d70186b65c4eb3b/href</a></iframe><p>Step 2: Create a role for the lambda function</p><p>IAM — Create a policy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*MtlS-RhQmSNsgoRfameMRA.jpeg" /></figure><p>Attach policy to a role</p><p>Create a role with the following properties.</p><p>Trusted entity type — AWS Lambda.</p><ul><li>Use case — Lambda</li><li>Add permissions — Attach policy</li><li>Role name — SQS_Lambda</li></ul><p>Step 3: Create a lambda function</p><p>Author from scratch — Give a function name — Runtime(python 3.7) — Permissions (selected the created role)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*wAHUfkLy3QIDKq8V7OIybQ.jpeg" /></figure><p>Step 4: Modify the Lambda function to send a message to the SQS queue. My message will contain my local current time</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/447d78a9efbf88c7fba5360a76825636/href">https://medium.com/media/447d78a9efbf88c7fba5360a76825636/href</a></iframe><p>Deploy changes and configure a test event</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*0AWoaJm9ACHk-cBNKi9Pow.jpeg" /></figure><p>and test. Test was successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BdZBBbFCzYAkkLUu3dFMRg.jpeg" /></figure><p>Confirm the message was received in SQS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J0HfHsG__kT_8yG1wxS6sQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*Tt50j99RmZuSnqtwRDSF5g.jpeg" /></figure><p>Message was received.</p><p>Step 5: Create a HTTP API gateway trigger</p><p>Click on Add trigger — select API Gateway — create a new API</p><p>API type — select HTTP API</p><p>Security — open</p><p>Leave the rest as default and click ‘Add’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*mOxNgBoByiLHyzhkv5n4iA.jpeg" /></figure><p>To verify the trigger works, click on the API endpoint, a message should be added to the the queue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*ipUkC4EjXDdT8Q6NhmMZcA.jpeg" /></figure><p>Click on the API endpoint</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*I0MHZAeXvUVVQ0iFBD_mSA.jpeg" /></figure><p>A message has been added to the queue</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z9DiumVlQKMks8lL2WWPAg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*N3vhyzkRhn7Vjobu2KLxdw.jpeg" /></figure><p>The API Gateway has successfully trigger the lambda function to send messages to SQS.</p><p>Thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6eee05589b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a DynamoDB table, add items, scan, query and delete the table using boto3 and python]]></title>
            <link>https://medium.com/@BabatundeO/create-a-dynamodb-table-add-items-scan-query-and-delete-the-dynamodb-table-using-boto3-and-python-6aabc3990b32?source=rss-b904b64337e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6aabc3990b32</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Babatunde Oyedeji]]></dc:creator>
            <pubDate>Mon, 12 Sep 2022 20:53:23 GMT</pubDate>
            <atom:updated>2022-09-12T21:05:21.697Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*0cYqdlJpbEaoZnXPvLP_Uw.jpeg" /><figcaption>Source: section.io</figcaption></figure><p>In this article, I will demonstrate how to create a DynamoDB table, add items to the table, scan, query and delete the table using boto3 and python.</p><p>Prerequisite</p><p>· IAM user with programmatic access</p><p>· Install boto3</p><p>· Install AWS CLI and configure AWS</p><p>Step 1: Create a table</p><p>Write and run this code on your preferred environment (Cloud9 was used). I used the <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html">boto3 documentation</a> as a guide throughout this project. I created a dynamodb table using this code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*f3riWdKqkGco3gV9kiqsMA.jpeg" /></figure><p>There were indentation errors at this stage, but I fixed them using the documentation guide and StackOverflow.</p><p>Step 2: Add items to the table</p><p>I added multiple items to the table using the “batch_writer” command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*aAaYz4DxKrJixHUmY2_HZw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*Wna7eNt2KvdcyyDo_RIYSw.jpeg" /></figure><p>Step 3: Scan the table</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*M9uOeka83EdpGDvb1ZL7wA.jpeg" /></figure><p>Step 4:Query the table</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*gak6Mnsz9HthJEl5WJTA6Q.jpeg" /></figure><p>Step 5: Remove an item from a table</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*OtuJO-NR0DjP5Rcy4UO1xg.jpeg" /></figure><p>Step 6: Delete the table</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*dTXJ4-C11ecSuICOb9w01w.jpeg" /></figure><p>This was an interesting project and an eye-opener into the world of automation. Visit my <a href="https://github.com/BabatundeOye">github</a> to follow my progress.</p><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6aabc3990b32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Designing a Three-Tier Architecture Design]]></title>
            <link>https://medium.com/@BabatundeO/designing-a-three-tier-architecture-design-2f3cec92b25d?source=rss-b904b64337e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f3cec92b25d</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Babatunde Oyedeji]]></dc:creator>
            <pubDate>Mon, 15 Aug 2022 19:41:35 GMT</pubDate>
            <atom:updated>2022-08-15T19:41:35.981Z</atom:updated>
            <content:encoded><![CDATA[<p>I will create a highly available and scalable three-tier architecture for a company’s new web application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*E0pvE7QwvxW2aJyAbW1F0g.png" /></figure><p>Background: Why is this called three-tier architecture?</p><p>This is called a three-tier architecture because it has three tiers or layers — the presentation layer, the application layer and the database. The presentation layer is also called the client layer. The user accesses the application (a website for example) using a presentation layer (front-end). This layer communicates with the application layer (back-end) whilst the application layer saves and retrieves information or data from the database.</p><h3>Objectives</h3><p><strong>Web Tier</strong></p><ol><li>2 public subnets</li><li>Minimum of 2 EC2 instances with an OS of your choice (free tier) in an Auto Scaling Group</li><li>EC2 Web Server Security Group allows inbound permission from the internet.</li><li>Bootstrap a static web page or create a custom AMI that already includes the static web page.</li><li>Create a public route table and associate the 2 public subnets.</li></ol><p><strong>Application Tier</strong></p><ol><li>2 public subnets</li><li>Minimum of 2 EC2 instances with an OS of your choice (free tier) in an Auto Scaling Group.</li><li>EC2 Application Server Security Group allowing inbound permission from the Web Server Security Group</li><li>Associate with a private route table.</li></ol><p>Note: This is not a true application tier as we don’t have any provided code to run on the EC2 instances.</p><p><strong>Database Tier</strong></p><ol><li>Use a free Tier MySql RDS Database.</li><li>The Database Security Group should allow inbound traffic for MySQL from the Application Server Security Group.</li><li>2 private subnets.</li><li>Associate with a private route table.</li></ol><p><strong>PART A: Web-Tier</strong></p><p>Step 1:Create VPC and two public subnets</p><p>VPC dashboard — Your VPCs — Create VPC</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*JvYEQpDuiBCzGG3HU2S_0Q.jpeg" /></figure><p>Step 2:Create an Internet Gateway</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*1HKkPPtHEIjbFnsaqCc-EQ.jpeg" /></figure><p>Attach it to your VPC</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*zSGWlnt28qYczwK7FlRH7Q.jpeg" /></figure><p>Step 3:Create 2 public subnets</p><p>VPC dashboard — Subnets — Create subnets. These IPv4 CIDR blocks 10.10.1.0/24 and 10.10.2.0/24 were used for respective subnets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*uTYtdHuuHJK416QAignvzA.jpeg" /></figure><p>Create a route table for public subnets</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*uhiiso1K5LIs-CIMu654jg.jpeg" /></figure><p>Step 4:Update route table</p><p>Routes — Edit Routes — Add Route — Destination (0.0.0.0/0)—Target (Internet Gateway)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2cqUW1fjOajukh-OixBfrw.jpeg" /></figure><p>Auto-assign IPv4 address to each subnet. Select subnet — actions — edit subnet settings — enable auto-assign public IPv4 address.</p><p>Step 5:Create a launch template for the instances</p><p><em>Create your launch template using the following steps:</em></p><p><em>Create a name for the template</em></p><p><em>Choose AMI and Instance type</em></p><p><em>Create a new key pair or use existing key pair</em></p><p><em>Create a security group- under inbound security group rules, allow SSH and HTTP traffic from anywhere</em></p><p><em>In the advanced network configuration, I enabled auto-assign public IP.</em></p><p><em>In the advanced details, I uploaded a bash script in the user-data field</em></p><pre>#!/bin/bash</pre><pre>yum update -y<br>yum install -y httpd<br>systemctl start httpd<br>systemctl enable httpd<br>EC2AZ=$(curl -s <a href="http://169.254.169.254/latest/meta-data/placement/availability-zone)">http://169.254.169.254/latest/meta-data/placement/availability-zone)</a><br>echo &#39;&lt;center&gt;&lt;h1&gt;This Amazon EC2 instance is located in Availability Zone: AZID &lt;/h1&gt;&lt;/center&gt;&#39; &gt; /var/www/html/index.txt<br>sed &quot;s/AZID/$EC2AZ/&quot; /var/www/html/index.txt &gt; /var/www/html/index.html</pre><p>Step 6:Create an autoscaling group</p><p>Create a name —Choose the existing launch template — Choose your vpc and subnets — Click next — I do not have a load balancer yet — click next.</p><p>Set auto-scaling group to min 2, max 5 and desired capacity 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*weNzpPC-TqTqet3GHvoJFg.jpeg" /></figure><p><em>Roadblock: My website did not launch because I did not associate my subnets with my route table. I fixed it by associating my subnets with my route table. Then, I re-created the launch template and auto-scaling group</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*RGxMcWinTPMIFNE3VY8RGg.jpeg" /></figure><p>It is working now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hdzcoN4ewln_QVU3UU3Jpg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PjWI5XPI69zxW0uPGk2yhg.jpeg" /></figure><p>Step 7: Create a target group</p><p>Click on Target group — select instances — define a name — protocol is 80 — choose your VPC— protocol version is HTTP1, leave the rest as default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*90eSV7NUGRmL-IOeAoLH_Q.jpeg" /></figure><p>Step 8:Create Application Load Balancer</p><p>Click on ‘create a load balancer’ under the EC2 console and select ‘application load balancer. Give a name, choose internet-facing and IPv4 (connection will be through the internet using IPv4). Select your VPC, subnets and security group. The listener should be on port 80 because your target group is on port 80.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qd_CEkqPLWqHLGSwEhq0yQ.jpeg" /></figure><p>Connect your auto-scaling group to your load balancer by clicking the name of the auto-scaling group. Scroll down to load balancing, and click edit. Choose application, network or gateway load balancer target groups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*_LQRNgUGl4DiOQNFx1iSAg.jpeg" /></figure><p><strong>Part B: Application-Tier</strong></p><p>Step 1:Create 2 private subnets.</p><p>On the VPC dashboard — Subnets — Create subnets. These IPv4 CIDR blocks 10.10.3.0/24 and 10.10.4.0/24 were used for respective subnets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*SX0uFCIbGjdi4OmbH3mxRA.jpeg" /></figure><p>Step 2:Create a route table for the private subnet</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*Tpqgp4wUBzKb__tkC9CxTw.jpeg" /></figure><p>Go to subnet associations — edit subnet associations — select private subnets and save associations</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*awwe6hkA99Wf1j2e1xm7vQ.jpeg" /></figure><p>Step 3:Create Nat Gateway.</p><p>Give a name— Select one public subnet (always create Nat Gateway in your public subnet) — connectivity is public — click on allocate Elastic IP to allocate IP — create</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zV_kNv8rjigocFTWBW-QAg.jpeg" /></figure><p>Update route table for private subnets</p><p>Route table — edit route — add route- choose nat gateway</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6MLfaqsmSP_7YQ6KXjd9hQ.jpeg" /></figure><p>Step 4: Create a launch template for EC2 instances. Refer to step 5(part A) used earlier in creating a launch template.</p><p>Create a new security group (AppSecurityGroup). For the security group rule, allow ssh, ICMP and HTTP. In the source field, use the security group of the web tier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*_ECLqDS1gnI5ISIt3K02fg.jpeg" /></figure><p>Launch template called PrivateInstances created</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*TxnbIm8n2X7aTtNFbBuZgQ.jpeg" /></figure><p>Step 5:Create Auto Scaling Group</p><p>Create a name — Choose the existing launch template — Choose your VPC and subnets — Click next — I do not have a load balancer yet — click next.</p><p>Set auto-scaling group to min 2, max 5 and desired capacity 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGmZthgaObm1bF2ad6Nvmg.jpeg" /></figure><p>Step 6: Create Target Group</p><p>Click on Target group — select instances — define a name — protocol is 80 — choose your vpc — protocol version is HTTP1, leave the rest as default</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wcDNnXYnBzDzZ9dKKoQiiA.jpeg" /></figure><p>Step 7:Create Internal Application Load Balancer</p><p>Load balancer type — Application Load Balancer, Name — AppLB, Load balancer scheme: Internal, IP Address type — IPV4, select your VPC and availability zones under mappings, select your security group created for APP tier, select your target group (MyAppTG), leave the rest as default</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eqAg_owqq9pP8y88w0Es9g.jpeg" /></figure><p>Can we ping, the app tier from a web-tier ec2 instance? Let&#39;s verify.</p><p>We will ssh into a web tier instance</p><p>Use the private IPv4 address of your instances</p><pre>ping &quot;private IPv4 addresses&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*iI0nwdqotFt4ecTmEDHk2w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*LmY2Ny52DSJEJ2jSk5Qlbw.jpeg" /></figure><p><em>Roadblock: I could not ping my IP address. I tried it several times, but there was no connection. I could not figure out why, so I tore everything down and started again. I guess I may have mixed things up. I renamed all my services with clarity to prevent mix-ups.</em></p><p><strong>PART C: Database tier</strong></p><p>Step 1:Create 2 private subnets</p><p>Follow the previous steps used in creating subnets to create these subnets</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tYm2VyFtPLc5oQjFim7tLg.jpeg" /></figure><p>Create a route table and associate subnets with the route table</p><p>Go to subnet associations — edit subnet associations — select private subnets and save associations</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jeFzlrFvwg1ZaXtqrttbGA.jpeg" /></figure><p>Step 2:Create DB Subnet group</p><p>RDS dashboard — Subnet groups — Create DB subnet group. Give a name, and description and select your VPC. In the add subnets field— select the AZs (us- west-2a and us-west-2b) — Select the subnets for the DB (Private-Data-1, Private-Data-2).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*mWlY81iCwUUTjcTMQ87yhw.jpeg" /></figure><p>Step 3: Database creation</p><p>On the RDS dashboard, create a database, (we will choose the free tier), choose standard create as the data creation method, engine option is MySQL, choose the free-tier template</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*idGM5XqVnLNIdBkliHkTVw.jpeg" /></figure><p>Add a username and password</p><p>Step 4: Configure the instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*u0hdzpFzKj0l5NFS8N5y9A.jpeg" /></figure><p>Under connectivity, select your VPC and subnet group</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*1IF0BaNnzbh_LpcC1VpmQg.jpeg" /></figure><p>We do not have a VPC security group, so we create</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*VlEiOzELt7OTYW10nne9jA.jpeg" /></figure><p>Database is created</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0vDKp4L1S3_Wj3aIqnyKuQ.jpeg" /></figure><p>Step 5:Update your security group</p><p>Click on the database, navigate the connectivity &amp; security tab, and click on the VPC security group. This should take you to the security page where you can edit your inbound rules. Delete the current inbound rule and add a new rule</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nxjbxOFX-ouiDPyIayJhSA.jpeg" /></figure><p>Select the security group of the app tier</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ooje6e087yFI1LrhNMejCQ.jpeg" /></figure><p>This database was created in one AZ because the template was a free tier. However, to use multi-AZs in a production or test environment, we would deploy Amazon RDS Multi-AZ with one standby. For further information, click <a href="https://aws.amazon.com/rds/features/multi-az/">here</a>.</p><p>Thank you for reading and keep learning.</p><p><strong><em>PS: Delete NAT Gateways, Elastic IPs, and ALBs. They do have a small cost.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f3cec92b25d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>