<?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 Brandon White on Medium]]></title>
        <description><![CDATA[Stories by Brandon White on Medium]]></description>
        <link>https://medium.com/@ibrandonw?source=rss-51f0cd76bbda------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*TanS7EGyJi6gHhO4Y9wqzw.jpeg</url>
            <title>Stories by Brandon White on Medium</title>
            <link>https://medium.com/@ibrandonw?source=rss-51f0cd76bbda------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 09:38:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ibrandonw/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[Deploying an Auto Scaling Group with Terraform]]></title>
            <link>https://medium.com/@ibrandonw/deploying-an-auto-scaling-group-with-terraform-cfe585855a7a?source=rss-51f0cd76bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfe585855a7a</guid>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Brandon White]]></dc:creator>
            <pubDate>Wed, 23 Oct 2024 02:01:46 GMT</pubDate>
            <atom:updated>2024-10-23T02:01:46.447Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*iBQJ6gibp-KQguNX_5_geg.png" /></figure><p>This article will serve as documentation of my deployment process for an Auto Scaling Group with Terraform using a S3 Bucket as a backend.</p><h4>Scenario</h4><p>An e-commerce company needs to handle a surge in traffic during the holiday season. The company wants to ensure that their website remains available and responsive to customers even during high traffic periods.</p><h4>Tasks: (<strong>Using Terraform to build out code)</strong></h4><p>Launch an Auto Scaling group that spans 2 subnets in your default VPC.</p><p>Create a security group that allows traffic from the internet and associate it with the Auto Scaling group instances.</p><p>Include a script in your user data to launch an Apache webserver. The Auto Scaling group should have a min of 2 and max of 5.</p><p>To verify everything is working check the public ip addresses of the two instances. Manually terminate one of the instances to verify that another one spins up to meet the minimum requirement of 2 instances.</p><p>Create an S3 bucket and set it as your remote backend.</p><p><strong>Let’s Go!</strong></p><p>While doing a little prep/research for this project, I found that when trying to add the S3 Bucket within Terraform results in an error because the bucket hasn’t actually been created. To avoid this later down the road, I will manually create my bucket within the AWS console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*Mv9pmXD8B8ONOb4EYrEyNQ.png" /></figure><p>The bucket settings were as follows…general purpose, ACLs disabled, blocking all public access, bucket versioning enabled, and server-side encryption with Amazon S3 managed keys. Once manually created, I make sure I incorporate it within my main script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YnvLG6QxEgr9_7v01AV3NA.png" /></figure><h4>Launching Auto Scaling Group</h4><p>Using the terraform registry, I reference a resource block for my auto scaling group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*GErOsj1BO9Osikn--zXBug.png" /></figure><p>I do the same for my ASG Security Group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ne9d8Rn7Yj8U2eYTwaCwQ.png" /></figure><h4>Installing Apache</h4><p>Installed Apache using a script from the past, with an added custom message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*AuHViUxKKjEgSEXgNw0u6w.png" /></figure><p>Once this task is complete, I run the following commands…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*nVJEXL95rS3zZEpDQY8tbA.png" /><figcaption>terraform init</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*acN_Z3eTxQ6gaGO2sP6X_w.png" /><figcaption>terraform fmt</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*J_jkTJ4cqOHe7xsD-1xV5A.png" /><figcaption>terraform validate</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qgt5hbCSsmjh0pvZQT-RUg.png" /><figcaption>terraform plan</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*JokA5YC7PxhpFhwFwOUWkg.png" /><figcaption>terraform apply -auto-approve</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*htW23M1zcVpBmx5dPWUgwg.png" /><figcaption>The end of the terraform apply command</figcaption></figure><h4>Validation test</h4><p>Now that my configuration was set in motion, I will first check to make sure my instances have spun up…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kWtHxdpKc_8kgXpVDL0ppA.png" /></figure><p>After a few seconds of initializing, I will now open the public IPv4 addresses to validate…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*2YOREY-KhNcQSMunPd1hLA.png" /><figcaption>Instance 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*8zLpRQ4wTPrKaPs8fnks-w.png" /><figcaption>Instance 2</figcaption></figure><h4>Validating Autoscaling Group</h4><p>To verify my ASG configuration, I will manually terminate one of my instances and wait for my autoscaling group to automatically spin up a new…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*7O_FrrgWZLenIO1OX-HATw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4PHCLOdyqlmETl9ewlgh4g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*cbwjrkYtBsWBYow5aBlu5Q.png" /></figure><h4>S3 Bucket Backend Validation</h4><p>Here, is the S3 bucket backend with its contents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l_wwcuDuvXNDnNMkzH4ahA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*SuxANnrLwePhkFlfBoRtCA.png" /></figure><p>To validate I will “Open” the terraform.tfstate folder to view, and then copy the URL to my web browser to confirm that it can only be viewed with certain permissions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*ik75l55QW_NHIvzXglontQ.png" /><figcaption>I checked box of the beforementioned folder and clicked ‘open’ in the top right corner (seen in previous image).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FkrvkZxGbPCX7SJOX2xY7A.png" /></figure><p>Validation successful!</p><p>In conclusion, with Terraform; I was able to deploy an autoscaling group to handle the surge in traffic of an e-commerce company during holiday season.</p><p>By researching and planning ahead, I was able to avoid an error with my S3 bucket backend.</p><p>I also made sure to set variables and kept my files separated while building out the code to keep it as reusable as possible. This can be found here <a href="https://github.com/BWhite487/Terraform-ASG">https://github.com/BWhite487/Terraform-ASG</a></p><p>If you’ve made it this far, thank you for taking the time! Be blessed!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfe585855a7a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a Jenkins Server with Terraform (Inside of AWS Cloud9)]]></title>
            <link>https://medium.com/@ibrandonw/deploying-a-jenkins-server-with-terraform-inside-of-aws-cloud9-84e3f8206883?source=rss-51f0cd76bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/84e3f8206883</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Brandon White]]></dc:creator>
            <pubDate>Sat, 21 Sep 2024 06:50:27 GMT</pubDate>
            <atom:updated>2024-09-21T06:50:27.608Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WHSutxWDuM_jOnf6tD-XBw.png" /></figure><h4><strong>The Scenario:</strong></h4><p>Your team would like to start using Jenkins as their CI/CD tool to create pipelines for DevOps projects. They need you to create the Jenkins server using Terraform so that it can be used in other environments and so that changes to the environment are better tracked.</p><h4>The Tasks:</h4><ul><li>Deploy 1 EC2 Instances in your Default VPC</li><li>Bootstrap the EC2 instance with a script that will install and start Jenkins.</li><li>Create and assign a Security Group to the Jenkins Security Group that allows traffic on port 22 from your ip and allows traffic from port 8080</li><li>Create a S3 bucket for your Jenkins Artifacts that is not open to the public</li><li>Verify that you can reach your Jenkins install via port 8080 in your browser. Be sure to include a screenshot of the Jenkins login screen in your documentation.</li></ul><h4>This will take place, and pick up in my AWS Cloud9 environment!</h4><p>Create environment or select an existing option. Open in Cloud9.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UI1B7ealGo_DUu6dnk2Viw.png" /></figure><p>Once loaded, in the terminal I run commands to configure my AWS credentials to work together with the Cloud9 resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*ctWjRXxiGvaH0Q0cqxzzkw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*u-0v0dho-P25ljApLRKiIA.png" /></figure><p>Next, I create a directory which I then “cd” into and create a file for my code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*dVyO72Z5JNbq2g-YMlnXSA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*PLzqg3IsO6XtCw4kjsrF1Q.png" /></figure><p>These changes are also visible on the left side of the Cloud9 environment page where any other folders and files have been created in past scenarios.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/1*PPJTIwg1N6m6VdMQMrRY6Q.png" /></figure><p>Outside of the Cloud9 environment, I head over to <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs">https://registry.terraform.io/providers/hashicorp/aws/latest/docs</a> to see if can get some help with building out my code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*63JZI6H_R5vPM00BNpTOsA.png" /></figure><p>The next section of my code, was the resource portion for my EC2 instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*ZnFRvLFSTJcPY-QXAXUK8w.png" /></figure><p>Within filling out this part, I had to search for the <strong>ami </strong>in the AWS AMI catalog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*xRI9cG5A_6mUjZA2SL-yVQ.png" /></figure><p>To bootstrap my instance with a script to install and run Jenkins, I reference the official documentation from Jenkins. <a href="https://www.jenkins.io/doc/book/installing/linux/">https://www.jenkins.io/doc/book/installing/linux/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*leVNf--1o3DXBVA70E3GNQ.png" /></figure><p>I now need to create and assign a Security Group to the Jenkins Security Group that allows traffic on port 22 from your IP and allows traffic from port 8080.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*2oU7ReT_aLBETzXQ7iAHgw.png" /></figure><p>The last thing to add will be the S3 bucket with artifacts (that will not be accessible to the public)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*MzFkOEV0GCPUCeMPwru4dA.png" /></figure><p>With that finished, I will initialize, validate, plan; and apply Terraform inside of my terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*Xknjt-3AVaNVnfX9nPGJxQ.png" /><figcaption>Command: terraform init</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*0PYj6sjNcueIcz1U5GXk9w.png" /><figcaption>Command: terraform validate</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n8HhUuNiotUuW3fct5HN0g.png" /><figcaption>Command: terraform plan</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qBop_WAZu-TUDEaf33VDgA.png" /><figcaption>Command: terraform apply</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VYhtcTfBwYC1-9ai_7dxDw.png" /><figcaption>Instance state</figcaption></figure><p>The instance is now running, but to verify that my Jenkins configurations was set up correctly I will copy the public IPv4 address and paste in web browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5SeDU6z8iXHA75J2ny9L3A.png" /></figure><p><strong>Errors:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_0IIY-6ri15zXU9OiGSh-A.png" /></figure><p>My first attempt at running the command “terraform apply” gave me this error (above) which left me pretty confused. After doing some digging I realized that my S3 bucket name wasn’t original/unique enough so I had to change it.</p><p>My repo for this project can be found here <a href="https://github.com/BWhite487/JenkinsTerraform.git">https://github.com/BWhite487/JenkinsTerraform.git</a> and as always, if you made it this far Thank you! Be blessed!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84e3f8206883" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker Swarm Configuration]]></title>
            <link>https://medium.com/@ibrandonw/docker-swarm-configuration-3d8984600a85?source=rss-51f0cd76bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d8984600a85</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ssh]]></category>
            <dc:creator><![CDATA[Brandon White]]></dc:creator>
            <pubDate>Thu, 19 Sep 2024 08:34:15 GMT</pubDate>
            <atom:updated>2024-09-19T08:34:15.650Z</atom:updated>
            <content:encoded><![CDATA[<p>Setting Up a Docker Swarm via Remote SSH Terminal in VS Code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c8QpnNK7-z0sNz9l_NIkQQ.png" /></figure><p><strong>Use case:</strong></p><p>Your company is new to using containers and has been having issues with containerized workloads failing for their global shipping application. The company is worried about additional potential data loss as they have no way to reschedule containers that are failing. The company has one week to update their infrastructure and leverage the use of Docker Swarm so that data can be restored for the containers that are no longer in a healthy state. Because they are not familiar with Docker Swarm, they will need a step-by-step guide on setting up a Swarm for their containerized workloads to assist with container orchestration.</p><p>The solution should include the use of a global service since the company’s global shipping application is having issues. Your Swarm should be able to launch the containers using a global service. Remember, a service is simply a group of containers of the same image that facilitates the scaling of applications. Your global shipping application will require the use of at least three networked hosts, which should be AWS EC2 Ubuntu 20.04 instances.</p><p><strong>Tasks: (Your swarm creation should include the following steps via your remote ssh terminal in VSCode)</strong></p><ul><li>Install docker on all hosts</li><li>Verify that docker is in an active state</li><li>Change the hostname on each node to identify the master node and the two worker nodes</li><li>Validate that the worker nodes all share the same security group as the master node</li><li>Be sure to add your ssh key to each node</li><li>Running the necessary containers using the CLI</li><li>Creating the Swarm using one master node and two worker nodes</li><li>Show your team members the status of the docker nodes</li></ul><p><strong>Getting Started</strong></p><p>Launch three EC2 Instances with docker installed and running. “Master node, Node 2 and Node 3). Within the launch process, there’s a script to ensure Docker is installed and active.</p><pre>#!/bin/bash<br>curl -fsSL https://get.docker.com -o get-docker.sh<br>sh get-docker.sh<br>sudo systemctl enable docker<br>sudo systemctl start docker</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*Ah2od8EMgnNxQc1OtHdLRg.png" /></figure><p><strong>Changing names &amp; verifying Docker is active</strong></p><p>In VS Code, I SSH into my first EC2 instance and change the name with command:</p><pre>sudo hostnamectl set-hostname MasterNode</pre><p>To display, I exit out of the terminal and SSH back into it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*Z7bguiFuk5cWRYpFiYcg6Q.png" /></figure><p>To verify docker is installed and running I use command:</p><pre>sudo systemctl status docker</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9lzmQlj9GziQXRk1kqnp7w.png" /></figure><p>Now, I’ll do the same for Nodes 2 and 3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*1tloHquufn2w2JpeH_-u4A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/231/1*iNppeUNvg0we7U0z0X6BUQ.png" /></figure><p>Node 2 status check</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*V_lJviBHP2nA8_9xKdnYNg.png" /></figure><p>Node 3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*x44gnkpJ9kIdzbV-VpRsCw.png" /></figure><p><strong>SSH keys for worker nodes</strong></p><p>With the master node, I create a file with the same name as my key pair.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*0ePW7QqbeGlh3sC_wNiHsw.png" /></figure><p>Next I locate my PEM file, open it via a test editor, copy it; and paste it into the file I just created in the last step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*imdx_yatf-gd7N8UuOm2eA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/208/1*-Zj0eb696NXc7-Pgol9D5A.png" /></figure><p>To open the newly created file to paste the PEM file use command sudo nano plus my file name</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*vkefp0DBMSubds--DXd8dQ.png" /></figure><p>After saving, I create a “config” file the same way I created the file to store my PEM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*RNvevoSnpdzL5xg0DWN1xA.png" /></figure><p>Now, the ‘sudo nano’ command will be ran with this file, and the set up will look like the config file to SSH into the first EC2 only this time I will include specific information (private IPv4 address) to identify the 2 other instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*dAJSpPi6F8IJwWSWkSKMRg.png" /></figure><p>Now I will SSH in to each worker node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*Bk0ds40ElzaA_2MfcCLgeA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*7EE-osGdKgQNlmfnBCQUiw.png" /></figure><p>With my SSH protocol taken care of, now I will initiate the swarm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cnWibJPS8tl2pCTtvUACpg.png" /></figure><p>To add each worker node, I will SSH one at a time and copy the docker swarm join command including the token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CL6DWyA2JySCdhHxI7AGmw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xfwptS6Tsuo9cYFiVvIfsg.png" /></figure><p>Next I confirm the status of my swarm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BirKnIQjiKDvonCbUFvlfQ.png" /></figure><p>Lastly, I will set up and run the necessary containers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rYv61xh_4IyiK46r6PPAxQ.png" /></figure><p><strong>SUCCESS!</strong></p><p>With this process, we’ve improved efficiency, security, scalability, availability, flexibility; and management! All contributing factors for a healthy environment and productive workflow.</p><p>If you made it this far, thank you for your time. Be blessed!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d8984600a85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Continuous Development & Deployment with Docker and Jenkins]]></title>
            <link>https://medium.com/@ibrandonw/continuous-development-deployment-with-docker-and-jenkins-48812e6429bc?source=rss-51f0cd76bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/48812e6429bc</guid>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Brandon White]]></dc:creator>
            <pubDate>Wed, 18 Sep 2024 03:59:26 GMT</pubDate>
            <atom:updated>2024-09-18T03:59:26.996Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using Docker to create and manage Jenkins containers</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*PCH3tMuyG3JxFkyObid6fQ.png" /></figure><h4>Objective</h4><p>The main objective of this project at Level Up Solutions is to use Docker for creating and managing Jenkins containers, emphasizing the implementation of persistent volumes. This strategy aims to build a robust, scalable Continuous Integration and Continuous Deployment (CI/CD) pipeline, facilitating frequent and reliable deployment of software updates.</p><h4>Tasks</h4><p>Using CLI, pull the Jenkins LTS image from Docker Hub.</p><p>Create a Docker volume for Jenkins to persist its data.</p><p>Run the container with the volume and correct port mapped to the container.</p><p>Retrieve the Admin password.</p><p>Login and create a new user.</p><p>Launch a new Jenkins container using the same volume and verify that the data has persisted by logging in as the newly created user.</p><h4>Lets get to work!</h4><p>To pull the Jenkins LTS image, in VS Code run the command</p><pre>sudo docker pull jenkins/jenkins:lts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*KtSet__2w6SWgRk4znCDmA.png" /></figure><p>The next task is create a docker volume for Jenkins in which I will do with</p><pre>sudo docker volume create</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*AHFfNLG9elIEa4Be2xJKuw.png" /></figure><p>I do a quick volume list to validate that it was created successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*syHIlE67b1lbusZPZMEC7Q.png" /></figure><p>Next I run the container with the volume and correct port mapped to the container</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JRhNQQGidUeTNWc1Yzfy7g.png" /></figure><p>To confirm the container is running</p><pre>sudo docker container ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QOe4M86O8NH9gFPOTN1HTQ.png" /></figure><p>The next task is to retrieve the admin password. To do so, I’ll need the container id, (I would realize later I actually needed the container <strong>NAME</strong>) which can be found by running the command</p><pre>sudo docker ps</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*Ep924s7iJlingh0QjuSyKA.png" /><figcaption>The container ID will cause me issues down the road. See: <strong>ISSUES </strong>end of article.</figcaption></figure><p>Next, I need to get to the Jenkins page so I copy the Public IPv4 address of my EC2 instance and paste it on my web browser <strong>ALONG</strong> with :8080 at the end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5SeDU6z8iXHA75J2ny9L3A.png" /></figure><p>To retrieve the password, I will need to get inside the container. To do so I will run the following command</p><pre>sudo docker exec -it &lt;container_name&gt; bash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*7ah0nD8sJwaFmsAVEPiPqw.png" /></figure><p>Inside the container, I run the command below…</p><pre>cat /var/jenkins_home/secrets/initialAdminPassword</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*J4quxt0424qEvDISDCUUPg.png" /></figure><p>Copy and paste the password into the Jenkins admin password location.</p><p>Choose to Install suggested plug-ins, then fill out the info to create the first admin user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HeOfux4lzIDFElJnj3c9tA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I4_Amueo-duWi8knwEtyMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EYWokA0Ao68XRXkd2JH9dg.png" /></figure><p>click save and finish.</p><p>Jenkins is now ready to start!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C4HwM1VELxbf0Yp0PNghMw.png" /></figure><p>After clicking “start using Jenkins” I am directed to a dashboard of the newly created user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HVPH3pIhpall3IHApA2s0Q.png" /></figure><p>The last task is to launch a new Jenkins container using the same volume and verify that the data has persisted by logging in as the newly created user.</p><p>First, I’ll stop the container currently running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*jxfmwNTQzebC5CecpQZeAg.png" /></figure><p>The next step is to run a new container, mounted to the existing volume.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D2_4tDsnWas7jlV3TLmeWA.png" /></figure><p>Now, back in the web browser, I repost the public IPv4 address of the EC2 instance and the Jenkins page is a sign in, not an unlock admin page. Upon sign-in, I’ll be directed back to my same user dashboard which completes my project!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ei7TOrCYSuGQd_YHadwMXw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HVPH3pIhpall3IHApA2s0Q.png" /></figure><p><strong>Issues:</strong></p><p>My first attempt at this project held me up because I didn’t have the correct security group rules set up. Once I switched to allow traffic from My IP, i could successfully SSH into my instance.</p><p>I also ran into an issue with the administration password, finally realizing I was using my container ID instead of my container name</p><p>All in all this was a great test of patience and problem solving for myself, and I’m proud to have completed what seemed impossible at one point.</p><p>If you made it this far, I appreciate your time! Be Blessed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48812e6429bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Three Tier Architecture]]></title>
            <link>https://medium.com/@ibrandonw/aws-three-tier-architecture-fcbaa1429d0b?source=rss-51f0cd76bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcbaa1429d0b</guid>
            <category><![CDATA[3-tier-architecture]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Brandon White]]></dc:creator>
            <pubDate>Thu, 12 Sep 2024 06:46:24 GMT</pubDate>
            <atom:updated>2024-09-12T06:46:24.829Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*whXyeo65nVvfP68Nwof2yg.png" /></figure><h4>Overview/ Use Case</h4><p>A small e-commerce company wants a scalable and reliable e-commerce platform and decides to deploy a 3-tier architecture.</p><p>A <strong>web tier, </strong>that would be responsible for serving the static content to end-users and handling incoming requests.</p><p>An <strong>application tier</strong>, that would handle the business logic of the platform. This tier would be responsible for processing transactions, handling payments, and interacting with the database.</p><p>Lastly (but certainly no least) a <strong>database tier</strong>, to store all of the platform’s data, including customer information, product data, and transaction records.</p><h4>Creating the Web Tier</h4><p><strong>Requirements </strong>(Per Use Case)<strong>:</strong></p><ol><li>2 private 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 private route table. <strong>NOTE </strong>(This is not a true application tier as we don’t have any provided code to run on the EC2 instances.)</li></ol><p>In the AWS VPC console there are two ways to create the VPC, “VPC only” which would be a step by step approach or “VPC and more” where you can configure all of your settings at once. This demo will be “VPC only”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*k5tZInReY3M14YJzN3oGNA.png" /></figure><p>Any other options <strong><em>not</em></strong> highlighted in green, can be left on the default settings. Once created, <strong>DNS resolution</strong> and <strong>DNS hostnames </strong>will be enabled via ‘Edit VPC settings’ through the ‘Actions’ tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*AHqAzfHhQWsI8AiafcuOEg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*akKj5TwEpNBclksyoS0G7A.png" /></figure><p><strong>Creating Subnets</strong></p><p>Each tier will have 2 subnets. The <strong>web tier </strong>subnets will be public, while the <strong>application</strong> and <strong>database tier</strong> subnets will be private. All will be created one after the other, having each tiers’ subnets split between two different availability zones (us-east-1a and us-east-1b). Ensure that the correct VPC ID is chosen if multiple are available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*868SzlG4m9O_cohRKvexQw.png" /></figure><p>After selecting the VPC, the subnets settings will be selected. Each will have the same IPv4 VPC CIDR block while the IPv4 <strong>subnet </strong>CIDR block will ascend starting at 10.0.1.0/24 through 10.0.6.0/24 and they will be tagged with their respective names to keep them identified.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*uWEtXYwhlGF4HnP-fVIITA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ZS8TXXqfI1S7VTkC7HOQQ.png" /></figure><p>Now that the subnets have been created, the <strong>web tier </strong>subnets (both 1A and 1B) must be made public. This is done by enabling the ‘auto-assign public IPv4 address’ option within the actions/ edit subnet settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V6n1UO2Dn8oyIJAM9oiTYw.png" /></figure><p><strong>Web Tier Route Table and Internet Gateway</strong></p><p>When creating the route table, be sure to use the correct VPC if there is more than one option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BNGaXJWlaIcTCa9DFzP4TA.png" /></figure><p>Once the route table has been created, the two public subnets will be associated with it, along with attaching an Internet Gateway to the VPC. Then, editing the route tables open to allow all HTTP traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-LvBUhRkRBBLOufsWwO7gw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wxbAYtCVH86hjOjn2MfRvg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tQPgk6LxRCoUaqlgOvvnyw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Aapn0kfxks4b65cshFQbkA.png" /></figure><p>The Internet gateway has been created and attached, now back to the Route table console to edit the route to allow all HTTP traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zRzNHrJCY6DvLccxD8jSTQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*80n-nohD8yji2svE--cvSw.png" /></figure><p><strong>Web tier Auto Scaling Group</strong></p><p>To complete the web tier portion, an auto scaling group with at least two EC2 instances will be needed. For this, I will use a launch template. The OS chosen is Amazon Linux 2023 AMI, Instance type: t2.micro; my key pair will be one I’ve used in the past and I will create a new security group with new inbound rules that allows HTTP and SSH. I will also set the source to allow traffic to both, from anywhere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*auQq5xWnO_SKZMIBg8LmUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ac0Ml_TVA-uNxnUAyKumTg.png" /></figure><p>After setting up the launch template, the next step is to create the auto scaling group. Be sure to select the launch template just created. In the network section, choose the corresponding VPC and subnets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ln20dSp1ZfV_aSmXw39-Ww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-y2ZEHMJHGyO9CQbRzMDhg.png" /></figure><p>Next, I create and attach an internet facing application load balancer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T6yghsZsjTG1pBMc5yO1WA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zhdmAc0f0f8Y1btWScjnLQ.png" /></figure><p>Under listeners and routing, I create a target group for the HTTP traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ij6-ELQ3fJj3IEmWBQrjGw.png" /></figure><p>The next task is to configure the group size and scaling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V512LXT6YPh0YJMahqK6dA.png" /></figure><p>After setting my desired capacity limits, I review my steps and create my Auto Scaling Group. My next and final step of setting up the web tier is to verify that my running instances work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n6l3KQNC77RIwcr0irTFeA.png" /></figure><p>I will verify each instance by copying the Public IPv4 DNS…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EUKE7OR7kLyPLSUKB4d8cQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LWhhogBv2ZEvbnfyh1M6GQ.png" /></figure><p>First instance is verified!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R3mRQLVngv9_29agseSnfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uL2PuuJ4AI7mK7cA-2klpg.png" /></figure><p>Second instance is verified! This completes the Web tier build!</p><h4>Creating the Application Tier</h4><p><strong>Requirements</strong></p><ol><li>Two private 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 private route table. (<strong>NOTE</strong> This is not a true application tier as we don’t have any provided code to run on the EC2 instances.)</li></ol><p>The first task will be to create a new route table for our private subnets and associate it with the VPC, along with two private subnet explicit associations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ppxm2GGDRozWBn9Vb3V7xw.png" /></figure><p>Next, I create a NAT Gateway within a public subnet from the web tier with a public connectivity type. Then allocate an elastic IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sroQQLcM6zQgl6GjEQLsUQ.png" /></figure><p>Once created, associate the NAT gateway with the App tier route table. The target and destination should be set to 0.0.0.0/0 and the new NAT gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h4fFgAZiAeLWw-C2pSMsNg.png" /></figure><p>Up next will be the Auto Scaling group. I will do this using a launch template with the same AMI option, instance type selection, and existing key pair that was used in the web tier launch template. Per requirements, I will create a new security group allowing inbound permission from the Web Server Security Group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DAcimCccl8qdGl3ojQz_Iw.png" /></figure><p>From here, I will create an Auto Scaling Group from my template. In the network section of my steps, I choose the corresponding VPC and subnets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BH4dcj5_uJMMXkyvS1ji4A.png" /></figure><p>The next step is to attach a new <strong>internal application load balancer, </strong>followed by network mapping.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bY701XscZoabGkoO2b1yFA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oSQbn4kAMj-OPmBV7ZUODg.png" /></figure><p>When it comes to group sizing and scaling, the desired capacity and min desired capacity will be set at 2 while max desired capacity will be set at 4. Then I add tags, so I know which instances are for my App Tier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Gye3XEfqqPYS7M0QfqvLQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*knIuxBLUrRVzhJ2TirE7qw.png" /></figure><p>The last step of this tier is to verify. To do this, I will connect to one of the web tier instances, and ping the app tier instances’ private IPv4 addresses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AxdyYgnIphypR-_qxwiE-A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*tHLrAZPCzlbjLDxK_0BLpQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JfOumQ3VKmAbJqirtNiRSA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*KQI70AR6d9BD55pyTZblPw.png" /></figure><p>Successfully verified!</p><h4>Creating The Database Tier</h4><p><strong>Requirements (per use case)</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 private route table. (<strong>Note</strong> No need to use Multi-AZ but be sure to document how you would add it).</li></ol><p>In the RDS console, I will start by creating a subnet group. The same corresponding VPC will be selected along with the same two AZ’s. The subnets selected, will be the last two out of the six created at the beginning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W0MoJftbVaG6K9v1qg8kfQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hu7xbxqhlPztSQxkv-3_ug.png" /></figure><p>If I intended to use a Multi-AZ DB then I would have to use 3 different subnets in 3 different availability zones.</p><p>Now that the subnet group is created, I can create a new RDS Database. Using the ‘<strong>Standard create</strong>’ option, my <strong>engine type</strong>: <strong>MySQL</strong> (which is the most popular open source database in the world). The Engine <strong>version</strong> is MySQL <strong>8.0.35</strong> with my <strong>template</strong> being the <strong>free tier</strong>.</p><p>In ‘Settings’ I create a unique DB identifier, Master username (self managed credentials) and Master password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f_g0rAqizMqtOn_jJDhg2Q.png" /></figure><p>Under the configuration settings, I will leave everything as is, and move onto connectivity where ensure to have the correct VPC and “<em>Don’t connect to an EC2 compute resource”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AFwm4xaxg-QMjfcs1t6H0g.png" /></figure><p>The subnet group will be the one just created, and I will opt for “NO” when selecting my Public access option. (I will be accessing the database through the app tier) This is allowed with the Database port 3306</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YYNbKNVbiREm-hWEhzKQSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*LUqolJe2vAaUkrpdw9v4EA.png" /></figure><p>Next I’ll create a new security group. Once the database is created, I will go back in and make the necessary changes. Any other sections not mentioned can be left as-is.</p><p>Now that the database is setting up, I can add the other 2 private subnets to the App tier route table associations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8lDmQ2Z97KRwEsXASY_o3g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X5xSrHcjbPvXI63ysscwrg.png" /></figure><p>After the subnet edits, I configure my database tier security group settings. The inbound rules should only allow traffic from the app tier.</p><p><strong>NOTE </strong>that you must add or delete rule, and not try to modify and existing rule…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-JZTfBstfIYGIgSnND1tng.png" /></figure><p>After deleting the rule and adding the new rule, my changes were saved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BE9BRO2OaVa-9RbMiThVSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rDl1aakbw58GXGV8SRvHSg.png" /></figure><p><strong>Bastion Host (</strong>A server or computer used to access/manage a private network from an external network)</p><p>In this case, an EC2 instance from the web tier will access the the app tier to reduce the risk of any unwanted access.</p><p>The instance setup goes as follows…Amazon Linux 2023 , Instance Type of t2.micro. Network Settings, I edit the VPC to the ThreeTier-PC, select a public subnet, and create a new Security Group - BastionHostSecurityGroup. Within the inbound rules, I select “ssh” -&gt; My IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QqIKhKuFJKM6LuCzscWbLA.png" /></figure><p>Next I need to create a socket which will allow me to log in another machine via forwarded credentials, which will be my KeyPair. Once I run the command, I confirm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gjSw0xQRJ_hB8ccGms6J4Q.png" /></figure><p>With the socket in place, I can SSH into the bastion host. Instead of using the example given in the EC2 Connect section, I replace the “-i” with “-a” representing the keypair saved in the socket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jFKm8zzCg8lDloYlz_3HHg.png" /></figure><p>Now in the bastion host, I can SSH into the App Tier and connect to the database. With MySQL already installed on the server the command</p><pre>mysql -h &lt;endpoint&gt; -P 3306 -u &lt;user&gt; -p</pre><p>should connect us to the Database….</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FjTZvrfwBKXrgtRY2TfM3Q.png" /><figcaption>The endpoint can be found under “Connectivity &amp; Security” tab of the Database page</figcaption></figure><p>I then get a prompt to enter the password created earlier and successfully connect to the database!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tRQPLnUgdhMVUfsTgYh0Iw.png" /></figure><p>This completes the Three-Tier Architecture!</p><p><strong>Struggles:</strong></p><p>When first attempting to SSH into my bastion host I failed. I couldn’t figure out why, but after combing through all of the details I realized that I had created the instance under a different pem key. I had to terminate that instance and create a new one with a corresponding key.</p><p>I also had trouble with my SSH agent not working but after a bit of research I was able to find some answers… <a href="https://stackoverflow.com/questions/18683092/how-to-run-ssh-add-on-windows?source=post_page-----a327d89892ec--------------------------------">https://stackoverflow.com/questions/18683092/how-to-run-ssh-add-on-windows?source=post_page-----a327d89892ec--------------------------------</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gLrzcqkUWGzzNGyQNCKv0w.png" /></figure><p>This was a challenging project but with perseverance and determination I was able to prevail. If you made it to the end, thank you for taking the time. Be blessed!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcbaa1429d0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Containerized Web Application Deployment]]></title>
            <link>https://medium.com/@ibrandonw/containerized-web-application-deployment-4792dcb2a9c8?source=rss-51f0cd76bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/4792dcb2a9c8</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Brandon White]]></dc:creator>
            <pubDate>Sun, 08 Sep 2024 08:32:32 GMT</pubDate>
            <atom:updated>2024-09-08T08:32:32.006Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ens8c2HqXztJuYVjWmpFQ.png" /></figure><h4>Scenario</h4><p>Level Up Solutions is a tech company that offers innovative web solutions to its clients as part of their software development process. They have decided to adopt containerization using Docker to streamline their web application deployment.</p><h4>Tasks</h4><p>Run a Docker Ubuntu container running detached and on port 80</p><p>Using BASH shell update all packages within the container</p><p>Using BASH install Apache2 on the Ubuntu container</p><p>Verify you can reach the webserver from your browser</p><p>Add a custom webpage</p><h4>Let’s Begin!</h4><p>This documentation will pick up after I have launched my EC2 instance using an Ubuntu AMI, t2.micro type, existing keypair and a security group that allows SSH. HTTP, and HTTPS traffic. After launching, I connect via SSH with Windows Powershell.</p><p>In Powershell, I run the following commands to install Docker and verify that it is running.</p><pre>curl -fsSL https://get.docker.com -o get-docker.sh<br>sh get-docker.sh</pre><pre>docker version</pre><p>The next step is to connect the EC2 instance via Remote-SSH in Visual Studio Code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*sBK6fAmP6pbzLMErs-YXSQ.png" /></figure><p>Pictured above, is the configuration file that will allow me to connect.</p><p>In the bottom left corner of the window (not pictured) is a blue button to connect to host which will bring up the list of options in the below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*KA1PXzNxOX0gJI8yMVtzMQ.png" /></figure><p>This will then prompt another options menu to decide on a SSH host.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*4dy6Gq1J0OsVays3b4EDWg.png" /></figure><p>If done correctly, the terminal should look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*sxZ1LArXU9ONUfx9vnGlEg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/158/1*1Y2dNRxFpseUhyrRBbEDTA.png" /><figcaption>This image will be in the lower left corner of the window</figcaption></figure><p>Now connected, the first task is to run a Docker Ubuntu container running detached and on port 80. This is done by running the following command,</p><pre>sudo docker container run -d -p 80:80 -it --name dockerproject ubuntu</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TBM_IXD6ansOWA826JkeXg.png" /></figure><p>To verify, run command</p><pre>sudo docker ps -a</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1F3xr5GjK2AFRscjlE11iw.png" /></figure><p>On to the third task, installing Apache2.</p><p>I ran the following commands, separately.</p><pre>sudo docker exec -it dockerproject bash<br>apt update -y<br>apt upgrade -y<br>apt-get install -y apache2<br>service apache2 start<br>service apache2 status</pre><p>The first command connects as the root user, while the rest are to update, upgrade, install, start and the last is to show that its functioning properly.</p><p>Now back in the web browser, I need conformation that everything is running as it should. To test, I copy the public IP address of my EC2 instance into my web browser…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q1vC04i0w47rf2QV2tIk9g.png" /><figcaption>SUCCESS!</figcaption></figure><p>For my final required task, I will add a custom web page. To do so, I “cd” (change directories) with<strong> cd var/www/html</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/443/1*NzKpCti46-YShJwb-m_5og.png" /></figure><p>and used the following command to script a little message… <strong>echo “If You’re Reading This Brandon, You Have Completed The Mission!” &gt; index.html</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GO4hIs5miouOvlNby9D4yg.png" /></figure><p>Hit the refresh logo on the web browser…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*6MC0cAqQQjRa32XdEi8G1A.png" /></figure><p>Knowing that my tasks are complete, I stop running my container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8r2I9c3Cji6bTegIa_X2bQ.png" /></figure><p>Thank you for you’re time, be blessed!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4792dcb2a9c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Lambda to Stop EC2 Instances]]></title>
            <link>https://medium.com/@ibrandonw/using-lambda-to-stop-ec2-instances-580d6ae38aee?source=rss-51f0cd76bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/580d6ae38aee</guid>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Brandon White]]></dc:creator>
            <pubDate>Fri, 06 Sep 2024 05:14:10 GMT</pubDate>
            <atom:updated>2024-09-06T05:14:10.139Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Documentation of My Path to Stop an EC2 Instance Using Lambda.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gVYOLWkZTq6_Ll5PCFD4pw.png" /></figure><h4>Scenario:</h4><p>Our DevOps engineering team often uses a development lab to test releases of our application. The Managers are complaining about the rising cost of our development lab and need to save money by stopping our ec2 instances after all engineers are clocked out.</p><h4>Tasks:</h4><p>Create a python script that stops all running EC2 instances.</p><p>Create a Lambda function using Python 3.8 or higher runtime to run your script.</p><p>Add a trigger to the Lambda to ensure it runs on a set schedule daily. No one should be working past 7pm.</p><p>Push code to GitHub and include the link in write up.</p><p><strong>Lets’ Go!</strong></p><p>The first thing I did to kick off this project, was launch an EC2 instance. Afterwards, I set up an IAM policy and role to allow Lambda functions to stop my instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*YMlFmM8c8hRyu5DZYav5YQ.png" /></figure><p>In this policy creation, I used a JSON Policy Editor</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j2K8zR4AOrMKzACaOUudgw.png" /></figure><p>The next step was creating a role to attach to the newly created policy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*yIx09K-XeqHuyFB-JdsRPQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*dzaxCBxbB0jzrDmwgwEUOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IxpixKTIRuntAUfmKRH9HA.png" /></figure><p>Now that the IAM role and policy is in place, I will create the Lambda function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*XxB32UVF0EeieIiQyBBaPw.png" /></figure><p>In the <strong>Permissions </strong>section, the default role will be changed to the role created earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J9aT9Oinmto6lYx4gf60DA.png" /></figure><p>After clicking <strong>create function</strong>, I navigate to the ‘<strong>code</strong>’ tab and enter the following Python script, and click <strong>deploy</strong> to save.<em> (This was more of a template that I had to tailor to my region and number of stopped instances)</em></p><pre>import boto3<br>region = &#39;us-west-1&#39;<br>instances = [&#39;i-12345cb6de4f78g9h&#39;, &#39;i-08ce9b2d7eccf6d26&#39;]<br>ec2 = boto3.client(&#39;ec2&#39;, region_name=region)<br><br>def lambda_handler(event, context):<br>    ec2.stop_instances(InstanceIds=instances)<br>    print(&#39;stopped your instances: &#39; + str(instances))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qcbkaiWx5Y0CPN8HDIUOXQ.png" /><figcaption>Note: Region is specific to the user, as is the number of instance(s). Adjust accordingly</figcaption></figure><p>My final step in setting up my function was to add a trigger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9DBtE4UiT2TxIrSki_pYRA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*abZRoAkiOBEFZU2znW0c1g.png" /><figcaption>For more on the AWS CRON expressions, reference the link below</figcaption></figure><p><a href="https://docs.aws.amazon.com/elemental-cl3/latest/apireference/channel-scheduling-cron-syntax-summary.html">https://docs.aws.amazon.com/elemental-cl3/latest/apireference/channel-scheduling-cron-syntax-summary.html</a></p><p>At the time of testing, I altered the event schedule to confirm my instance shut down properly before ultimately changing to the requested time in the task portion of the documentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*QCJMNnGhc9fi6slGqFLo-Q.png" /></figure><p><strong>The results…</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ub1usjR1b_Vkk-epMbjTQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V4FVR1P77qoDlPCvTffAxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*Z4ugFrH0Z8JJ1ucx-kgCrg.png" /></figure><p><strong>Successful!</strong></p><p>Now that I have validated the Python script, I will push it to my GitHub in a repository that can be found here: <a href="https://github.com/BWhite487/EC2Shutdown">https://github.com/BWhite487/EC2Shutdown</a></p><p>Thank you for your time, be blessed!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=580d6ae38aee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Extracting File Data Using Python]]></title>
            <link>https://medium.com/@ibrandonw/extracting-file-data-using-python-5a8f36859525?source=rss-51f0cd76bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a8f36859525</guid>
            <category><![CDATA[cloud9]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Brandon White]]></dc:creator>
            <pubDate>Wed, 04 Sep 2024 07:45:10 GMT</pubDate>
            <atom:updated>2024-09-04T07:45:10.819Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*-PaN3xc45ydNb0HslvSZfg.png" /></figure><p><strong>Scenario:</strong> Your company needs to learn about the files located on various machines. You have been asked to build a script that extracts information such as the name and size about the files in the current working directory and stores it in a list of dictionaries.</p><p><strong>Task: </strong>Create a script that generates a list of dictionaries about files in the working directory. Then print the list. Push code to GitHub.</p><p><strong>Code Guide</strong>:</p><pre>import os</pre><p>This is used to import the built-in OS module, which provides a way of using operating system-dependent functionality. It allows showing contents of directories and getting file sizes etc.</p><pre># Get the current working directory<br>current_directory = os.getcwd()</pre><p>The next line gets the path of the directory where the script is currently running and stores it in the variable “current directory”. It allows the script to know and to use the current directory for future operations, such as listing files there.</p><pre># List all files in the current working directory<br>file_list = os.listdir(current_directory)</pre><p>This collects a list of the names of files and directories located in the directory specified by “current directory” and stores this list in the variable “file list”. Now, this list can then be used for future operations on each file or directory in the specified directory.</p><pre># Initialize an empty list to hold the file information<br>file_info_list = []</pre><p>This command initializes an empty list and assigns it to the variable “file info list&quot;. This list is to store dictionaries containing information about each file (name and size for example) as the script processes them in the current working directory.</p><pre># Loop through the files and gather their information<br>for file_name in file_list:<br>    # Get the full path to the file<br>    full_path = os.path.join(current_directory, file_name)</pre><p>The for-loop is to iterate over each file name in the list of files, constructing the full path for each file, and storing that full path in the variable “full path” for future use.</p><pre> # Check if it is a file (not a directory)<br>    if os.path.isfile(full_path):<br>        # Get the size of the file in bytes<br>        file_size = os.path.getsize(full_path)</pre><p>This command checks that the “full path&quot; corresponds to a regular file; the script then retrieves the size of said file in bytes and stores its size in the variable “file size&quot;. This is gathering information about each file in the current working directory.</p><pre># Create a dictionary with the file&#39;s name and size<br>        file_info = {<br>            &quot;file_name&quot;: file_name,<br>            &quot;file_size&quot;: file_size  # File size in bytes<br>        }</pre><p>Pretty explanatory here. This creates a dictionary to store the name and size of the file.</p><pre> # Add the dictionary to the list<br>        file_info_list.append(file_info)</pre><p>This essentially ensures that the script will accumulate a list of dictionaries, each representing a file in the current working directory. It adds the “file info” dictionary to the end of the “file info list”.</p><pre># Print the list of file information<br>print(file_info_list) </pre><p>The final line is to see all of the collected information about the files in the working directory. Each entry on the list printed, represents a dictionary with details about an individual file.</p><p><strong>The Code in Full</strong></p><pre>import os<br><br># Get the current working directory<br>current_directory = os.getcwd()<br><br># List all files in the current working directory<br>file_list = os.listdir(current_directory)<br><br># Initialize an empty list to hold the file information<br>file_info_list = []<br><br># Loop through the files and gather their information<br>for file_name in file_list:<br>    # Get the full path to the file<br>    full_path = os.path.join(current_directory, file_name)<br>    <br>    # Check if it is a file (not a directory)<br>    if os.path.isfile(full_path):<br>        # Get the size of the file in bytes<br>        file_size = os.path.getsize(full_path)<br>        <br>        # Create a dictionary with the file&#39;s name and size<br>        file_info = {<br>            &quot;file_name&quot;: file_name,<br>            &quot;file_size&quot;: file_size  # File size in bytes<br>        }<br>        <br>        # Add the dictionary to the list<br>        file_info_list.append(file_info)<br><br># Print the list of file information<br>print(file_info_list) </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*-LVlPhM6ky3sq62zAKWqkQ.png" /><figcaption>The script being ran in Cloud9 (AWS)</figcaption></figure><p><strong>File Name and Size</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*fhfhOCD5Lg5mLzUHxYGLMA.png" /></figure><h4><strong>Pushing Script to GitHub through AWS Cloud9</strong></h4><p>To ensure my script is saved and can be accessed through a GitHub repository, I will need to “push” it through my command line via Cloud9.</p><p>Using the “git clone’ command plus my repository URL, I have access through Cloud9…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tvoyh1m9ipAhIUHA0Euorg.png" /></figure><p>I also want to make sure I’m in the correct directory before I push my code…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*yh6uOlRE62uPDPkPpsKNmg.png" /></figure><p>First I stage the change by clicking the source control tab, and the plus symbol which will prompt me to enter a message to complete the stage change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*ijj2SKSfudVXPsEePGCcPQ.png" /></figure><p>Once this is completed, at the bottom left there will be an upward pointing arrow indicating that your code is ready to be pushed…press the arrow and if everything is correct; the code should be added to the repository on GitHub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/243/1*t-MVXXRi4cayKE98bcSzpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*M6sV93ituTXZ6SHJA1g1Mg.png" /></figure><p><strong>GitHub repository link below</strong></p><p><a href="https://github.com/BWhite487/DataExtraction">https://github.com/BWhite487/DataExtraction</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a8f36859525" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DynamoDB Table with Read Only Permission]]></title>
            <link>https://medium.com/@ibrandonw/dynamodb-table-with-read-only-permission-4bb8877d48d2?source=rss-51f0cd76bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bb8877d48d2</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-services]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[dynamodb]]></category>
            <dc:creator><![CDATA[Brandon White]]></dc:creator>
            <pubDate>Wed, 03 Jul 2024 03:20:34 GMT</pubDate>
            <atom:updated>2024-07-03T03:39:51.326Z</atom:updated>
            <content:encoded><![CDATA[<p>Listing the Latest Movie Releases using an AWS DynamoDB Table</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*tNJkMZrP8xa7L60oDMeC2w.jpeg" /></figure><p>In this article, I will list the steps taken to create a DynamoDB Table (using AWS). That table will be listing the 10 latest movie releases. Along with release dates, the table will show the title of the movie, the genre and it’s Rotten Tomatoes rating. The table will also have read permissions only, which will be validated by an attempt to add an item via the AWS Command Line Interface.</p><p><strong>Use Case</strong></p><p>Let’s Go! Media Inc. is a media production and distribution company that creates and distributes movies, TV shows, and other entertainment content to consumers worldwide. As part of their business operations, they need to manage and track information about their media content. In this case, adding information about 10 of the latest movie releases to the table, including the title, genre, release date, and rating.</p><p>To ensure secure access to the DynamoDB table, the company creates a t.2micro EC2 instance and configures it with an IAM role that has the minimum necessary permissions to read the table. Only authorized users can access the data in the table, and there is no risk of unauthorized modifications to the table data.</p><p><strong>Creating the DynamoDB Table</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O51G2dwDcDl-F38vuM3n9w.png" /></figure><p>After locating the table and choosing the “<strong>create’’ </strong>option, I give it a <strong>name</strong>, and <strong>partition key</strong> with a <strong>number type. </strong>This will give each movie it’s own unique id in the event multiple movies share the same title.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y_pULQjQzVMvU3fojqoiHg.png" /></figure><p>All other settings will remain as they were, no changes needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NRAd8EzYp2skcwqZzdLwvQ.png" /></figure><p><strong>Adding Movie Info</strong></p><p>Now that the DynamoDB Table has been created, it is time to add the movies. After choosing the newly created table, Items will be added by selecting the <strong>Actions</strong> tab followed by <strong>Create item.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WO_MKlF6gt2bRTlWxLYVZA.png" /></figure><p>Afterwards, a unique value will be assigned to the <strong>MovieID, </strong>followed by <strong>Add new attribute; </strong>which will include <strong>title, genre, release date </strong>and <strong>rating. </strong>All attributes <strong>except </strong>rating will have their “Type” listed as <strong>strings, </strong>while rating will be listed as <strong>number.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZbUZLrdQLzhgEsxe95eIJQ.png" /></figure><p><strong>BEFORE </strong>clicking create, switching views from <strong>“Form” </strong>to <strong>“JSON view”</strong> will produce the Item attributes in JSON format. By copying this format, it can be used as a template when creating the other items, improving efficiency. When pasting the JSON format, simply switch out the old values for the new information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*59fZgZjTBrLxJzDeWahhXw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I6lncCjWhlsgOZx3LihNWA.png" /></figure><p><strong>Creating an EC2 Instance</strong></p><p>This IAM Role within the EC2 Instance will be the principle of least privilege, basically stating that the role will have the minimum amount of privileges needed. In this case specifically, read-only access.</p><p>The instance will be launched using <strong>Amazon Linux 2023 AMI</strong> with a type <strong>t.2 micro</strong> and an existing key pair. All other settings will remain default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PW7Pbkw9dGiMfeYUpdSQXg.png" /></figure><p><strong>Read Access Using an IAM Role</strong></p><p>Now that the instance is launched, the IAM role will be set by creating a new role in the IAM consol.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZqhZgFlugvfDs4tG3FjPYQ.png" /></figure><p>Here, the <strong>trusted entity type</strong> will be set to <strong>AWS service </strong>and <strong>Use case </strong>will be <strong>EC2.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bdzzkdfdSL4UDvpk-a7wNw.png" /></figure><p>After clicking “next”, assign read only access from the permissions policies by searching “DynamoDB” to narrow the options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L4-rooUpiK2eoZgKA3I-kQ.png" /></figure><p>The next step will be to add a role name along with a brief description.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5rvFUfpoNZ1PzeujGC9c9A.png" /></figure><p>Once the role has been created, it will be attached to the instance by using the <strong>Actions</strong> tab &gt;<strong> Security</strong> &gt; <strong>Modify IAM role</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5RIzh2fuDzw4PzaRrCFtUw.png" /></figure><p>From here, confirm the correct role, click <strong>Update IAM role</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lt5t8QMLbfSWVTEmaH_xvA.png" /></figure><p><strong>Scanning Table via AWS CLI</strong></p><p>Inside of the command line, scanning will begin by running the command</p><pre>aws dynamodb scan --table-name LatestMovieReleases</pre><p>Upon hitting “enter” the list of movies will begin to appear in JSON format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aayavYeIx-wzPZuJiEfKkQ.png" /></figure><p><strong>Read Only Access Verification</strong></p><p>The last step of this process is to verify the read only access. To test, I will try to add an item to the table, through the command line.</p><pre>aws dynamodb put-item --table-name LatestMovieReleases --item &quot;{\&quot;MovieId\&quot;: {\&quot;N\&quot;: \&quot;11\&quot;}, \&quot;Title\&quot;: {\&quot;S\&quot;: \&quot;The Bikeriders\&quot;}, \&quot;Genre\&quot;: {\&quot;S\&quot;: \&quot;Documentary/History\&quot;}, \&quot;ReleaseDate\&quot;: {\&quot;S\&quot;: \&quot;2024-06-21\&quot;}, \&quot;Rating\&quot;: {\&quot;N\&quot;: \&quot;88\&quot;}}&quot;</pre><p>As expected, an error was returned which verifies the IAM role attached.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GQdF0tENRXiKWdbXcDo_lw.png" /></figure><p>In conclusion, the media company’s database remains relevant and readable to its users; while also secured with role policies in place for those who are authorized to modify.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*vkh7BaljJTs7CtUiRL1D1A.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bb8877d48d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step by Step: Creating a VPC, Public Subnets, Auto Scaling Group, and an Application Load Balancer]]></title>
            <link>https://medium.com/@ibrandonw/step-by-step-creating-a-vpc-public-subnets-auto-scaling-group-and-an-application-load-balancer-aee5ce539dc2?source=rss-51f0cd76bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/aee5ce539dc2</guid>
            <category><![CDATA[cloud-services]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Brandon White]]></dc:creator>
            <pubDate>Wed, 19 Jun 2024 03:52:52 GMT</pubDate>
            <atom:updated>2024-06-19T03:52:52.975Z</atom:updated>
            <content:encoded><![CDATA[<h4>This article will lay out the steps to creating a VPC with an auto scaling group. Although it is not a difficult task, there are quite a few steps.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*bogwLYaEkR0KUGNqKDQEeA.png" /></figure><p>At the hypothetical Level-Up Bank, they are looking to improve scalability, reliability, and security by moving their network to the cloud. The service of choice being AWS. With that being said, I will list the steps on how to create a VPC, three public subnets which will host an auto scaling group. I will also show how to set up security groups that will inbound traffic from a load balancer and accessible from the internet.</p><p>Per request of “Level-Up Bank”…</p><h4>1.Create a VPC with CIDR 10.10.0.0/16</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*El9joxP4j5-qsHAMvDQkQg.png" /></figure><p>After the VPC is created, I will edit the settings to allow enable DNS Resolution and Hostnames.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*c_6dFYZ3enqbNQp_Kwj_Dw.png" /></figure><h4>2. Create three public subnets with 10.10.1.0/24 &amp; 10.10.2.0/24 &amp; 10.10.3.0/24</h4><p>Note: Each subnet will be designated a different availability zone. (us-east-1a, us-east-1b, and us-east-1c)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*-WuIw3fSaA7x4f_-8MxJtQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*ArLD7ZxPrDi4LwMW7cMtgQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*GVdtXAej0d-G8a-kyIoByQ.png" /></figure><p>To ensure subnets are public, enable <strong><em>“auto-assign IPv4 public address”</em></strong></p><p>Before creating the Auto Scaling Group, I will first set up an Internet Gateway(virtual router), attach it to my VPC, then configure a Route Table. This will navigate everything outside of the CIDR block to the internet through the gateway attached.</p><h4><strong>3. Create an Auto Scaling Group using t2.micro instances. All instances should have Apache installed on each instance with a custom web page. Ensure the Auto Scaling Group is using the public subnets from step 2.</strong></h4><p>While creating the instances, I will create a launch template where choose to use Amazon Linux 2023 AMI, the t2.micro instance mentioned in the step description, and I will create a new security group with new inbound rules. The rules will allow HTTP and SSH with the source set to 0.0.0.0/0 which allows traffic from anywhere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rovV-cRrv5V8rLhP1UxUxg.png" /></figure><p>Per request, I will also install <strong>Apache</strong> by adding the following script to the user data section, under the advanced details.</p><pre>#!/bin/bash<br>yum update -y<br>yum install -y httpd<br>systemctl start httpd<br>systemctl enable httpd<br>echo &#39;Welcome Back to Level Up Bank&#39; | sudo tee -a /var/www/html/index.html</pre><p>Now that I have my template, I can continue to create the Auto Scaling Group, choosing my VPC, and my subnets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*7_MDYviinKxKEMHSk2g1tw.png" /></figure><h4><strong>4. </strong>The autoscaling min and max should be 2 and 5.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kb-hkC93pfgOLgIN5sL-Ow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*2tfr2nvLMzkiDtZjw6WKJQ.png" /></figure><h4>In these final steps I will create an Application Load Balancer to distribute traffic to the autoscaling group, create web server security group that allows inbound traffic from HTTP from your Application Load Balancer, and create a load balancer security group that allows inbound traffic from HTTP from 0.0.0.0/0.</h4><p>Now that the Auto Scaling Group is created, the next step is to set up a <strong>target group</strong> and a load balancer to distribute the traffic. The target type will be <strong>instances </strong>and the after choosing the corresponding VPC, Protocol Port HTTP-80, the target group is ready to be created. Now I will create an <strong>application load balancer (ALB)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/344/1*C7phmUKTBj-8FVyugPrJ8g.png" /><figcaption>Choose an Application Load Balancer when you need a flexible feature set for your applications with HTTP and HTTPS traffic. Operating at the request level, Application Load Balancers provide advanced routing and visibility features targeted at application architectures, including microservices and containers.</figcaption></figure><p>When creating the ALB my configuration consists of an internet-facing scheme with IPv4 IP address type. My network mapping again, is the corresponding VPC, with all three subnets created. After selecting the security group that was created, the listeners and routing will be from Protocol HTTP Port 80 forwarded to the target group just created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kq6BN6QuH-HURVewpmpHBg.png" /></figure><p>Now that the ALB is created, it will get attached to the Auto Scaling Group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9fzmSqpO1OLvCBpg4YbeDw.png" /></figure><p>To verify correct settings, I will copy the DNS and paste in an incognito web browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e6VhjYxq9eN2CCcYUadQDA.png" /></figure><p>With this setup, Level-Up Bank can take advantage of the scalability, reliability, and security of AWS while maintaining the ability to host its own web applications. The bank can also save costs by using pay-as-you-go pricing for its instances and load balancers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aee5ce539dc2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>