<?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 Toni Benn on Medium]]></title>
        <description><![CDATA[Stories by Toni Benn on Medium]]></description>
        <link>https://medium.com/@tonibenn?source=rss-e28e898c6e79------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OAYzowiMeiR7KwBUVDp8kw.jpeg</url>
            <title>Stories by Toni Benn on Medium</title>
            <link>https://medium.com/@tonibenn?source=rss-e28e898c6e79------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 05:34:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tonibenn/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[Utilize Docker and the Azure CLI to pull, tag and push a .NET Image to an Azure Container Registry]]></title>
            <link>https://medium.com/@tonibenn/utilize-docker-and-the-azure-cli-to-pull-tag-and-push-a-net-image-to-an-azure-container-registry-f6a348bd9016?source=rss-e28e898c6e79------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6a348bd9016</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Toni Benn]]></dc:creator>
            <pubDate>Sun, 07 Aug 2022 18:14:20 GMT</pubDate>
            <atom:updated>2022-08-07T18:17:31.362Z</atom:updated>
            <content:encoded><![CDATA[<h3>Utilize Docker and the Azure CLI to pull, tag and push a .NET Image to an Azure Container Registry</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N0vejW6jCS10JF5O26EI-w.png" /></figure><p>In this walkthrough I’ll show you how to pull a .NET SDK image from Docker Hub, tag the image and push the image into an Azure container registry (acr) using your local CLI and the Azure CLI. The .NET SDK image contains the .NET CLI, .NET runtime and ASP .NET Core. This image is useful to pool down during the development and building of applications.</p><p><strong>Prerequisites:</strong></p><ul><li>Azure CLI installed locally (<a href="https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-macos">for Mac</a>)</li><li>If you don’t already have a resource group or azure container registry created, you’ll need to do this first. Using the azure CLI once it is installed, log in to your Azure account in the CLI and run this command to create a resource group az group create --name [input RG name] --location [input availability zone] &amp; run this to create an azure container registry within that resource group az acr create --resource-group [name of RG you created] --name [input ACR name] --sku Basic</li><li>Docker installed locally (<a href="https://docs.docker.com/desktop/install/mac-install/">for Mac</a>)</li><li><a href="https://hub.docker.com/">Docker Hub</a> account to pull the .NET SDK image</li></ul><p><strong>Step 1</strong></p><p>Run this command to pull the image.</p><p>docker pull mcr.microsoft.com/dotnet/sdk</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NGda5FpASHZDOynPZv5DHA.png" /></figure><p>Since I’ve already downloaded the image, you’ll see it says “Image is up to date…” but if you are downloading it for the first time, the message will be different.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sVW-pO9ZU_jqXc-wirOwFg.png" /></figure><p><strong>Step 2</strong></p><p>In the prerequisites set up, if you had to create a resource group and azure container registry, you can skip this part. But if you already had the two created, simply log into your Azure account using az login</p><p>A pop up window will appear in your browser for you to log in to your Windows account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e3nG81JN61KQGuUH3_GUng.png" /></figure><p>Once the log in is complete, the json that is printed is confirmation that you’re logged in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y_ml2I6kXemb4Lhck5vruw.png" /></figure><p>Now log in to your azure container registry using az acr login -n &lt;registry-name&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*OA4mBGl-bpr6hHb67rtXFA.png" /></figure><p><strong>Step 3</strong></p><p>Now that you’re logged into Azure and have connected to the container registry, let’s tag the image and push it up to the registry. In this case, I didn’t add a custom tag as the tag that will be used is latest</p><p>docker tag [name_of_pulled_image] [registry_login_servername]/[name_of_image]:tag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JjglSefIfY3pbZiGeX-tfw.png" /><figcaption>Location of Login Server in ACR overview page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*356FnkEJMvVgFJ0ixlchOQ.png" /></figure><p>Now let’s push the image up to the azure container registry.</p><p>docker push [acr_loginserver]/[image_name]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5bQdBVlAp28dvksmPULEoA.png" /></figure><p>Go to your azure container registry to confirm that the image was pushed.</p><p>Head over to Repositories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BfmU_-Bdz7c-Ko4PBKE-hQ.png" /></figure><p>Within the repository you’ll find your newly pushed image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WMbazxwwGfmu2F1vFw5pjw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VX-ykJSfcpp6YkstTnocpg.png" /></figure><p>Great job for making it to the end of this walkthrough 🤠👏🏾!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6a348bd9016" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[C# Program for Beginners]]></title>
            <link>https://medium.com/@tonibenn/c-program-for-beginners-52c3bb5889d9?source=rss-e28e898c6e79------2</link>
            <guid isPermaLink="false">https://medium.com/p/52c3bb5889d9</guid>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[visual-studio]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Toni Benn]]></dc:creator>
            <pubDate>Sun, 10 Jul 2022 17:41:13 GMT</pubDate>
            <atom:updated>2022-07-10T17:44:05.862Z</atom:updated>
            <content:encoded><![CDATA[<p>Program a beginner friendly program in C# using If/Else statements</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KwJxg0Mpq8Z1sxErSGcmGA.png" /></figure><p>In this walkthrough I’ll be demonstrating how to setup a beginner friendly program in C#. I’ve gotten a ton of help following along with <a href="https://www.freecodecamp.org/">freeCodeCamp.org</a> ‘s C<a href="https://www.youtube.com/watch?v=GhQdlIFylQ8&amp;t=9927s"># Tutorial — Full Course for Beginners </a>.</p><p>For this project the scenario I’ve setup is that if you have ≤25$ in your bank account, you should cook at home but otherwise if you have more, then you can enjoy ordering out using Uber eats (we’ve all been there right 😅). <a href="https://github.com/tonibtech/CSharpCodePractice">Here</a> is the repository where the code used for this program is being housed.</p><p><em>Notes about If Statements:</em></p><p>An if statement has two parts: a condition and an action that gets executed when the condition is true. A condition can only have two possible values — true or false. When a condition is false, you can incorporate an else statement to provide an alternate response.</p><p>Prerequisites:</p><ul><li><a href="https://visualstudio.microsoft.com/">Visual Studio</a></li><li>At the top of your newly created project in Visual studio, input all of the lines of code you see that contain using, create a namespace (name of your project), input class program, static void Main(string[] args)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*6pzCfB4CmvL0EJYI7j1xGA.png" /></figure><ul><li>At the very bottom, insertConsole.ReadLine()This will allow us to see the output of our program without the window suddenly closing on us.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*NwKnfOrhGok661VZfyUpbw.png" /></figure><p><strong>Step 1</strong></p><p>Let’s setup the variables needed to gather user input.</p><pre>static void Main(string[] args)</pre><pre>{</pre><pre>Console.Write(&quot;How much money is in your account? &quot;);</pre><pre>double money = Int32.Parse(Console.ReadLine());</pre><pre>Console.Write(money);</pre><p>These variables will simply allow the user to input any number of their choosing. For the second variable I selected double instead of int so that a user could input any number whether whole (4) or a decimal (4.3). I also had to use the Int32.Parse method because Console.ReadLine would’ve expected a string but in this case that’s not what we would’ve been inputting.</p><p>To test out what you’ve written so far, underneath your code, input Console.Write(money);. Hit the green play button at the top or F5 or Ctrl + F5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2BuuwTw1desgP0zvW-y5Qw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dQHeD7rOg5zeuzcphzCxdg.png" /></figure><p>As you see we are being given the number twice because we’ve used two methods Console.Write() which is going to print your input directly across, whereas Console.WriteLine() will print on the next line.</p><p><strong>Step 2</strong></p><p>Let’s setup our if statement. We’re going to include the variable money that we’ve just created and put it next to a condition.</p><pre>if (money &lt;= 25)</pre><pre>{</pre><pre>Console.WriteLine(“Cook at home”);</pre><pre>}else</pre><pre>{</pre><pre>Console.WriteLine(“Enjoy your UberEats”);</pre><pre>}</pre><pre>Console.ReadLine();</pre><pre>}</pre><p>If the user inputs a number that is ≤25, the console will print, “Cook at Home” as the user doesn’t have sufficient funds to order Uber Eats. But if the User inputs a number &gt; 25, the Console will print “Enjoy Your Uber Eats” as it’s now clear they have sufficient funds and don’t have to worry about the Uncle Julius in their wallet (for all my Everybody Hates Chris fans).</p><p>Here’s a view of what the entire program looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sFUtTfGUACav4TX748OYjg.png" /></figure><p>Let’s delete Line 15 to remove the Console’s ability to print the number twice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4m8oa0A57fDnXHTcWs55Tg.png" /></figure><p>Run the program and input the number 12 to see if it works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H6L21pJI-rEBstDgw2Elrg.png" /></figure><p>Great! The console is telling us we should definitely not order Uber Eats and to cook at home.</p><p>Run the program and input number 30 to view the output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qtOcxWMpY4KalnWtLjWXmg.png" /></figure><p>Voila! Congratulations on completing your first program in C#. Try to change the program’s content to create your own C# scenario.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52c3bb5889d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Two Part Git Repo Project in Azure DevOps]]></title>
            <link>https://medium.com/@tonibenn/two-part-git-repo-project-in-azure-devops-4c4b3b52af2d?source=rss-e28e898c6e79------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c4b3b52af2d</guid>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Toni Benn]]></dc:creator>
            <pubDate>Fri, 15 Apr 2022 22:41:41 GMT</pubDate>
            <atom:updated>2022-04-18T15:19:29.975Z</atom:updated>
            <content:encoded><![CDATA[<p>Step-by-Step walkthrough on the basics of Azure DevOps repositories</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*gsW-zy9ByTIfx98YpMmlMQ.png" /></figure><p>After completing one full week as a software engineer at CUNA Mutual Group👩🏾‍💻🙏🏾, I’ve already learned a ton of new information about the cloud ☁️ . The team I am on utilizes <a href="https://azure.microsoft.com/en-us/services/devops/">Azure DevOps</a> to build and deploy applications. It’s the main source of truth during our sprints and allows us to track the work we’re doing and effectively collaborate. But since I’ve been primarily learning Amazon Web Services (AWS), I knew there would be a bit of catching up to do. But if being a student in Level Up In Tech has taught me anything, it’s how to face new tasks and challenges head on 😎.</p><p>I immediately got busy watching a few online tutorials and walkthroughs and thought I’d shared my learning journey with those who may also be getting their feet wet with Azure DevOps.</p><p>In this walkthrough we’re going to explore the most basic way to work with a Git repository in Azure DevOps. If you’re not too familiar with Git, check out my previous article walking through the basics of pulling and pushing code to GitHub <a href="https://medium.com/@tonibenn/github-forking-pull-requests-23e08530176d">here</a>. Ready to get started? Let’s go 🚀!</p><p><strong>Prerequisites</strong></p><ul><li>Azure DevOps Account</li><li>Terminal window or access to a command line</li><li>Git installed on your CLI</li></ul><p><strong>Part 1: Cloning a repo and pushing a file to the main branch</strong></p><p>The first thing you’re going to do is create a new project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iDUqYU35J1bAu441MhPeWw.png" /></figure><p>Give your project a name and a brief description. Set your project to private.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MOXdyBH21_aAwp7-ptVVCw.png" /></figure><p>Click the Advanced button and keep Git as the version control and Basic as the work item process. Create your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g9hA_plAcZqy6_oK-v_yQQ.png" /></figure><p>Click on the Repos tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HOSC4IbzW7bL_LvZkeqjrQ.png" /></figure><p>Right now there are no repositories in this project so we’re going to add content to create a new repo initializing a README and .gitignore file.</p><p>Select VisualStudio from the drop down menu and then press Initialize.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oGA5lKXcSzckN4bfBDhnyw.png" /></figure><p>Your new repository should now look like this and will contain the two files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*khsXLUwE08nxNYLTwQWaaA.png" /></figure><p>We’re now going to make a copy of this repository to our local environment. Before we do this though, we need to generate Git Credentials.</p><p>Click on Clone at the top and select Generate Credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lavCuu0qZvkKveMMk9ZGKg.png" /></figure><p>Once you select Git Credentials, a username and password will be given. Copy the password down as it will not be given to you again later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*vWa-9YL8h2PQl6rBTZsS-w.png" /></figure><p>You’re also going to copy the HTTPS link that is given to you.</p><p>Head over to your command line and input git clone inser_https_link. As you’ll see below. I was already logged in with my git credentials from a previous session.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bxgb4EOoqwaek97ANnLUaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*S25sB4hbC3U-Wca2w1K4DQ.png" /></figure><p>cd into the repository directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*A-w29VIpf7NRQK6ebTcdtg.png" /></figure><p>To check that the files from our repository are present do the ls command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*jQ-ZUQ19HbrHH8gdW2YOsw.png" /></figure><p>Let’s create a new txt file to add to our repository.</p><p>echo “input_text_here” &gt; name_of_file.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mtq1YvqohEhYuOxZYBOFNQ.png" /></figure><p>When you run the git status command, you’ll notice that our new file is “untracked” as it is not on the main branch. We’ll need to commit this file but first we need to do a few things.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x-gNOG9DFmpe560Pe6Fi-A.png" /></figure><p>Run git add name_of_file.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*OyS3bBnLmAwXr2JtsUUAIQ.png" /></figure><p>Run git status again to see how we’ve now added a new file to be committed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*JnWNI34zfUEwOGeTWJnMaA.png" /></figure><p>Now we’re ready to commit our file. When running this command, you’ll need to add a bit of commentary. Typically this comment will give a bit of information in regards to what the commit is about.</p><p>git commit -m “Add_comment_here”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qTe_VKuCRVJ-PqrvvEAMwg.png" /></figure><p>Success 👏🏾. We’ve committed our new file! But we’re not done yet. Even though we have this new file in our repository in our local environment, it is not yet in our Azure DevOps repo. In order to make this new file visible, we’ll need to push it up to the repo by using git push.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DTak7zoxQPe1dulfG8pGAQ.png" /></figure><p>Head over to the Azure console to confirm everything worked correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JkrhG0_h69IQ-abFOwtuJg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vyE0hDw8a7V9XOcNU8wASA.png" /></figure><p><strong>Part 2: Creating a new branch and merging it to the main branch</strong></p><p>Head back over to the CLI and run the command below. This will create a branch with whatever name you input. The -b indicates that this branch does not yet exist. By putting the / we are creating a directory separator that we’ll be able to view in the GUI.</p><p>git checkout -b your_name/feature1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*UQengOGfcom2RDHUDMRP0Q.png" /></figure><p>Let’s create a new file. Follow the same command as in Part 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sDhYc8suG2yqgHALy5ceig.png" /></figure><p>Now let’s begin the process of committing this file with git add</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*uf9NUBGcHMtZAUNnZZtzKQ.png" /></figure><p>Followed my git commit -m &quot;Add_comments_here&quot;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zpN5oLFVquN2h2nGiEulYQ.png" /></figure><p>Finally we’re going to git push this file to our new branch.</p><p>Uh, oh. I’ve run into an error ⚙️⚠️ (I forgot to post a photo of the error 😖, sorry). This is because I haven’t specified where I’d like my new file and repo to be pushed to. With this command, it will work by indicating that we’d like push our new branch to the main branch aka the origin.git push --set-upstream origin tonib/feature1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IUIrsX-vC9C5Og7j6fguPQ.png" /></figure><p>Let’s transition back to the Azure console to submit a pull request to the main branch for everything to be officially merged.</p><p>Select the Branches tab and select Create a pull request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*apATNzwn3P3ZJeAJLGuRcg.png" /></figure><p>In this part you’re able to link the PR (pull request) to an existing bug, story, or feature. You can also input who you’d like to review the PR in order for it to be approved. Once all of that is done, Create the pull request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bJ_vZv5bO5CZ2yh0NExLLw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7b_VqBkTvEeKllHjqEczVA.png" /></figure><p>Being that I selected myself to be a Reviewer, I will be able to Approve or Reject a PR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Cs1gIZit1DrMlY_-fwpIg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*qKDpg2wdMF8amavAGDZ2Lw.png" /></figure><p>Congratulations on making it to the end of this walkthrough 💪🏾🎉! You’ve learned how to operate in a new Cloud environment ☁️.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c4b3b52af2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Launching an S3 Bucket Using Terraform]]></title>
            <link>https://medium.com/@tonibenn/launching-an-s3-bucket-using-terraform-c6bf8c72be93?source=rss-e28e898c6e79------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6bf8c72be93</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[hashicorp]]></category>
            <dc:creator><![CDATA[Toni Benn]]></dc:creator>
            <pubDate>Mon, 11 Apr 2022 22:30:25 GMT</pubDate>
            <atom:updated>2022-04-11T22:30:25.911Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AytdNx89EfHTh7x_Czn3ow.png" /></figure><p>In this walkthrough, we’ll be creating an S3 bucket in Amazon Web Services (AWS) using Terraform. This is a pretty straightforward walkthrough but you will change a bit of information in your .tf files.</p><p><strong>Prerequisites</strong></p><p>AWS account</p><p>Terraform CLI</p><p>IDE (Pycharm or Cloud9 for example)</p><p><strong>Step 1</strong></p><p>Create a new IAM user with full S3 access. I’m going to grant my IAM user Administrator Access and S3 Full access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IxfIVUXGP9bojhtN3Aobvg.png" /></figure><p>Using the aws configure command, input your new IAM user&#39;s credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*VfUxHS5vQNUAz9cJZec8eA.png" /></figure><p><strong>Step 2</strong></p><p>Head over to Github and fork <a href="https://github.com/tonibtech/S3BucketwithTerraform/tree/main">this repository</a>. Once you’ve done that, git clone the repo in your CLI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vg88TnPzfIRgMMi4Yg5Keg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ut8Y2xkZZD_zZacZ3qysEg.png" /></figure><p>cd into your repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*KcxgLiFY5fxb-QoHRLYFbg.png" /></figure><p>Head over to your variables.tf file as we are going to make a few updates.</p><p>The first thing you’ll want to do is change the region of your AWS account. In this case, my account is in us-east-1. Next, you’re going to change the name of your S3 bucket making sure it is globally unique.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*KuDHqwhpax3uPYjmtafO2Q.png" /></figure><p>There isn’t anything we have to change in the main.tf file but let’s review a few main pieces of the code inside the file and what it’s going to do.</p><p><strong>aws_s3_bucket_acl:</strong> This part defines whether the bucket access will be private or not. In the AWS console, this is what it looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FCc4cV0YkMwQxh1Gom0u1A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5g7aSznlNasBBB8dLcY0-Q.png" /></figure><p><strong>aws_s3_bucket_public_access_block:</strong> This line of code defines if the contents of the bucket can be publicly accessed or not. Setting this to “true” will block public access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dn9cIdsX9KXJN5e8GmhuIw.png" /><figcaption>Console</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P5-0AD7JW6US2CrT9qO1Mg.png" /></figure><p><strong>Step 3</strong></p><p>Now that we’ve set up our configuration code, let’s initialize terraform with terraform init</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*snXY-OX_8TMPsctVlS9Rlg.png" /></figure><p>Let’s run our code with terraform apply and watch our S3 bucket be deployed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kOgrKBdXRZrfF564SsoCkA.png" /></figure><p>To confirm that your S3 bucket has been created, head over to the AWS management console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LGc1FIbhTDF85L4PkUKUlw.png" /></figure><p>Don’t forget to terraform destroy your resources so you don&#39;t incur any additional AWS charges outside of the free tier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rE2UCE-dsAjEbqI02dVBLw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*4tF0Qgsq76EYCz9KVdMbPA.png" /></figure><p>Great job on making it to the end of this walkthrough 👏🏾🤠!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6bf8c72be93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a VPC, Subnet, Internet Gateway and RDS MySQL Database Using Terraform (3 Tier…]]></title>
            <link>https://medium.com/@tonibenn/creating-a-vpc-subnet-internet-gateway-and-rds-mysql-database-using-terraform-42fe238a18de?source=rss-e28e898c6e79------2</link>
            <guid isPermaLink="false">https://medium.com/p/42fe238a18de</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Toni Benn]]></dc:creator>
            <pubDate>Sun, 10 Apr 2022 18:54:17 GMT</pubDate>
            <atom:updated>2022-04-11T22:32:13.658Z</atom:updated>
            <content:encoded><![CDATA[<h3>Creating a VPC, Subnet, Internet Gateway and RDS MySQL Database Using Terraform (3 Tier Architecture)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*0XID8x0ak2xAqA3vt68BHg.png" /></figure><p>In this article we’ll be using Terraform to deploy a few resources in AWS. But first, let’s cover what Terraform is. <a href="https://www.terraform.io/intro">Terraform</a> is <em>an infrastructure as code (IaC) tool that lets you build, change, and version cloud and on-prem resources safely and efficiently </em>(Terraform.io). Terraform has many benefits such as allowing users to: manage and track infrastructure, automate changes, standardize configurations, and easily collaborate. Terraform is compatible with most major cloud providers making it a great tool to easily integrate into your already existing cloud environment. In this walkthrough I’ll be showing you how to do a few things with Terraform.</p><p>First, we will 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. Then we’ll create a private subnet with CIDR ‘10.0.3.0/24’ with an RDS MySQL instance (nano) and a load balancer that will direct traffic to the public subnets. Think you’re ready? Let’s get started 🚀.</p><p><strong>Prerequisites</strong></p><p>AWS Account</p><p>Terraform CLI installed</p><p><strong>Step 1</strong></p><p>Access the .tf files and the code within them by forking this <a href="https://github.com/tonibtech/terraform-VPC">Github repo. </a>Clone the repo into your local environment. In this walkthrough I’ll be using Cloud9, an AWS IDE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BQFFkoyJbVVwU1I8y-ooCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cnWi23Fo2D6DbCaz_mFDeg.png" /></figure><p>cd into the directory containing all of the files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w3opZbOjjTXi2acEMY5p1g.png" /></figure><p><strong>Step 2</strong></p><p>You’ll note that our main.tf file is empty. This is because we’ll be splitting up our files as to avoid having an overloaded main.tf file. We’re going to start by making a few changes to our files.</p><p>First head over to the database.tf file. We’re going to change the name of username as it should be a valid MySQL username. I input a random username before and this caused an error as I was trying to deploy my resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*xi5zjgCXFVh15FqVIBy8NA.png" /></figure><p>After a bit of digging, I found that the username “rancher” is valid so I input this name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*xM-qsVYB4ktdI9jD9HiHDA.png" /></figure><p>Don’t forget to run and save your files after you make any changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*SH7YudtFWRBf4S1ntN9BBw.png" /></figure><p>In the private_subnets.tf public_subents.tf and variables.tf files, update what availability zones you’d like your resources deployed in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OWRUPBVwfvZwOseYHrfYyA.png" /></figure><p>We’re not going to make any additional changes to the code in the public_subnets.tf private_subnets.tf or loadbalancer.tf files because our VPC ciders are already set for both the private and public subnets, the load balancer and the RDS MySQL instance .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YkO_2H5YZgwL1ZdfI65GXQ.png" /></figure><p><strong>Step 3</strong></p><p>Initialize Terraform using terraform init</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*utGM_shF_Upua1-bSZBzxQ.png" /></figure><p>Now we’re ready to deploy our resources using terraform apply . But as our resources are deploying, you will be prompted to input a username and password for your database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*PccgxlF2lIiM8vDbjjG_yQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*g_jmmB-n_na4HtCWl1gGvQ.png" /></figure><p>Let’s head over to our AWS console to confirm that our VPC, subnets, internet gateway and RDS database was created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k_RnIVRNiidMUEMUj0plHw.png" /><figcaption>VPC</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tt1sUc_-MLsAISfkryVVfA.png" /><figcaption>Subnets</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wi00CV4ATEf57mo8y36M8Q.png" /><figcaption>Subnets</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8M3q9Jv8ic9U8NAksrQyXw.png" /><figcaption>Internet Gateway</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nCNYo-v0urgkKMiOwL2nbw.png" /><figcaption>RDS Database</figcaption></figure><p>Once you’ve completed everything, be sure to terraform destroy your resources so you don&#39;t incur any charges from AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uJ7nyl0uuc03YZmVj2oPKA.png" /></figure><p>Great job on making it to the end of this walkthrough 👏🏾🎉!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42fe238a18de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Docker Image w/NGINX and Utilizing AWS ECR]]></title>
            <link>https://medium.com/@tonibenn/creating-a-docker-image-w-nginx-and-utilizing-aws-ecr-45b9516e38a3?source=rss-e28e898c6e79------2</link>
            <guid isPermaLink="false">https://medium.com/p/45b9516e38a3</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Toni Benn]]></dc:creator>
            <pubDate>Sat, 19 Feb 2022 21:42:33 GMT</pubDate>
            <atom:updated>2022-02-19T21:42:33.888Z</atom:updated>
            <content:encoded><![CDATA[<p>Step-by-Step walkthrough for using Docker Containers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i88FXb3XSZNpbyNQbnuvYQ.png" /></figure><p>In this walkthrough we’re going to create our very own Docker image utilizing NGINX, add a file that will tell us the time of day the container has been deployed, deploy this container with port 8080 open and utilize <a href="https://aws.amazon.com/ecr/">AWS Elastic Container Registry</a> to save our container’s information. But first, let’s get into what Docker actually is.</p><p>Docker is <em>an open source containerization platform that enables developers to package applications into containers — standardized executable components combining application source code with the operating system (OS) libraries and dependencies required to run that code in any environment (</em><a href="https://www.ibm.com/ae-en/cloud/learn/docker">IBM</a><em>). </em>Whenever you read through DevOps or Cloud engineering job descriptions you always see a requirement stating that the engineer should possess knowledge of containerization tools like Docker. Well this tutorial will give you hands on experience utilizing the platform in conjunction with an AWS service. Think you’re ready? Let’s get started 🚀</p><p><strong>Prerequisites</strong></p><ul><li>An account with <a href="https://hub.docker.com/">DockerHub</a></li><li><a href="https://docs.docker.com/engine/install/ubuntu/">Docker</a> installed (I’ve hyperlinked how to install Docker on Ubuntu because that’s what I’m using in this walkthrough)</li><li>AWS Account with access to ECR</li><li>AWS CLI (command line interface) installed</li></ul><p><strong>Step 1</strong></p><p>Once you have Docker installed in the CLI, we’re going to start by creating the directory we will be working out of.</p><p>mkdir dir_name</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*KT_GBnwqIVjMPZtUfJKs2w.png" /></figure><p>I’ve created a new directory and used the ls command to make sure it’s there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1jwHHqPbNmeWlM7oTermdQ.png" /></figure><p>Now let’s cd into the directory we just made and create a file that will store our Dockerfile and the index.html file that will contain our website’s code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z4pMTPAb_Oflb2fzuOCnKg.png" /></figure><p>This command will create a new file within our directory:</p><p>touch index.html</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nQV1OUlc6GjxdjFQEzQ3Kw.png" /></figure><p>We’re now going to use vim, a text editor, to edit the new file we created. The code within the file serve us a website within our container that will display the date and time it has been deployed. Utilize the code in this <a href="https://github.com/tonibtech/nginx-docker/blob/main/index.html">Github file</a> to input into vim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RZSd6DWetJlrZRp4G6lItg.png" /></figure><p>Hit esc then :wq! to exit vim and save our file’s contents.</p><p>To check that our file was saved correctly use cat name_of_file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*24v0rQPidyuS6CNFJGeKng.png" /></figure><p>We’re going to create one more additional file. Go to this <a href="https://github.com/tonibtech/nginx-docker/blob/main/Dockerfile">GitHub file </a>and repeat the steps of creating a new file, opening vim and inputting the contents of the Github file into the text editor.</p><p>Huge shoutout to <a href="https://medium.com/u/1f8db219468e">Bmwitcher</a> for sharing the code he utilized for his project. I kept encountering errors during the creation of this walkthrough. During test runs, my NGINX website would load and provide the standard NGINX welcome page but it wouldn’t serve up the contents within my index.html file as expected. It wasn’t until I used the code he shared on <a href="https://gist.github.com/bmwitcher/d046386bef49945ea0892683d8084d77">his GitHub account</a> that everything started working.</p><p>The code I’m using in particular is specifically for Ubuntu Linux distributions which is what I’m using and it does a bunch of things for you. This code will run updates, install NGINX, copy your index.html file from your local environment into the Dockerfile you’re creating and it will open port 80. So, let’s get into all of that now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lmL28rb_d1vVpsAJFA2eLQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*riDksdFBue_1WsRxgxWGIA.png" /></figure><p><strong>Step 2</strong></p><p>In order to build our Docker container, use this command:</p><p>docker build -t name_of_your_cointainer .</p><p>What you’ll see happening is the docker file going through each step we input into our Dockerfile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q2WIZxIZ5OY7G7_Rp-AWkA.png" /></figure><p>Next we’re going to run our container and connect it to port 8080:80.</p><p>docker container run -d -p 8080:80 name_of_container:latest</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QLl-48nV3JckK92B00bMbQ.png" /></figure><p>Run docker ps to ensure everything is up and running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j1NTylVtiWpxBN4Jd7J4nA.png" /></figure><p>Great 🤠! Now to confirm that our IP address will run our website, grab the IP address used to SSH into your terminal and add 8080 to the end like so <strong>34.222.204.235:8080</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*4KiTpZ8fifKbc-TJbQ1Zkg.png" /></figure><p>I also tested the site again but this time connecting to port <strong>8081</strong> and it was still successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O9op5SRHDaf9tQgyXf-2Xg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zQyxcdu4qdEMtc-9e1-j0g.png" /></figure><p><strong>Step 3</strong></p><p>In this final step we’re going to upload our container’s contents to AWS ECR.</p><p>First install the AWS CLI in your terminal by running this command:</p><p>sudo apt install awscli -y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yMBBtwDhJp9csgE9koMieQ.png" /></figure><p>Next input aws configure and grab your AWS user’s credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QXaZ4zgggbZJFeVRUPai1w.png" /></figure><p>Now head over to the AWS console and navigate to ECR and select the Get Started button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qmUt8_MYv64UrSWP4xIzOg.png" /></figure><p>Next, name your repository and keep all of the settings in the default mode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k1g8d3RUdKU4uZEO1eHOuA.png" /></figure><p>Scroll to the bottom and hit Create Repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jY77j9IsJGntdp3Lrq8U1w.png" /></figure><p>Once we’re back at the dashboard, select your repository and then click on View Push Commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wtMwUrK5F9AhC6pezs1Jsw.png" /></figure><p>Once the window has opened, copy the first command in Step 1 and input it into your terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dnKb6JWReA1x9TFauBqHyQ.png" /></figure><p>Skip step 2 and instead copy the command for Step 3. But for Step 3, you’ll need to replace the name of the repository that was inserted into the command at the beginning and replace it with the Image name. To access the image name of the container you want pushed, input docker ps and navigate to where you see IMAGE</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KS3crmJcMVyqvlDo5AL0Mw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JgUEebuHd5yaeKyUJRSl8Q.png" /></figure><p>After you’ve run the command for Step 3, run the command for Step 4 (no changes needed here). Once everything is done, you’ll received this notification that your local container’s contents has been pushed up to the AWS repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fu7-ZKgnpn19cBBgZoWjhw.png" /></figure><p>Congratulations on making it to the end of this walkthrough 👏🏾!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45b9516e38a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Starting and Stopping EC2 Instances Utilizing AWS Lambda, CloudWatch and SNS]]></title>
            <link>https://medium.com/@tonibenn/starting-and-stopping-ec2-instances-utilizing-aws-lambda-cloudwatch-and-sns-426d942ee5cb?source=rss-e28e898c6e79------2</link>
            <guid isPermaLink="false">https://medium.com/p/426d942ee5cb</guid>
            <category><![CDATA[boto3]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloudwatch]]></category>
            <dc:creator><![CDATA[Toni Benn]]></dc:creator>
            <pubDate>Fri, 11 Feb 2022 20:08:04 GMT</pubDate>
            <atom:updated>2022-02-11T21:07:35.681Z</atom:updated>
            <content:encoded><![CDATA[<p>Beginners guide to using serverless compute, notification and monitoring services in AWS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ufciNQZuDmN5n7RwpajtPA.png" /></figure><p>In this article we are going to use AWS Lambda, CloudWatch and SNS to start and stop EC2 instances. But first, let’s break down what these three services are.</p><p><a href="https://aws.amazon.com/lambda/">AWS Lambda </a>is <em>an event-driven compute service that lets you run code for virtually any type of application or backend service without provisioning or managing servers (</em><a href="https://aws.amazon.com/lambda/">https://aws.amazon.com/lambda/</a>). Lambda can be triggered from multiple AWS services and you only pay for what you need. In addition, Lambda functions have the option of using Python 🐍 runtime which is great if this is the programming language you’ve been practicing with (it’s also what we’ll be using in this project).</p><p><a href="https://aws.amazon.com/cloudwatch/">CloudWatch</a> is a <em>monitoring and observability service that provides you with data and actionable insights to monitor your applications, respond to system-wide performance changes, and optimize resource utilization (</em><a href="https://aws.amazon.com/cloudwatch/">https://aws.amazon.com/cloudwatch/</a>). With this service you’re able to track what is going on with your AWS services. Data is collected in the form of logs, metrics and events.</p><p>And finally, SNS or Simple Notification Service is <em>a fully managed messaging service for both application-to-application (A2A) and application-to-person (A2P) communication. </em>When you think of Amazon SNS, recall a time when you received notifications from an app on your phone regarding an update or from Amazon that your package has been delivered. These notifications could’ve been setup using Amazon SNS.</p><p>Now that there’s a better understanding of the services that we’ll be working with, let’s get started 🚀!</p><p><strong>Step 1 (IAM Policy)</strong></p><p>The first step of this project is to create an IAM policy and role that allows us execution permissions to our EC2 instances and CloudWatch which we will also need to attach to the our Lambda function.</p><p>Head over to IAM in the AWS management console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T1VXkwbtVTc5zhXDaAePlQ.png" /></figure><p>Once in IAM, head over to policies and click Create Policy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NdocFOl0Pgizp1GHBthM9g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ycmEcVOR5MxknCQHttk_hA.png" /></figure><p>Click on the JSON tab, copy and paste <a href="https://github.com/tonibtech/Week13Project2/blob/main/LambdaPolicy.json">this</a> code into the JSON section (I’ve uploaded the code into a GitHub repository). The code we’re using is granting us permissions to create log groups, streams and events in addition to stopping and starting EC2 instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gja1wezhuqoqKufnrtYcUA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CgJcUudu5xKUf5Z1leRMxQ.png" /></figure><p>Once you’ve input the code, skip past the Tags section and proceed to the Review tab and hit Create Policy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SBgK_R8LxROS_J5vT60CzQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1ILVRAq_BKJ0_fx4I9mbUA.png" /></figure><p><strong>Step 2 (IAM Role Setup)</strong></p><p>We’re now going to create a role and attach the policy we created in Step 1 to this role.</p><p>Since we’re already in IAM, simply navigate over to the Roles section and click Create Role.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mnf2u6wwTLRA-y9HRMZsYQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kj6UBngLPddyEKnUgkYQHQ.png" /></figure><p>Select AWS Service and underneath select Lambda. Then, click Next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tzEEgDp1nKL2pTd3PhtHGQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QDiL_I4fGFXLY25dnyi7Ow.png" /></figure><p>Find the policy we created in Step 1 and select it. Click Next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CxUgRd2QLPd-kdNkoSI9HQ.png" /></figure><p>Give your role a name, and scroll to the bottom and hit Create Role.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NDLug8SCvqGTfyy1IYPZ0Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MzWGi6Hxg0jh3kvfPhUM5w.png" /></figure><p>We’re also going to need a role for the EC2 instances we will spin up so head back to where we started to create a role.</p><p>Select AWS Service again and instead of Lambda, select EC2. Click Next once finished.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k450HJZZSrd96angJPWiyQ.png" /></figure><p>In the Permissions section, we’re going to search for EC2 and select the EC2 Full Access Policy. Click Next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MbfFR1e_eCYxNsZBbAxQfQ.png" /></figure><p>Give your EC2 role a name, and select Create Role.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tr2f28F02_m_gGw0YVK1rA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UXrMkj2zYbL09YJt1wtkhA.png" /></figure><p><strong>Step 3 (EC2 Instance Creation)</strong></p><p>Go to EC2 in the AWS console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G0aWJQRmTsWkUOwLaNc2fA.png" /></figure><p>Click Launch Instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*55slCHwNDtwivwHsm9xYSw.png" /></figure><p>Select Amazon Linux 2 AMI and t2.micro.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LfJAnOvBZmFic-MPy07O3A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kg_R4D2hE5mUgOAnOEVpYQ.png" /></figure><p>Under the Number of Instances, we’re going to input “2”. In addition, select the EC2 role we created under IAM Role.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RURteyIr9WpPDjd8U11PZQ.png" /></figure><p>Skip past the next sections and stop at the Review Instance Launch page. Create a new key pair and download it onto your local environment. Then hit Launch Instances.</p><p>Two Instances should be starting up. Give it a few moments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HiCroND_xybxFDpJITP0DA.png" /></figure><p><strong>Step 4 (Lambda Setup)</strong></p><p>In this step we’re going to use Python Boto3 within our Lambda function in order to start and stop our EC2 instances.</p><p>Within the AWS console, head over to Lambda.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ZhA43A6iRfmon5FOMw2Ww.png" /></figure><p>Once you’re in Lambda, select Create Function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MvctgzaI5xXttNswTc1ZuA.png" /></figure><p>Select Author from Scratch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VXRnhewc4cfrJBTRstBLKA.png" /></figure><p>In the Basic Information section, give your function a name and select Python 3.8 or 3.9 as your Runtime.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zt-B4r5FbzKsyEQV8xzojg.png" /></figure><p>In the Permissions section, select Use an existing role. Once this is selected, a dropdown menu will appear where you will be able to select the role we created in Step 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*acPtgccfsJvURw7QfE8pvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WDgYyqUUCfDcaiDufD5Fgg.png" /></figure><p>We’re not going to do anything with the Advanced Settings section, so go ahead and click Create Function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s5tmOoCQKXzHEJTkRk6UwA.png" /></figure><p>This is the screen you should be prompted to once the function has been created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ksAocCx2KYKj9MOb-9Cstg.png" /></figure><p>Scroll down to the Code Source section. Here we’re going to change the code in the lambda_function.py file. The code we will input will start our Ec2 instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eofhfwpEeAnwqwBdx8CD0g.png" /></figure><p>Go to this <a href="https://github.com/tonibtech/Week13Project2/blob/main/StartLambdaFunction.py">Github repo</a> and copy the code into the Lambda function. We’ll need to change a few parts of the code in order to fit our use case. You’ll need to input your region and instances ID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c9EX7eHT2vH_HzfN_FDMLg.png" /></figure><p>You can find your EC2 instance ID back in the EC2 dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*1cqZP2gqD20LPr3UexkV3g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BTksYcGFHt3V6X8BeRFG4g.png" /></figure><p>In order to stop our instances, we’re going to repeat the initial steps of creating a new function (Selecting Python runtime and the existing role) and then input the code that will stop them.</p><p>Go to <a href="https://github.com/tonibtech/Week13Project2/blob/main/StopLambdaFunction.py">GitHub</a> and copy the stop Ec2 code in the repository into the lamba_function.py file. You’ll also need to update the region and instance ID in this code as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6xc26l5BVjs056RPG2hXQg.png" /></figure><p>Now that we have both Lambda functions setup, let’s configure a test event to see whether or not it works. In this first tester, we’re going to try to stop our instances since we know they’ve been running since we created them.</p><p>In the Code Source section, select Test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*4bazEMPxwY22QJ6MW0lM7Q.png" /></figure><p>Give our test a name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tliyXgizMQSh2PBPpqeZKA.png" /></figure><p>Scroll to the bottom and select Create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S9lW8FYl5D0xCbWIJLhsew.png" /></figure><p>Now you’ll hit the test button in the Code Source section once more, then hit the deploy button next to it, and see what happens. Let’s go over to the EC2 dashboard to confirm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EUnEAOahtcEkZUwzj5dBgw.png" /></figure><p>Wonderful 🎉! Our EC2 instances are stopping. You can do the same thing to start the instances back up except you’ll use the start instance Lambda function.</p><p><strong>Step 5 (SNS Topic Setup)</strong></p><p>In this step we’re going to create topics to add as targets to the CloudWatch events tracking the instances.</p><p>Go to SNS in the AWS console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qp2ax3QENQtQ9E2_mo5-xw.png" /></figure><p>Once you’re at the dashboard select Topics and Create Topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GqARgKcRU8kzX2iX-Joe8g.png" /></figure><p>Select Standard, give your topic a name, and scroll down to the bottom and select Create Topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-aes2vRuu06EB7FDYtf7eA.png" /></figure><p>Once your topic has been created, Select Subscriptions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vxMTvsVnzx69VwQKzyePWQ.png" /></figure><p>Select Create Subscription.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4sETPwHhOlGl1TYwvhfUCQ.png" /></figure><p>The ARN you will select will be the one we just created when we created a topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DBZrE3DMOSJ2aletPJRn0w.png" /></figure><p>The Protocol will be email and for the endpoint, input your email address. Scroll down and select Create subscription.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UqnP4zpoVCxAFnhTCYRM8Q.png" /></figure><p>Go to the inbox of the email that you input in the Endpoint section and verify your subscription.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wl3cK9CHP76T4xAKFoVAMQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wavc5GRxoP2TqryQHGd49g.png" /></figure><p><strong>Step 6 (CloudWatch Setup)</strong></p><p>For our final step, let’s go to CloudWatch in the AWS Management Console. We’re going to create a rule that will start our instances at a specific time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rUDmnEJXoI3eTzNFs7uxKg.png" /></figure><p>Click Events and underneath select Rules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fJsKQIA086tJepztPr17bQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*Ck9R2Zx7sfcLcogzwi5CTg.png" /></figure><p>The setup for CloudWatch events is pretty straightforward. I’ve used <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html">Cron expressions</a> to select when I’d like everything to operate. I’m not actually going to fully create it this time around but I at least wanted to practice setting it up.</p><p>From the screenshot you’ll see that I selected the Lambda function that will start our instances and I’ve selected the SNS topic we created in the previous step that will notify us once our instances are started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yD7ZMinoP2foyuQnmNcFlA.png" /></figure><p>Congratulations for making it to the end of this project 👏🏾. Be sure to delete all of the resources we’ve spun up so that you aren’t billed for them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=426d942ee5cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Serving Up an Image Utilizing CloudFront and S3 through the AWS CLI]]></title>
            <link>https://medium.com/@tonibenn/serving-up-an-image-utilizing-cloudfront-and-s3-through-the-aws-cli-abd0cbe1443f?source=rss-e28e898c6e79------2</link>
            <guid isPermaLink="false">https://medium.com/p/abd0cbe1443f</guid>
            <dc:creator><![CDATA[Toni Benn]]></dc:creator>
            <pubDate>Wed, 09 Feb 2022 20:21:06 GMT</pubDate>
            <atom:updated>2022-02-09T20:21:06.012Z</atom:updated>
            <content:encoded><![CDATA[<p>A walkthrough on how to serve up an image using CloudFront and S3 via the AWS Command line interface</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y7oxostXFk8yfcRSY8YQLQ.png" /></figure><p>In this project, we’re going to utilize CloudFront and S3 to serve up an image through the AWS CLI (command line interface). To create these resources we are actually going to be using a CloudFormation template. Let’s briefly discuss what CloudFront is.</p><p>*If you don’t know what CloudFormation is, I’d recommend that you start by reading my <a href="https://medium.com/@tonibenn/spinning-up-an-ec2-instance-and-vpc-via-cloudformation-part-1-293cdcce2521">previous article</a> to become more familiar with this service and how to use it. If you’re already familiar with CloudFormation, great!*</p><p>CloudFront is <em>a content delivery network (CDN) service built for high performance, security, and developer convenience </em>(aws.amazon.com/cloudfront). In more simpler terms, it’s a way for developers to setup resources like websites that will grant global users fast and easy access to its contents.</p><p>In this project, we’re going to serve up an image using both CloudFront and <a href="https://aws.amazon.com/s3/">S3</a> and with the link we’ll receive from CloudFront, we can retrieve this image in seconds. This is a fairly simple task and shouldn’t take too long. Just make sure you follow along and pay attention to the small details. Let’s go 🚀!</p><p><strong>Prerequisites</strong></p><ul><li>An AWS account created with an IAM user configured possessing full CloudFormation, CloudFront, and S3 access.</li><li>AWS CLI installed on your local terminal</li><li>An image located in the appropriate directory/folder you’ll use in the terminal</li></ul><p><strong>Step 1</strong></p><p>First thing you should do is configure your terminal so that you can access your AWS resources. To do this head over to your terminal and input aws configure(if you don’t have the AWS CLI installed on your terminal use <a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html">this</a> link to download it).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*skk2j-3OQ2fC2FDo-ENSDA.png" /></figure><p>In the prerequisite section, you were tasked with creating an IAM user with specific access. You’ll need your Access Key ID and Secret Access Key for this IAM user to log in in your terminal. In the screenshots below, I’ll be skipping past everything since I”m already logged in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*XsoLW60KC5LZILMnqc0M2A.png" /></figure><p>Now that we’re all logged in, we can cd into the directory from which most of our files will come from. In my case, I have already changed into my downloads directory. I’d recommend you do the same.</p><p><strong>Step 2</strong></p><p>We’re going to download a CloudFormation YAML template from <a href="https://github.com/tonibtech/Krebby/blob/main/s3cftemplate.yml">Github </a>onto our local environment. This template is provisioning a new CloudFormation stack containing a CloudFront distribution and S3 bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6sTBKBJllF4W-scoWfRGdA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v6I0gxBiEwz_-skfCm3wxg.png" /></figure><p>Now that we have our .yml CloudFormation template downloaded, chose a photo and make sure it’s in the same directory as your .yaml file (this will just make finding and accessing things way easier 💆🏾‍♀️).</p><p>Let’s head back to the terminal and run this command in order to officially create our CloudFormation Stack aws cloudformation deploy --template-file &lt;name_of_cloudformation_template_you_downloaded.yml&gt; --stack-name &lt;name_of_stack&gt;</p><p>A sign that you’re on the right track is when you see the message Waiting for changeset to be created. It may take a few minutes for the stack to be created but you’ll receive a notification in the terminal once it’s done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*EE_ZUqCqpmXVq7xRALrhlA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*It9e9GeDU36pt_O0C9sH-w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M6wU0l4dcQ3bgvKSAdCjfw.png" /></figure><p>If you’d like, you can head over to the AWS console to confirm that everything has been created.</p><p>CloudFormation Stack Confirmation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pB16A2-kALcAPrBL-8JhIA.png" /></figure><p>S3 Bucket Confirmation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jErFC5Wv_iODZYB-xIrbjg.png" /></figure><p>CloudFront Distribution Confirmation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CIHAXGJyd1qETjbmar0utg.png" /></figure><p>You can also confirm that your s3 bucket was created by using aws s3 ls in the CLI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1xJO1TYGrK6oA_e5gtqPkw.png" /></figure><p>Copy the S3 bucket ID as we will need it in the next step when uploading our image to the bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ebuI-oXZr9u73pWZ6MhF8Q.png" /></figure><p><strong>Step 3</strong></p><p>Finally, we’re going to upload an image to our S3 bucket utilizing this command aws s3 cp YOURFILE s3://YOURBUCKETID(Grab the S3 Bucket ID we copied in the step above and input it in the YOURBUCKETID field. Input the name of your image that you’ll be using in the YOURFILE field)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t2yQSfnAkVsBKG_y7-IvYw.png" /></figure><p>The image has been successfully uploaded 👏🏾! In order to access it via CloudFront let’s go to the CloudFormation stack set.</p><p>Within the stack we created, head over to the Outputs section and click on the link provided.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*47NW5W3PrYlhmnVwRPSNkQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j5utmyb8XQK4kIMxZPjIog.png" /></figure><p>When you click on the link, you’ll note that we’re given an error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jw1aMJhnvnPR-YnqJnQc-A.png" /></figure><p>From here, what we need to do is simply add the name of our image to the end of the link like so.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*gwCiR6rkKulG5_OLSTUj1Q.png" /></figure><p>And then our image will appear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cq38F14mna4TJFl-oH5F3w.png" /><figcaption>#Throwback of me and the fam ♥️</figcaption></figure><p>Congratulations for making it to the end of this project 🤠🎉😎!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abd0cbe1443f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spinning up an EC2 Instance and VPC via CloudFormation]]></title>
            <link>https://medium.com/@tonibenn/spinning-up-an-ec2-instance-and-vpc-via-cloudformation-part-1-293cdcce2521?source=rss-e28e898c6e79------2</link>
            <guid isPermaLink="false">https://medium.com/p/293cdcce2521</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws-cloudformation]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Toni Benn]]></dc:creator>
            <pubDate>Sat, 29 Jan 2022 21:33:10 GMT</pubDate>
            <atom:updated>2022-02-04T19:42:04.890Z</atom:updated>
            <content:encoded><![CDATA[<p>A beginners guide to creating stacks in CloudFormation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0GNXmDS2fgiNnJVAtupR2w.png" /></figure><p>In this beginner friendly project we’re going to work with <a href="https://aws.amazon.com/cloudformation/">CloudFormation</a> to: setup a VPC and spin up an EC2 instance within the VPC we created with Apache installed and enabled. But first, let’s cover the basics.</p><p><strong>What is CloudFormation?</strong></p><p>CloudFormation <em>lets you lets you model, provision, and manage AWS and third-party resources by treating infrastructure as code (</em><a href="https://aws.amazon.com/cloudformation/"><em>AWS</em></a><em>). </em>In simpler terms, CloudFormation allows you to deploy a handful of services or applications at once via templates. This method reduces the possibility of errors as a result of setting up everything manually. The great thing about CloudFormation is that there are many templates provided that can help you automate deployment.</p><p>For this project, I utilized two CloudFormation templates taken from <a href="https://github.com/tonibtech/aws_networking">Github</a> that I forked and edited to fit my use case. I’d recommend you check it out and do the same.</p><p>Working with Cloud Formation has been a little difficult for me because of how tricky the syntax can be. The AWS documentation does its best with stating what goes where but customizing a template can pose as a challenge for a beginner. But nevertheless, this project was a step in the right direction of getting my hands dirty with this service. If you’re ready to do the same, then let’s get started 🚀!</p><p><strong>Step 1 (VPC Setup)</strong></p><p>Head over to <a href="https://github.com/tonibtech/aws_networking/blob/master/CloudFormation/apache%20http%20server/base-vpc.yaml">Github</a> and either fork this file into your own Github account or download the raw .yaml file onto your local environment.</p><p>I’d recommend that you download the raw file like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iijTeZVcbaGUF8FrwR96ig.png" /></figure><p>Then save the file onto your local environment. A .yaml file should be downloaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bp7gWKollErbP4w7nY7VlA.png" /></figure><p>Currently my VPC is being created in the us-east-1 region. If you’d like your VPC and other services to be created in a different region, you’ll need to make that change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LUDtS7C1hWrNi8WM5e6DVw.png" /></figure><p>Now head over to CloudFormation in the AWS console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L1Sp6nEDIJEkyMg5Vs2RWQ.png" /></figure><p>Select “Create Stack” and chose the option “With new resources”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rQEgRHwXhQ_K7adzAxjlKQ.png" /></figure><p>Select “Template is ready”, “Upload a template file” and grab the .yaml file we downloaded from Github.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tH03eBHRfX-EN9gdds1wjw.png" /></figure><p>Once the file has been uploaded, hit “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A8uYhEvfPuona75z8R4adw.png" /></figure><p>Give your stack a name, and chose the Availability Zone that aligns with what you put in the Default region of your VPC .yaml file. Click “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PNNB4DjhtPjQ0Wj0_KoeqQ.png" /></figure><p>For now we can go ahead and skip past the “Configure Stack Options” page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2WPAuq0fZJ_M4U0SDQ9TpA.png" /></figure><p>Once we’re on the review screen, review that everything looks okay and hit “Create Stack”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dTIG8S-1KnDTXPfh-8UUeA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ouG2xFKCTkc8BS5GV4UgyA.png" /></figure><p>You’ll be prompted back to your CloudFormation dashboard and will see that your stack is in progress of being created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZCZlABZfqz4vEFWvolVfNg.png" /></figure><p>After a few minutes, you’ll see that your stack has been created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Nr9Pql-C0TLj7s5dGVG0Q.png" /></figure><p><strong>Step 2 (EC2 creation)</strong></p><p>First we’re going to create a Key 🔑 Pair. Later we will need to input the Key Pair information into our CloudFormation template.</p><p>Go to EC2 in the AWS console, scroll down and select Key Pair.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vDZE25ffGvfCUDh1ZRO35w.png" /></figure><p>Now select “Create key pair”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2M6s2JLX3oJttdU0d53pFQ.png" /></figure><p>Select a Key Pair name, keep the default settings and click “Create key pair”. The console will automatically download the Key Pair but make sure you write it down somewhere because you’ll need it later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*joVWW1-RrOPR_VxOvILosw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v9yslmslmCcQg6f0q3tQCQ.png" /></figure><p>Now let’s grab the EC2 CloudFormation template from <a href="https://github.com/tonibtech/aws_networking/blob/master/CloudFormation/base-vpc.yaml">Github</a> and follow suit with what we did in step 1 (downloading the raw file onto your local environment). In this step, we will for sure need to edit the code. If you’re a Mac user like myself, I’d recommend <a href="https://www.barebones.com/products/bbedit/">BBedit </a>.</p><p>Once you have the file downloaded onto your computer and open it with a code editor, input the name of the VPC stack created in Step 1 into the “Description”, and “Default” area of this parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j1wR-gKb_zr9DSEdfa9LDQ.png" /></figure><p>Input the name of the Key pair we just created into the “Description” area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n-_uD8Jx8UwWayx-XUqaEQ.png" /></figure><p>For this project we’re going to create a t3.nano instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*v8OggHgNGzlOOzt5aINdBQ.png" /></figure><p>In this final step of code edits, we’re going to head back to the EC2 dashboard, go to “Instances” and select “Launch Instance”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iw8jc8hg8tufJdy8EZM0PA.png" /></figure><p>For this project we’re going to use an Amazon Linux 2 AMI so we need to grab the appropriate AMI ID. Copy it onto your clipboard. Make sure that your region is currently set to the same region that your VPC was created in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fJlBYO0_EYWH60Fn_fkCfA.png" /></figure><p>Now take this AMI ID and copy it into this part of the CloudFormation template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b5uIeQEPtLC3Xm5jehSfsQ.png" /></figure><p>Save the document so that all of the updates are included.</p><p>Head back to the CloudFormation dashboard and we’re going to repeat what we did in Step 1 by uploading our edited .yaml template. Once you’ve done that, you’ll notice that the “Specify stack details” look a bit different than they did before.</p><p>Our AMI ID is automatically added in addition to the instance type and VPCStackName we want our new stack to point to. Hit “Next” at the bottom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k-OhIUuX813Er9eq5jh05A.png" /></figure><p>Skip past the “Configure Stack Options” page and head to “Review Instance” page and click down to the bottom and click “Create”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ExMdlh8tFZFMLjMmgBazzQ.png" /></figure><p>Your EC2 instance with Apache should be spinning up now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qt7RoadNf1PErImcNvmvww.png" /></figure><p>After a few moments it should be ready.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zVuvzBofhyO4ywv1YYKUGQ.png" /></figure><p>Awesome 😎 ! Now let’s head back to the EC2 dashboard to confirm that everything is up and running as expected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pfuYXgZ04kMWrk9-gCsSxA.png" /><figcaption>EC2 Instance up and running 🏃‍♀️</figcaption></figure><p>Click on the Instance ID and copy the Public IPv4 address and paste it into another tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SLsmTgaHe6GMUclZ8_z32w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ljmz64fHswhQv3A7HeheXQ.png" /><figcaption>Our Apache web server with a message has uploaded!</figcaption></figure><p>Congratulations for making it to the end of this walkthrough!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=293cdcce2521" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Code Commit Configurations w/CLI]]></title>
            <link>https://medium.com/@tonibenn/aws-code-commit-configurations-w-cli-afe15b6a5eca?source=rss-e28e898c6e79------2</link>
            <guid isPermaLink="false">https://medium.com/p/afe15b6a5eca</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Toni Benn]]></dc:creator>
            <pubDate>Sat, 22 Jan 2022 21:28:29 GMT</pubDate>
            <atom:updated>2022-01-22T21:28:29.629Z</atom:updated>
            <content:encoded><![CDATA[<p>Configuring Code Commit using the command line interface</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-GFn-F9d1lAjYhhi_berKw.png" /></figure><p>In this walkthrough we’re going to configure and work with AWS Code Commit utilizing the command line interface (CLI). But first, what exactly is <a href="https://aws.amazon.com/codecommit/">AWS Code Commit </a>🤔?</p><p>AWS Code Commit is a managed version control service that hosts private Git repositories. Code Commit is a lot like <a href="https://github.com/">GitHub</a> but it’s an AWS service that integrates seamlessly with other AWS services like <a href="https://aws.amazon.com/codedeploy/">Code Deploy</a>, for example.</p><p>In this walkthrough, you’ll notice that our prerequisite setup is a big part of the project so be sure to following along as best as you can.</p><p>Ready to get started? Let’s go 🚀!</p><p>*For those of you who aren’t too familiar with Git or Git repositories, feel free to check out my previous article on <a href="https://medium.com/@tonibenn/github-forking-pull-requests-23e08530176d">Git/Github </a>for a more in depth introduction.*</p><p><strong>Prerequisites</strong></p><ul><li>An EC2 instance that we will SSH into from our local terminal</li><li>An IAM user w/proper Code Commit credentials (IAM git credentials, IAM generated Access Key and Secret Access Key)</li><li>Git installed on your linux server</li></ul><p><strong>Part 1 (EC2 Setup)</strong></p><p>First thing’s first, you’re going to want to of course login to your <a href="https://aws.amazon.com/">AWS</a> account. Once that’s done, head over to EC2 and hit “Launch Instance”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*whj4O8tvlCXWWYu8mX4IiQ.png" /></figure><p>For this walkthrough we’re going to use an Amazon Linux 2 AMI…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TX4zJRBgwNPcwHG896pmTA.png" /></figure><p>On a t2.micro instance type. Now click “Next:Configure Instance Details”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*36EdnQxwByG0aw0qYaxcMg.png" /></figure><p>Here we’re going to enable utilizing the subnet setting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hFtADj5prGC3jR4om9gpZA.png" /></figure><p>This is what should be selected now. Next, click “Review and Launch”. There’s no need for us to add storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QHyHUV3EmoNm--2P0HWqYA.png" /></figure><p>Now review all of the instance information to ensure everything looks good and click “Launch”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*95kjEaiRO5QgS4LrgoyBvw.png" /></figure><p>Before we officially launch our instance though, we need to create a Key Pair. Don’t forget to download the Key Pair once it’s been created! Once your Key Pair has been downloaded, launch your instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ReeLKpkOLrcjdgNuCR_xAA.png" /></figure><p>This is the confirmation page you should end up with verifying that your EC2 instance has been created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QbCdrOVYsE-H3xPW6a538g.png" /></figure><p>Scroll down to the bottom of the page and click “View Instances”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hUwkX6llZjreoDEgSW1mYQ.png" /></figure><p>Viola 🪄. Our EC2 instance has been created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ApWTnsEt7qERSVr8W2kT5w.png" /></figure><p>Now, open your terminal window on your computer (I’m using a Mac).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zayqeWYkgyuzKVsvrgBDbA.png" /></figure><p>Next we’re going to cd into the directory that holds our Key Pair. Since we downloaded the .pem file onto our computer, it should be located in the downloads directory on your computer.</p><p>cd downloads</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DJsobh41-K11jWSavB0lxQ.png" /></figure><p>To confirm that your .pem file is located in this directory, use the ls command.</p><p>Next, change the permissions of your Key Pair using chmod 400 name_of_keypair.pem</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ldLBGA2PPw2yLXTfx1S_Vg.png" /></figure><p>Now that your Key Pair has the appropriate permissions, we can use it to SSH into our EC2 server. But first let’s head over to the EC2 instance we created to grab the public IP address</p><p>Copy the Public IP address to your clipboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KuPslJuyZ-qTu4nWgcwwsg.png" /></figure><p>Head back to your terminal and input ssh ec2-user@your_IP_addr_here -i name_of_keypair.pem Once you’re prompted to select yes/no select yes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*atXXWRhexlHPi5yr00KI7w.png" /></figure><p>You should now see that your terminal is logged into your EC2 instance! You’re going to want to run sudo yum update to update any packages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9qFLAkSMBoY7ZewBIkZiqA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lVXNF4hzhf0cA4XLPHZInA.png" /></figure><p><strong>Part 2 (IAM user credential setup)</strong></p><p>Head over to IAM in the AWS Console. Here we’re going to create a new user. Select the “Users” tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1PufDZvfQqq9zbeyvbi7OQ.png" /></figure><p>Select the “Add Users” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vl2dI6pnPrNtfuSdXbcqKQ.png" /></figure><p>Now you’re going to give your IAM user: a name, Programmatic access, and access to the AWS Management Console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xq06G6TayPSEskZFvvsAtw.png" /></figure><p>Uncheck the button where it says “Require password reset” and click “Next:Permissions”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cdxzHY_PRiGF0r7bkhNdrA.png" /></figure><p>Select the “Attach existing policies directly”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jnQvceYizlVcOBk9SmEv9A.png" /></figure><p>In the search bar input Code Commit and select “AWS CodeCommit FullAccess”. Click “Next:Tags”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G96KQS3203VsWIjUvIPBJA.png" /></figure><p>Skip past the tags section and to the final review page and click “Create User”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CpnDEgpq03clo0RlkFMxrg.png" /></figure><p>Once you’re on the next page, be sure to download the CSV file with your Access Key ID and Secret Access Key. Also try to copy it down somewhere on your computer .</p><p>Return back to your Users homepage and click on the user we’ve just created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AaraSPFbO6A_RD0_nPpAMA.png" /></figure><p>Click on the “Security Credentials” tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iRAPxyOpgmRzSK_d_5Au3A.png" /></figure><p>Once there, scroll down to the bottom where you’ll see “HTTPS Git credentials for AWS CodeCommit” and select “Generate credentials”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7GI5I1NHFhLzxxLPc6UO0w.png" /></figure><p>This screen is what will appear as a result. Be sure to save your Git credential information as we will be using it in our terminal window later on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YyBCBHUrbn60-4s45zpG8Q.png" /></figure><p><strong>Part 3 (Git Instillation on Linux Server)</strong></p><p>In this step I will provide you with the command but will not add screenshots. I already have Git installed on my local environment but once running the command below, you’ll see that Git instillation is pretty straightforward.</p><p>sudo yum install git</p><p><strong>Part 4 (Creating a repository in Code Commit through the CLI)</strong></p><p>Now we’re going create a Code Commit repository from the CLI.</p><p>First run aws configure. Grab your IAM user’s Access Key ID and Secret Access Key.</p><p>You can input the same region name and output format that you see below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Hw-aGEiR0xcuoMoJYhXhg.png" /></figure><p>To create a repository in Code Commit via the CLI input this command:</p><p>aws codecommit create-repository --repository-name Your_Repo_Name --repository-description &quot;Saturday Walkthrough with Toni&quot;</p><p>Once the repository has been created, you will receive JSON output as confirmation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xGJP6gXOQWjQjqEJOX9I-g.png" /></figure><p>To verify that our repository has been created, lets double check in the AWS Console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QBQBhPD07lksIMsHYXHVvA.png" /></figure><p>Great 👏🏾!</p><p><strong>Part 5 (Cloning your Code Commit Repo and Pushing Up a New File)</strong></p><p>We’re now going to create a file in the AWS console, clone it to our local machine, add a new file, and push the new file up to the main branch.</p><p>Click into the repository we made in the AWS management console.</p><p>Click “Create a file” and add your first line of text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zoZuJzgxk4BzUGm-nGRf6Q.png" /></figure><p>Afterwards input your name, email address and a message to add to the commit. Click “Commit Changes” at the bottom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a8qfcEA65SbYbT2Up6kM3g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CNjz4AJO8Qn5kXTL-wulZA.png" /></figure><p>Before heading over to your local terminal window we need to select the “Clone URL” button in the screenshot above. The URL we were given in the JSON output in our local environment is now out of date since we have added a new file in the AWS management console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VVdGKQ3KpyxMoR8bqlAl3g.png" /></figure><p>Clone HTTPS because that is how we’ve chosen to communicate with Code Commit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EHhH9-NKOoZnKNHwZuMd-g.png" /></figure><p>Head back over to your terminal and input this command:</p><p>git clone input_URL_here</p><p>You will be prompted to input a username/password. Remember when we created Git credentials? Head over to wherever you have this information saved, and insert it into the correct fields.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SeVTV5BY0_tVFMhRIIKWnw.png" /></figure><p>Once an updated copy of your repo is downloaded onto your local environment, hit ls to confirm that your repo is there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*k443NZJqx0bFw4QE1QO7KA.png" /></figure><p>cd into the repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*h01mzpJT_JfXq2kq14G4_A.png" /></figure><p>Check to see if the file we created in the AWS console is in this directory by again using the ls command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*m7r6Y2eJf_YXMUEqh-XRyQ.png" /></figure><p>Perfect.</p><p><strong>Part 5.1(Pushing a new file up to your repository)</strong></p><p>Now we’re going to create a file on our local machine and push it up to our repo in Code Commit while in the CLI.</p><p>We’re going to use the vim text editor to create our new file.</p><p>vim name_of_file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*hJelaG-_lJkyV6agEnYnSg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LSJ1-Eq_13dIwjPD0vqYIA.png" /></figure><p>i to input text, esc to stop editing and :wq! to save file and exit vim.</p><p>cat name_of_file to confirm our text was saved properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*dJAx-qQIZ8ZE_WI5X7soFg.png" /></figure><p>Now we’re going to stage this file to our local repository using the command: git add name_of_file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*PFlpudEPKeQd6OhQKUJing.png" /></figure><p>Next we’re going to commit the file to our local repository using git commit -m “add comment here”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z_6clq96V6VFPMVYDHx9Aw.png" /></figure><p>To verify that this worked run git log</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_lAzs4SOPbu4prRegr1WNA.png" /></figure><p>Now that we have committed our file to our local repository, we need to push the file up to our main repository using git push -u origin main. You’ll also need your Git credentials once more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FyKPD3VEYlLRD2XM30CnWA.png" /></figure><p>Let’s check in the AWS console if our new file has been added.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wLSDGXw7o1I0f9X83AELgQ.png" /></figure><p>Success 🤠. Great job for making it to this end of this walkthrough and getting your hands dirty with Code Commit.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afe15b6a5eca" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>