<?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 Marc Coady on Medium]]></title>
        <description><![CDATA[Stories by Marc Coady on Medium]]></description>
        <link>https://medium.com/@marccoady?source=rss-6b9f1800c4d5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XrM9bEJSpxZioqN7x0XwDA.jpeg</url>
            <title>Stories by Marc Coady on Medium</title>
            <link>https://medium.com/@marccoady?source=rss-6b9f1800c4d5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 08:22:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@marccoady/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[The Final Countdown! Or project :)]]></title>
            <link>https://medium.com/@marccoady/the-final-countdown-or-project-b3da4faec4f7?source=rss-6b9f1800c4d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3da4faec4f7</guid>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[codepipeline]]></category>
            <dc:creator><![CDATA[Marc Coady]]></dc:creator>
            <pubDate>Sat, 17 Sep 2022 18:09:52 GMT</pubDate>
            <atom:updated>2022-09-17T18:14:17.390Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Final Countdown! Or project :)</h3><h4>AWS, Terraform and CI/CD Pipeline Whoa!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*9HXYE5aryc2ZhxIZaTvIKg.jpeg" /></figure><h3><strong>What is up with my title?</strong></h3><p>This is it. The Last project that culminates 6 months of learning and training. It was an amazing and challenging experience. I learned about Linux, AWS, Scripting, Infrastructure as a Code, GitHub, Terraform and what a Code pipeline is. I also learned about containerization and the power of serverless architecture. I have to say it was well worth it! If you want to challenge yourself and set yourself up for a great career and/or build your skill set, check it out <a href="https://www.levelupintech.com/">Level Up in Tech.</a></p><h3><strong>What will this article go over?</strong></h3><p>This article I will use Terraform and GitLabs Code pipeline to build the following:</p><ul><li>Creating an S3 bucket to store our terraform state</li><li>Creating a VPC</li><li>2 Public Subnets</li><li>An Autoscaling group with 2 t3.micro instances with a mininum of 2 and maximum of 3</li></ul><p>Also, for this project I am using cloud9 as an IDE and Github as a code repository.</p><h3><strong>First things first — lets create that bucket that will store the terraform state</strong></h3><p>To create your you can use the <strong>aws S3api create-bucket </strong>command. (Remember you need to make this name unique)</p><p>If all goes well, you should see the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*mQ42hQLuVZfiBYzRSf3DMA.png" /></figure><p>Now that the bucket is created lets setup the backend to use that bucket for our Terraform State.</p><p>Create a file called <strong>backend.tf </strong>then make sure that you identify your bucket in the correct region you created your bucket. For me that is <strong>us-east-1</strong>.</p><p>Here is an example of my code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*vGIC-istp9GPTWFUOGBH9g.png" /></figure><p>Next up is to save this and run a <strong>terraform init</strong> command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*XqTQiOnbOC_0konoFR03ew.png" /></figure><p>If all goes well it will let you know that your backend is all set.</p><h3><strong>The Hard part of all this — the scripting</strong></h3><p>Fortunately, I was able to use some previous code as an example. But for whatever reason for me …. things just don&#39;t work right out of the box. It took me several hours to get my terraform script right. So, I could do a <strong>terraform validate </strong>without any errors. I am sharing this because I think people see these articles and think wow this person knows how to do all this and it is so easy for them.</p><p>It is not easy for me .. BUT this is what makes terraform great. It gives you wonderful feedback on what you are doing wrong.</p><p>So, after I finally was successful in getting all my resources built in AWS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jjORI2dNjecdw6MJFnsCOQ.png" /><figcaption>After a successful Apply</figcaption></figure><p>I then proceeded to do a <strong>terraform destroy </strong>and I wanted to make sure my terraform state file was being saved in my S3 bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dIom1UaQBuuQ4QBA_gjdVw.png" /><figcaption>Terraform State file in my S3 bucket</figcaption></figure><p>Here is the repo that my code resides — <a href="https://github.com/marccoady/TheFinalCountdown9172022">The Final Stuff!</a></p><p>So, it looks like we are ready for the next step with putting my code in a CI/CD.</p><h3><strong>The CI/CD — GitLab</strong></h3><p>After thinking about this for a few hours. I wanted to use a CI/CD I never used before. Also, quite frankly could not figure out how to pass my AWS credentials securely without hard coding them. So, I decided to select GitLab. As it is one, I had never had experience with, and secondly they allow one to store your AWS credentials in environment variables.</p><p>So, once I went to GitLab — I had to create an account and authenticate. I used my GitHub credentials do this. I also needed to link my GitHub repositories to my GitLab. I created a new Access token to have my GitLab authenticate to my GitHub. <strong>(How many times can I have “Git” in a sentence?)</strong></p><p>Anyhow once you get all that connected, and they see each other. You want to create a new project. Here is a screenshot showing my project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_TO1U2b916eOSx5ffx7_XA.png" /></figure><p>You then want to enter your AWS settings as environment varialbes. Click on the project link and go to <strong>Settings&gt;CI/CD</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/1*bKhDdk0uZqMRM8rMlkLBUw.png" /></figure><p>From there you want to go to the variables section and enter the following:</p><ul><li><strong>AWS_ACCESS_KEY_ID</strong></li><li><strong>AWS_DEFAULT_REGION</strong></li><li><strong>AWS_SECRET_ACCESS_KEY</strong></li></ul><p>Once completed it should like something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B1HcjWG0YhwcpCSKnDlmiw.png" /><figcaption>Variables for GitLab Project</figcaption></figure><p>Next up is to create your pipeline. Go to <strong>CI/CD</strong> and select the<strong> Pipelines</strong> option. (<strong><em>Note- I had to do this about 4 or 5 times. I realized after just trying to do this. I needed to create a gitlab template file. This file needs to be named gitlab-cyi.yml. I also realized I need to create a config file to reference my S3 backend. So, I also created a tfstate.config file that my template file references — My github repo has both in there for reference)</em></strong></p><p>On the screen that is next choose the <strong>Run Pipeline </strong>button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G9I2G5dHrGkgqug7CUcUBQ.png" /></figure><p>It should show you the steps that have been laid out in the <strong>gitlab-cyi.yml </strong>file — Which are the common commands of terraform — <strong>Validate, Plan, Apply</strong> and <strong>Destroy</strong>.</p><p>Here is that screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*V2GdFHa_HSOdNt1NRxZB5Q.png" /></figure><p>During each stage you can click on it to see Realtime results — Here is an example of the <strong>validate stage </strong>while it was running:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*AwEGCtYYrvWNquAv6MDLLg.png" /></figure><p>Ok the last step is to select the <strong>apply </strong>stage. Mine went off without a hitch and completed succesfully. Nothing like seeing this result!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*msPShe7i1x3Q_MVoerr8dQ.png" /><figcaption>A job well done!</figcaption></figure><h3><strong>Before we Destroy! Let&#39;s check some things out in the Console</strong></h3><p>How about that state file? Is it in my s3 bucket?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CnjYXcqs8Cn5dGP65b3fqg.png" /><figcaption>It sure is! woo hoo</figcaption></figure><p>Looks like it is there.</p><p>Now let&#39;s check on some of the resources that the script created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WwUrF5cnpt8NFbbGTAcE9A.png" /><figcaption>Here is my VPC</figcaption></figure><p>My public subnets:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a_xxdlRjCM_YqnE301AJrQ.png" /><figcaption>Here are my public subnets — deal with it!</figcaption></figure><p>Here are my EC2 instances created from the Lauch Template</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Osem8YEN_TRT-vIAFN_Uyw.png" /><figcaption>T3 micros are cool AF</figcaption></figure><p>I would say it looks like it worked!</p><h3><strong>Let&#39;s Destroy this stuff!</strong></h3><p>You can listen to this <a href="https://www.youtube.com/watch?v=9jK-NcRmVcw">song</a> when you destroy your infrastructure!</p><p>Now go back to your pipeline and hit that destroy button!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*AxOr94R5aED-dwLI1VIgXg.png" /></figure><p>The confirmation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*ZGRor0PGohAMM8Lf8VZlPw.png" /><figcaption>Gotta love when you see Job Succeeded</figcaption></figure><h3><strong>Wrapping Up!</strong></h3><p>Well, I need to take a break for a bit. Like I mentioned in the beginning these six months has been challenging. Quite honestly it has been very stressful. You can only push yourself for so long. So good timing, the holidays are coming up and it would be a good time to relax and spend time with friends and family. I think with the new year will bring my desire to learn back again.. next up Security in AWS!</p><p>I wanted to say one last thing. I am fortunate to have a career in technology some of my classmates have not been given that opportunity as of yet. However, any person that has been able to complete this program — should be given that opportunity. Some of the projects that we have completed are more advanced that what I have done in previous roles.</p><p>Anyhow good luck everyone! More to come .. but not until 2023! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3da4faec4f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS, EKS and Terraform Cloud]]></title>
            <link>https://medium.com/@marccoady/aws-eks-and-terraform-cloud-52360ca5136b?source=rss-6b9f1800c4d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/52360ca5136b</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Marc Coady]]></dc:creator>
            <pubDate>Tue, 06 Sep 2022 01:14:54 GMT</pubDate>
            <atom:updated>2022-09-06T01:14:54.713Z</atom:updated>
            <content:encoded><![CDATA[<p>How many acronyms can I put in the Title? — apparently only 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*acFkSth9ZnQqBMUDBQ-6UA.jpeg" /></figure><h3><strong>What I will explore in this article</strong></h3><p>In this article I will use Terraform to build out an EKS in AWS. I will first do this locally using my pc. Basically, using Visual Studio Code and PowerShell. My local machine has all the software needed that allows me to work through syntax errors and to test that the scripts. I will not be showing that part. I will only show confirmation that I was able to accomplish my goal locally.</p><p>Secondly, I will be using the script with Terraform cloud to showcase how one can use Terraform cloud to use automation to create an EKS in AWS.</p><h3><strong>What is EKS?</strong></h3><p>EKS stands for Elastic Kubernetes Services. Kubernetes is one of the leading technologies dealing with containerization. EKS is a managed K8s service that makes it easy for someone to run K8s on premise and AWS. It is an open-source system for automating deployment, scaling and managing containers. EKS automatically manages the availability and scalability of K8s control plane nodes responsible for scheduling containers, managing application availability and storing cluster data.</p><h3><strong>Let&#39;s get started on the fun stuff!</strong></h3><p>Here is the <a href="https://github.com/marccoady/TFKE3">code</a> I used for this article. I first created it locally and worked through many of the syntax errors. I finally was able to have it work by successfully completing a Terraform <strong>apply</strong> command. As shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*lUlIJybtAMpKNJWwmWHyAA.png" /></figure><p>As a spot check I verified that my VPC was created from my script:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*t6Dreu-0Z06iF6BaeAwOcg.png" /></figure><p>Once I felt good about this. I uploaded this code to my GitHub. I also did a Terraform <strong>destroy</strong> before moving onto the next step!</p><h3>Send to the cloud! Terraform cloud!</h3><p>Up next, I configured my Terraform cloud instance to use my GitHub to deploy this code. To run this code in Terraform cloud you need a few things:</p><ul><li>Obviously a Terraform cloud account</li><li>A GitHub account and repo</li><li>You need to create a workspace in Terraform cloud and point to your GitHub repo</li><li>You need to you know what region, secret key and access key you want to use</li><li>You need to configure the settings above in your workspace</li></ul><p>Here is a screenshot of the variables section of my workspace. Remember to select the environment variable radio button and for the <strong>secret key</strong> and <strong>access key</strong> click the sensitive button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LQK-z49Y5bLIlidjf51N0Q.png" /></figure><p>Here is the screenshot with my variables entered:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LIBn1jMW0BRG0-2HBV9-lQ.png" /></figure><p>Once you have all the correct variables setup you need to start a new run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*jYIGuiFg5IusR8n1Go64-w.png" /></figure><p>You will have to review the Plan and if it all looks good move onto the <strong>Apply</strong> stage:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EMJR-lG5OgUs_qkhsOQAUg.png" /><figcaption>My resources being created in AWS</figcaption></figure><p>This is always good to see!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9UOiPPj5juRInwMDRoSp3w.png" /><figcaption>A successful confirmation of Plan and Apply</figcaption></figure><p>Now let&#39;s do a quick spot check in AWS:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PP39PMjhbezXOZK6adnw4A.png" /><figcaption>The EKS cluster created in AWS</figcaption></figure><p>It feels great when things work!</p><p>Make sure to do a Terraform destroy if you don&#39;t want to be charged in AWS! You can do this from Terraform cloud by going to your workspace setting and choosing <strong>Destruction and Deletion</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*q5-TBEhBscD-B4slGn-mjA.png" /></figure><p>Then choose <strong>Queue destroy plan</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ho2Rrmmz2fk2jLEYwjqJCg.png" /></figure><p>Now choose <strong>Confirm and Apply</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OyNe-clpDKyZ0Vp-Ed3GLg.png" /><figcaption>Destroy it!</figcaption></figure><p>Now watch as everyone you created gets destroyed! ha ha ha ha ha .. I just turn into an evil genius when I write that!</p><p>And here it is destruction confirmed!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DnR_s2MSlsUBiocEFIIy2w.png" /></figure><p>That was faster than me cleaning my room as a teenager!</p><h3><strong>Some lessons learned</strong></h3><p>Once again, I realize that grammatical or syntax errors is really my biggest weakness with scripting. I will miss a quotation or a bracket somewhere. For this exercise my biggest challenges were the naming of my resources. I noticed I kept on misspelling things I was referencing.</p><p>Secondly, I learned that in the AWS free tier you are only allowed 5 VPCs per region. I usually do my work in us-east-1. My script failed the first time I ran it as I already had 5 VPCs in that region. Much like my room as a teenager, I need to clean up my AWS!</p><p>Lastly, I learned you need to make sure any keys you are referencing actually exist. I had a grammatical error in my script that made my script fail. Fortunately Terraform gives great error responses to help with any mistypes.</p><h3><strong>Wrap it up</strong></h3><p>Another exciting project displaying scripting and the cloud technologies that exist to make every IT professional more efficient. I hope this gives you some insight on how this works and gives you inspiration to make tasks at work less mundane!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52360ca5136b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform Cloud and AWS]]></title>
            <link>https://medium.com/@marccoady/terraform-cloud-and-aws-a167791d464c?source=rss-6b9f1800c4d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/a167791d464c</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws-automation]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Marc Coady]]></dc:creator>
            <pubDate>Sun, 28 Aug 2022 17:54:56 GMT</pubDate>
            <atom:updated>2022-08-28T17:54:56.334Z</atom:updated>
            <content:encoded><![CDATA[<p>Building infrastructure in AWS using Terraform Cloud</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*JsAvNFix90VaSClLrgRTHg.jpeg" /></figure><h3><strong>The topic of this article</strong></h3><p>The last few weeks I have been learning Terraform and how it can be used to create infrastructure and resources in AWS. So, for this article I am going to create:</p><p>A highly available two-tier AWS architecture containing the following:</p><ul><li>3 Public Subnets</li><li>3 Private Subnets</li><li>Auto Scaling Group for Bastion Host (private subnets)</li><li>Auto Scaling Group for Web Server (public subnets)</li><li>Internet-facing Application Load Balancer targeting Web Server Auto Scaling Group</li></ul><p>I will be deploying this using Terraform cloud and attempt to use module blocks as much as possible.</p><h3><strong>Some Prerequisites</strong></h3><ul><li>Terraform Cloud account</li><li>AWS account</li><li>GitHub account</li><li>An IDE (I used cloud9 and visual studio code)</li><li>The code you want to deploy</li></ul><h3><strong>Starting out</strong></h3><p>Many articles discuss the first thing you do is fork a repo and then setup Terraform cloud. This is true in the early stages. But really the first step in this whole process is getting your script correctly working.</p><p>What I did first was to map out and figure out how I wanted to name my script and the structure of my folders/modules. I started first using Visual Studio Code. I then copied that up to Cloud9 to test and validate my script. Once I had it working successfully, I then synchronized that with my GitHub repo that I use for this article.</p><h3><strong>Terraform Cloud</strong></h3><p>I already have an organization, so I am not going to over setting that up. But I will go through setting up a New Workspace.</p><p><strong>Setting up the TC workspace</strong></p><p>Once logged into your organization select the new workspace button in the upper right corner and choose your workflow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3f2XFf5GDd3wZvvjkS_h5w.png" /><figcaption>For this example, chose Version control workflow</figcaption></figure><p>Next up select the version control provider (I already have my github account setup)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xw5lXQG7zKNTqlq74wjXdg.png" /><figcaption>Here select Github or connect to it if needed</figcaption></figure><p>Next select the repo that houses your code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vA01RCrmZfuFrztocamt_w.png" /><figcaption>For this example, my code is in tfcloud</figcaption></figure><p>Optionally you can put a description in the configure settings section of the setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uen5umA7YM8AkwQkMfr7hQ.png" /><figcaption>Choose create workspace</figcaption></figure><p>If it all worksout you should see the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DGs8vajbBxQNsa83Xo0cKQ.png" /><figcaption>Confirmation of workspace being created</figcaption></figure><p><strong>Configure variables</strong></p><p>Why is this needed? well when you run your script from your IDE you already have these configured. For example, since this script interacts with AWS you have to tell Terraform Cloud how to authenticate and what region you want to build your infrastructure. For example, my IDE I ran aws configure to set these up. With Terraform cloud you have to do that by adding environment variables.</p><p>From the above screenshot select Go to Workspace overview. The choose the variables tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xqeNiHLjhWn7QWmYlJdBMg.png" /><figcaption>Select Variables</figcaption></figure><p>You want to set these three variables up: <strong>AWS_ACCESS_KEY_ID , AWS_SECRET_ACCESS_KEY </strong>and <strong>AWS_DEFAULT_REGION</strong></p><p>Obviously, you want to protect the AWS access ke and secret access key. You can do this my making them sensitive. Also, your default region is the region you want your resources to be deployed. I am using <strong>us-east-1</strong></p><p>Once your variables are setup it should look like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kihpo9xE-2kZ0OxQMD9i7Q.png" /></figure><h3><strong>Finally, the time has come to give this a run!</strong></h3><p>On the right side choose Actions and select Start new run</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*aI1cbPbd8PA54oyw8suBRQ.png" /><figcaption>To Start to run your code</figcaption></figure><p>Give a reason why you want to run the code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QerREv3Gn1RSh-jaGWb89g.png" /><figcaption>I hope it works!</figcaption></figure><p>Looks like it might work!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yif-z1COiCGIabXVYBzmAQ.png" /><figcaption>This better work, or I will throw my monitor out my window!</figcaption></figure><p>So finally, you should get one last final Confirm and apply option:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2rwkceKtJZQyRsx4bp5n3w.png" /><figcaption>It is the final countdown! or the final button to push</figcaption></figure><p>Oh, wait there is more! one last thing is to add a comment and then confirm the plan!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BETqW4PnkAR9RJFXZrAFmw.png" /></figure><p>You should see an apply running message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cFTeFgCGfNBJXSpE6xzrSg.png" /><figcaption>Apply running message with real-time updates</figcaption></figure><p>So, this is a very good sign!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pRBZCzgupniGJuzQB9lX3g.png" /></figure><h3><strong>Let&#39;s Spot Check some things in AWS</strong></h3><p><strong>Here is my VPC</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BqRPEuHd9iTwcmp-o-8lAw.png" /></figure><p><strong>My Security groups</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m9Nd1zMHF7TydpzU34OFLQ.png" /></figure><p><strong>My load balancer</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0C2g_vLQXzP29TJfTgxlcQ.png" /></figure><p><strong>Autoscaling Groups</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IwqgSqDn3ir4K8vQBlv-GA.png" /></figure><p><strong>Subnets</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*woQlHpdwxbCBCEGhkV-s5w.png" /></figure><p>I did not check everything, but it looks like to me its setup everything I wanted to setup. Both from confirmation in Terraform cloud and in the AWS console.</p><h3><strong>Destroy!</strong></h3><p>The one thing you have to be conscious of is everything you create and play with in AWS you get charged for. That is what is great about Terraform and the destroy command. As it can clean up all your work. Here is how its done in Terraform Cloud.</p><p>In your workspace choose <strong>Settings&gt;Destruction and Deletion</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*ajTxddjmoERbp2MezBQRBg.png" /><figcaption>Destruction and Deletion option</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*55GXMvkBsBLeyvkgEnFa4g.png" /><figcaption>Destruction and Deletion choose Queue destroy plan</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mr7G1EzIyT2XgJWnjA009Q.png" /><figcaption>Enter your workspace and choose destroy plan</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CQYmfA2b6NUpRksrktHPPw.png" /><figcaption>Showing the plan running</figcaption></figure><p>Last thing to do is<strong> confirm and apply</strong>!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qgt3t4ZST8aFHgYl_pkBvQ.png" /><figcaption>Destroying what I just created in AWS</figcaption></figure><p>If everything works out and it gets destroyed, you should see the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PEjBjYDZnkrix4bBlD5cWw.png" /></figure><p><strong>My Github</strong></p><p>You can check out the code I used <a href="https://github.com/marccoady/tfcloud">here</a></p><p>Hope you enjoyed article! Happy automating! Happy Clouding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a167791d464c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform, Docker and AWS ECS]]></title>
            <link>https://medium.com/@marccoady/terraform-docker-and-aws-ecs-1b62e33ee107?source=rss-6b9f1800c4d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b62e33ee107</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Marc Coady]]></dc:creator>
            <pubDate>Thu, 11 Aug 2022 23:45:30 GMT</pubDate>
            <atom:updated>2022-08-11T23:45:30.560Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Deploying a CentOS image to AWS ECS using Terraform</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*vedL-4v9OSZoM4enTCatGA.png" /></figure><h3><strong>The goal of this article</strong></h3><ol><li>Pull a CentOs Image from the Docker Registry</li><li>Create an ECS cluster using Terraform and the CentOs docker image</li><li>Verify that all the resources were created in AWS</li><li>Clean up what was created in AWS using Terraform</li></ol><h3><strong>Where to Start</strong></h3><p>There are several prerequisites for this project. I am not going through step by step install of Docker and Terraform and any other dependencies you might need. For this example, I am using Cloud9 which has many of these features already built in. By using Cloud9 I will be using a linux OS. Just a disclaimer as I have found many of the same commands will not work say in Powershell.</p><h3><strong>So here we go!</strong></h3><p>So, using the IDE or your choice first make a folder that you will be working from.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*NBnsCxoMh_S0qX6OeE9HqQ.png" /></figure><p>I called mine <strong>ecsproject</strong> and then navigated to that directory.</p><p>I then created the <strong>main.t</strong>f that will be used for this project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*EgPNE2u4QxlgmQn41Ob1_Q.png" /></figure><p>As you can see my directory now has two files. The Dockerfile and the main.tf file. <strong>(note: the Dockerfile is from a different project)</strong></p><h3><strong>Terraform time!</strong></h3><p>Next up I will be using Terraform to distribute my image to Elastic Container Services.</p><p>To do this I will edit the <strong>main.tf</strong> file. This file will contain all the configuration needed to build the cluster in ECS in AWS using the CentOs image. <strong><em>(Note this is not best practice but I have not learned about modules as of yet — maybe next week!)</em></strong></p><p>To make it easier for myself I decided to write all of this in vscode and then copy it into my <strong>main.tf</strong> in cloud9. I will break down what I have wrote and what it means.</p><p><strong>The main(tf) Event!</strong></p><p>So, let&#39;s take a look at my <strong>main.tf</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*Q-3EU1L1zZ53FWWc9GRr0w.png" /><figcaption>My providers</figcaption></figure><p>The first section of this file I setup my providers which are: Docker and AWS.</p><p>Next up I create all my networking components: a VPC and two private subnets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*OOAuQP8aiUsleEF2h8Trow.png" /><figcaption>MY VPC and Private Subnets</figcaption></figure><p>Lastly these two sections create the ECS cluster</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*TTChc5ya_6SPnAtqj7uINA.png" /><figcaption>Section 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*7uDHoa4GpnVMncmAIXkoBA.png" /><figcaption>Section 2</figcaption></figure><p>Ok so that is it for the <strong>main.tf</strong></p><p><strong>Let&#39;s put it in action!</strong></p><p>First things first is to build the terraform environment. That is completed by the <strong>terraform init </strong>command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*niDopDnqYSIVRn-blPAdyA.png" /><figcaption>A successful terraform init</figcaption></figure><p>Next up perform a <strong>terraform plan</strong> command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JkI9zQ_X6MduzwiUIGnQSw.png" /><figcaption>First part of a terraform output</figcaption></figure><p>The last part of terraform output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*ABtnQbGvKSLSkPketHp-Lg.png" /><figcaption>It is always good to see this!</figcaption></figure><p>Now for the real test — do a terraform apply</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*B8Hd7g1wL2OiZRR-JC68dw.png" /><figcaption>Type in yes and enter!</figcaption></figure><p>Once you enter yes you should see the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*t77779Oly82GxqJ7t2iAmA.png" /><figcaption>After entering yes, you will start seeing some action!</figcaption></figure><p>If all it works you should see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*MIQAmXDmU1uu_QRkkQY7_A.png" /><figcaption>Confirmation your resources were created</figcaption></figure><p>So, everything ran, and it looks like good ... but lets make sure!</p><h3><strong>Verification in AWS</strong></h3><p><strong>VPC</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M0FSQAY4IP0tpfT5N-PvLg.png" /><figcaption>The VPC that was created</figcaption></figure><p><strong>Private subnets</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eqMz-OcbNnnQeoWxIj2dSA.png" /><figcaption>The private subnets created</figcaption></figure><p><strong>ECS</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sWhVB_P32RhUkvtEGZeyAw.png" /><figcaption>The cluster that was created in ECS</figcaption></figure><p>So, everything has been created. Now let&#39;s destroy it!</p><p><strong>Let&#39;s Clean things up!</strong></p><p>To remove all these wonderful things, we just made we can use the <strong>terraform destroy </strong>command. Once this is entered you will start seeing the following over and over again to all items are removed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ReKXLRPbLB85MubVdlvhgA.png" /></figure><p>Once they are all removed you will see the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*ZsZcUPzhL81kFs3EZYGgXg.png" /><figcaption>Confirmation of destruction</figcaption></figure><p>So that is pretty much it. Below I have some benefits of ECS and my Github repo where my code is.</p><p><strong>Just wanted to list some Benefits of Elastic Container Services</strong></p><ul><li>It can be used to run Docker containers</li><li>It is cost effective</li><li>It can be Serverless (using Fargate)</li><li>Supports autoscaling</li></ul><p><strong>Github repo where my main.tf is</strong></p><p>My <strong>main.tf </strong>is located on my github <a href="https://github.com/marccoady/Terraform/blob/main/week19project/main.tf">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b62e33ee107" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS and Terraform]]></title>
            <link>https://medium.com/@marccoady/aws-and-terraform-d21789d11230?source=rss-6b9f1800c4d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/d21789d11230</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Marc Coady]]></dc:creator>
            <pubDate>Sun, 07 Aug 2022 19:48:17 GMT</pubDate>
            <atom:updated>2022-08-07T19:48:17.264Z</atom:updated>
            <content:encoded><![CDATA[<p>This week was a challenging project. But I learned Alot! I hope you do too!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*EreCYVCmdS7XTt5XCpxbgQ.png" /></figure><p><strong>What is the point of this article?</strong></p><p>To put it bluntly this article shows some really in-depth techniques on how to create resources in AWS. I would say it is simple, but it was not, for someone like me it was a great challenge.</p><p>In this article I use Terraform and their declarative configuration language to do the following:</p><ol><li>Deploy a VPC with CIDR 10.0.0.0/16 with 2 public subnets with CIDR 10.0.1.0/24 and 10.0.2.0/24. Each public subnet will be in a different AZ for high availability.</li><li>Create 2 private subnets with CIDR ‘10.0.3.0/24’ and ‘10.0.4.0/24’ with an RDS MySQL instance (micro) in one of the subnets. Each private subnet should be in a different AZ.</li><li>A load balancer that will direct traffic to the public subnets.</li><li>Deploy 1 EC2 t2.micro instance in each public subnet.</li></ol><p><strong>Diagram of above requirements:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*oK-E7DSp-yYhAGrxFtXK0Q.jpeg" /></figure><p>I will be breaking down the script that I use step by step and then showing the results of the script. I made this monolithic in design. Meaning I made one long script. For Terraform this means using the <strong>main.tf</strong> file.</p><p><strong>The thought process</strong></p><p>When I thought about this project. I reflected upon my over 20 years of IT experience and how I would have built this infrastructure on premise. By doing this it helped me with the design. What seemed to be the most the logical place to start is with all the networking components. However, the first part that you need to define in a <strong>main.tf</strong> is the provider. For this project I am using AWS.</p><p>To set that you use the following statements and select a certain region. I am using <strong>“us-east-1”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*zBbwXXIWUbgoDOKQtOO8BQ.png" /></figure><p>Next, I started to define the networking components. This part shows creating the VPC and the Internet Gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*hRMS3S1XkAgU9wWxIpPZOA.png" /></figure><p>Next up I create the Public subnets like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*badepGCJo5FRowZZtkdIEQ.png" /></figure><p>I then followed with two Private Subnets one in each availability zone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*pwRzePJ8GTuf7yKRTtuHgA.png" /></figure><p>I then created the default and Public Routing tables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*RfLw_Ny-j_PmbVmvEAhTcQ.png" /></figure><p>I then created the Private Routing tables</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lQNTsp4gxSVf6WIkTDYxlg.png" /></figure><p>I then moved to the Security groups. I started with creating the SG for the load balancer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*xw4C03FgYZUXKbKrBkFlkg.png" /></figure><p>Next up was the Web Security group:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*3FFmBxNMprbiaOpAcNPRkA.png" /></figure><p>The last security group I created was for access to the Database:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*FwrJ1Ty-jhPwuAnhKB1UOw.png" /></figure><p>I then put in the settings to setup the Load balancer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pvNhfQP3di3RRdrDPIm8hg.png" /></figure><p>Continuation of load balancer settings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*dtM_v2Ih6uVnvHGg3OJ3dg.png" /></figure><p>The next area of my script is how I setup my EC2 Instances:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AFVAf0O0YlYjVYg783oXPg.png" /></figure><p>Next up was setting up the Database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LLjQNraXVOt5vzyxBSFaMg.png" /></figure><p>Lastly, I put some Outputs in my script so I could test that the Web Servers were up, and the load balancer was working.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*7TYnOgrdN_qGDuC1sEPvCw.png" /></figure><p>I saved all of this in a <strong>main.tf</strong> file. I then rain the <strong>terraform init</strong> command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*_BWkOO9zsm5Du6BHXPKbyw.png" /></figure><p>If Terraform likes what it sees you should see the “Terraform has been successfully initialized!” message. It liked what I created so let&#39;s move on to the next step.</p><p>Next up I ran the <strong>Terraform plan</strong> command. What is great about this command it will check your code before you apply for any syntax errors. I had several misspelling and undeclared resources. I received the following error message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*bJyIq9rFW_ZS1sr8roeNoQ.png" /></figure><p>It will give you what line the error is on so you can focus on those areas. I took me about 20 minutes to fix the issues that it found. Then finally got what I was looking for!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*CuGUXkCUq38sShDg3bQtWw.png" /></figure><p>Next up is the <strong>Terraform apply</strong> command. You should be prompted to enter the word yes like the following screenshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*RtqGkDQIu3MMXN7uCnCuzA.png" /></figure><p>After entering yes, you should start seeing your resources being created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*hMPGjI6iaeBcotmPgip-xg.png" /></figure><p>During this process I received error that stated that the ami image ID I referenced did not exist.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*nZ8Aicjs0HwmZQCGSdD58g.png" /></figure><p>I looked at my main.tf and changed the ami image to the same as server1. I then reran <strong>terraform apply</strong>. What is great about Terraform is it starts up again from where it stopped. It does not have to recreate all the resources. It knows that it has already done that part.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*vKPiVh3mnoTQfPEY6dpS-A.png" /></figure><p>The fact that it showed my outputs. It gave me confidence that it completed the actions correctly.</p><p><strong>Testing</strong></p><p>The things I wanted to test were the web servers that were created and the load balancer. This is why in my <strong>main.tf </strong>I had the output section send those back to the screen. So from the outputs displayed above I tested all three:</p><p>Here is Server 1’s public IP</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*zsTXwmBgZIDSV3YqinXozA.png" /></figure><p>Next up is Server 2’s Public IP</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*9oym-Q7XzHqR3ZTmgGPpTQ.png" /></figure><p>Then lastly, I tested the load balancer URL</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ETitFxPWvE6PMKyXFxqzPw.png" /></figure><p>I refreshed the load balancer a few times and it went back and forth between Server1 and Server2.</p><p>So that all looked good, but I wanted to make sure everything else was created as well. So next I verified some more AWS resources in my AWS console.</p><p><strong>Testing resources in AWS</strong></p><p><strong>The was VPC created</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8kS1m1dmrtgLI6is2efrFw.png" /></figure><p><strong>The Security Groups were created</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RiFbOm0s6DKnfSEZZGgo-A.png" /></figure><p><strong>The Public Subnets were created</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*epdewNgo6YwNVKUJbwcJ0w.png" /></figure><p><strong>The Private Subnets were created</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qXiz8QcRWDjdUuH5kvoFHA.png" /></figure><p><strong>The Internet GW was created</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UKykeNbpHzfjBvXYPQdBGQ.png" /></figure><p><strong>The Load balancer was created</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k3wK7S0k0FiQtMtaXg3cRA.png" /></figure><p><strong>The Route tables that were created</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ruYvIZShs3Z9ycflueZWcQ.png" /></figure><p><strong>And finally, the MY SQL Database was created</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zpAmk37M7V14JFmEbn0b-w.png" /></figure><p><strong><em>Note: I am not checking the EC2 instances as I have already confirmed they are up by checking the public IP address.</em></strong></p><p><strong>Cleaning the environment up</strong></p><p>After all that work, you would think that I would want this running for a long time. However, the beauty of Terraform is not only that you can create things very quickly. But you can remove them just as fast. Also, as this is only a test environment and I do not want to incur costs I wanted to remove everything I created.</p><p>To do that start with the <strong>terraform destroy</strong></p><p>This will run through and give you an overview of what will happen and you will be prompted to enter <strong>yes.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*za--y_z6viRn4WZnlgpEXw.png" /><figcaption>Prompted to input yes</figcaption></figure><p>Once you enter yes Terraform will basically work in reverse removing everything that was created.</p><p>Here is an example of what that looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2FTMjaQ100IO510pWd0Z5Q.png" /></figure><p>This will take a few minutes depending on what you are removing from your cloud provider. But ultimately you should see something like the following message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*qUZkoLonsgLfgrLQmRW0rw.png" /></figure><p>As a quick test I tried to go to one of the web servers from earlier before I get the following response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GmXn6wWwLkCRC0E_9lZmHw.png" /></figure><p><strong>Conclusion</strong></p><p>I learned a few things while doing this project. I think the first one is I need to do a better job with time management. We get these projects on Sunday of each week and we have about a week to finish them. I need to start these up much sooner, especially one of this complexity.</p><p>Secondly, I need to do a better job naming/tagging my resources. I noticed that many the items were not labeled or named how I wanted them to be when I checked my AWS environment. This will be important once I am doing this in a production environment.</p><p>Lastly, I learned the power of Terraform. It is a great tool and I can see why it has been widely adopted in the DevOps community. I am still amazed that just a few months ago I knew very little about AWS and now I am automating creating an entire infrastructure in the cloud!</p><p><strong>Github</strong></p><p>If interested here is the <a href="https://github.com/marccoady/Terraform/tree/main/week18project">Github</a> where the above main.tf is located</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d21789d11230" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Kubernetes]]></title>
            <link>https://medium.com/@marccoady/learning-kubernetes-4ea447898ea0?source=rss-6b9f1800c4d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ea447898ea0</guid>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[command-prompt]]></category>
            <dc:creator><![CDATA[Marc Coady]]></dc:creator>
            <pubDate>Fri, 29 Jul 2022 20:55:29 GMT</pubDate>
            <atom:updated>2022-07-29T20:55:29.988Z</atom:updated>
            <content:encoded><![CDATA[<p>I have heard of it ... now I am learning it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nYGkYbP9eiBeUuXA-4i0yg.png" /><figcaption>Kubernetes Logo</figcaption></figure><h3><strong>What is kubernetes?</strong></h3><p>It is also called k8s as there are 8 letters between the k and the 8. I think I might call myself m2c, as my name has two letters between the m and the c. Ok maybe not … that is a horrible idea.</p><p>So, what is Kubernetes and why would you want to use it? Well …. Kubernetes is an open-source container orchestration system. It is used for automating software deployment, scaling resources and managing all that is mentioned. I know it is a mouthful .. but it is really a remarkable tool that can help any organization automate software and your IT infrastructure. It is basically an advancement from Docker.</p><h3><strong>What is in this article?</strong></h3><p>I am going to showcase some simple commands using K8s. For the environment I will be using Powershell and Docker hub on a Windows 10 operating system.</p><p>The goal of this article is to:</p><ol><li>Create a deployment that runs Nginx</li><li>Show the details of the deployment</li><li>Check the event logs of the deployment</li><li>Lastly delete the deployment</li></ol><p><strong>Let&#39;s get started!</strong></p><h3><strong>Creating a Nginix deployment</strong></h3><p>One prerequisite I should mention is you need to enable Kubernetes in Docker hub. To do so open Docker Hub and select the settings “wheel” at the top of the screen. It should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/81/1*mWjYmg-uwlmsl_Ch6Y4D8g.png" /></figure><p>On the next screen. Choose the Kubernetes screen and check the following two boxes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s4vhCrX-FU8jMl9Sn-gtlA.png" /></figure><p>This might take about 15–20 minutes. But it will install all dependencies needed to run Kubernetes on your Windows machine.</p><p>Ok now onto creating that Nginx deployment!</p><p>First thing you want to do is go to powershell and put in the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*juM6NnjYQC-gqGlO6T5UPA.png" /></figure><p>Lets break this down a bit .. you are engaging Kubernetes by using the <strong>kubectl</strong> command to <strong>create</strong> your deployment. m2c-nginix is what I am naming my deployment. And I am specifying the <strong>nginx</strong> image using the <strong>image</strong> option.</p><p>If this is successful, you should get a <strong>deployment.apps/yourname</strong> created as a response.</p><h3><strong>Some commands to check the details</strong></h3><p>So now that your deployment is up and running how do you check on it. You have a couple of options. The first is the following command <strong>kubectl get deployment</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*sPGoe-9IOlFUcDxGE5X8zA.png" /></figure><p>This command shows you some information, but not very much. It basically shows how many pods you have in your deployments, how many are up to date, how many are available and how long ago it was created. But what if you want to know more? A good command for that is the <strong>get all </strong>option. Here is an example of that command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4czuCU3fzqoBcp2YOaGGRQ.png" /></figure><p>As you can see it shows more details. It gives you everything about your Kubernetes environment plus more details on your deployment. Such as replica set and deployment details.</p><p>To obtain specific details about a certain pod you can use this command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*JH-b_qREO_7ShrE3i3k8JA.png" /></figure><p>Obviously, you have to use your own name after <strong>pod/</strong></p><p>It will show all the details:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YgRtm3sZ5RmZ6nPTUeCr-A.png" /><figcaption>Sample of the describe command</figcaption></figure><p>This is a pretty long output so only captured part of it. But as you can see there is even more details. And this would be pod specific as well.</p><h3><strong>How to check logs</strong></h3><p>So now you have this mystical deployment running and you want to check the logs. You can do this by using the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*iZsWudFBMpgPoKOCiKNILg.png" /></figure><p>The output should look like something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S4uIs4hoxMApnSbM5ZpF0w.png" /></figure><p>It is great to see logs and it is really useful when doing some quick troubleshooting. However, for a production environment you would want to send your logs to an enterprise log management system.</p><h3><strong>Let&#39;s clean this up!</strong></h3><p>As this was a test and I don&#39;t want this deployment running behind the scenes I want to clean this up, so it is not consuming my laptop resources.</p><p>So, to delete a deployment use the following command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*E0BlYgaNi257wGXJbMa8ZA.png" /></figure><p>If it works you should get confirmation. If you want to check to see if it is gone, run the <strong>kubectl get all</strong> command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XMFP9wX_pKhgXewfLVLh1w.png" /></figure><p>Now the only thing I have left running is my lonely old ClusterIP, which is part of the Kubernetes service.</p><p><strong>Conclusion</strong></p><p>This was a pretty quick and small example of some of the basic commands you would use in Kubernetes. There is alot more to explore so hopefully this gives one a good start in the exciting world of container orchestration!</p><p>Also, I might start selling t-shirts M2C! What do you think?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ea447898ea0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker: Your friendly Whale]]></title>
            <link>https://medium.com/@marccoady/docker-your-friendly-whale-15cf70335c99?source=rss-6b9f1800c4d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/15cf70335c99</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Marc Coady]]></dc:creator>
            <pubDate>Sat, 23 Jul 2022 20:40:30 GMT</pubDate>
            <atom:updated>2022-07-23T20:40:30.551Z</atom:updated>
            <content:encoded><![CDATA[<p>Learning the ins and outs of Docker — An example of some common features</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*47YLGrdKSYl7i8GRDiyOVg.jpeg" /></figure><p><strong>What is Docker?</strong></p><p>Docker is a great example of the evolution for virtualization. There are some drawbacks to virtualized environments. For a virtualized image to run you need what is called a hypervisor. An example of a hypervisor applications is VMware.</p><p>With a Hypervisor you need very expensive hardware to run all these operating systems. You need networking, storage and servers to have your Hypervisor application run correctly to manage all those OS images. This requires much capital investment in hardware and hiring expensive technicians to support the environment.</p><p>Docker uses images as well; however, it is a much smaller footprint. It requires less size and is more portable. The requirements are that your machine has the docker application installed and then you can run docker images.</p><p>Docker images can be things such as websites and databases. And the best part is they can be easily transferrable to another machine that is running Docker. These moves can be fairly straightforward without complex networking or storage.</p><p><strong>What this article will review?</strong></p><p>In this article my goal is to do a few simple tasks using Docker. I am planning on showcasing the following:</p><ol><li>Pulling a nginx image from the Docker repository</li><li>Creating my own image from the downloaded image</li><li>Saving the image to AWS’s ECR (Elastic Container Registry)</li></ol><p><strong>My environment</strong></p><p>Just a note on how I am setup. I did install docker hub and was using Powershell to learn docker on my personal Windows machine. However, I was having challenges with some of the commands as many windows commands and linux commands are different. Since in this article I end up saving my image to ECR in AWS, I decided to do everything in AWS’s Cloud9 to assist in this process.</p><ol><li><strong>Lets get that image</strong></li></ol><p>From your IDE (I am using Cloud9) Pull your Nginx image. The following screenshot shows the command to use to download your image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*oN1KXlVjbSWXtXX9H75P7g.png" /></figure><p>To see what images, you have in your environment you can use the <strong>docker images</strong> command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*iWwipcX4o1enBRSYp7Ye0g.png" /></figure><p><strong>2. Second let&#39;s organize the files and directory for your image and web server</strong></p><p>For this example, I created a directory called mynginx, this is where I will place my <strong>Dockerfile</strong> and <strong>index.html</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*3dwcAopaeLU2hnBfzaHP8Q.png" /></figure><p>Lets build that Dockerfile. You can do that by using the vi command the file name. (Dockerfile)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*9voUp_8qq5SlzYTzi_5Mcg.png" /></figure><p>For this example you only need the FROM and the COPY. FROM basically is stating what image to use. COPY will use the index.html and path specified.</p><p>Next let&#39;s build that index.html. For this example, I create an index.html that will display the date and time to the browser:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*qFF4I6lH6gmvJHV5Y4epqQ.png" /></figure><p>If you do a <strong>ls -l</strong> command on your directory, you should see the following two files in your directory:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*5M8KR1hcYA15X_Ja43bQwg.png" /></figure><p><strong>3. Lets build that Docker image</strong></p><p>To build an image you have to use the docker build command. Here is a screenshot of the correct command to use:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*kGWkKE1J45DgAFA1bghsNg.png" /><figcaption>The Period means the current directory</figcaption></figure><p>If it runs correctly, you should get the following response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*LQnK1tiEsy5fnTLFtZB5QQ.png" /></figure><p>If you run the docker images command, you should see the newly created image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*27YthAq6fKjvUzoY95vHIQ.png" /></figure><p><strong>4. Running the image</strong></p><p>Now let&#39;s attempt to run the image. To do this you need to use the docker run command and since this is a webserver specify the port mapping.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*eyKOFDm49vfAfeLNpHgJUg.png" /><figcaption>docker run command with port mappings</figcaption></figure><p>If run correctly you should get a real long ugly Id. This means your image is running. You can verify that is running by typing docker ps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ttBW5nM9Pm3UjdRDTyXBQ.png" /></figure><p>Next test it from a browser. For my configuration I had to use my Cloud9 Public IP. I also had to open up port 8080 in my security group. If you do that correctly you should see the index.html that you created from a browser. <strong>(I recommend changing the security group back to your default if you are using Cloud9)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*az1NQSS2tln2f1zpHILH-A.jpeg" /></figure><p><strong>5. Copying your data up to AWS ECR</strong></p><p>From the command line use the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uhiZeC_0n-nxxYWWqCehGg.jpeg" /></figure><p>If you get a similar response, it should be created. However, you can check in your AWS console under ECR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rcnZ0uWTw2XmtLlVlqUI2w.jpeg" /></figure><p>Before you push your images up you need to get a login token. To do this complete the following command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*1c_n_1LWNvM8EZICCH0ewQ.png" /></figure><p>The next thing to do is use a command that will use your token and reference the URI of your repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*oMtSo69aCDIzY2W5G8D3_Q.png" /></figure><p>You should receive a warning about best practices. But ultimately the response should be your login succeeded. (<strong><em>One tip for this to take out the brackets.)</em></strong></p><p>Next you need to tag the image. You can by using the following command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*rsp2PVjV1rZLsBaGWIV_gQ.png" /></figure><p>You should not get any type of response. The final command is to push it up to your ECR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*VebdFYA6Wob21ymn74nhRQ.png" /></figure><p>If it all worked, you should see the status of your push in the command line.</p><p>To verify go into your ECR and take a look to verify it was copied!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v5mje8wRiKLuiFIk_nxNXg.png" /></figure><p>So that is it for this article. It was a fun week learning Docker!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15cf70335c99" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Lambda — Python, SQS and API Gateway]]></title>
            <link>https://medium.com/@marccoady/aws-lambda-python-sqs-and-api-gateway-ea910dc03658?source=rss-6b9f1800c4d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea910dc03658</guid>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Marc Coady]]></dc:creator>
            <pubDate>Sat, 16 Jul 2022 18:39:13 GMT</pubDate>
            <atom:updated>2022-07-16T18:39:13.862Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS Lambda — Python, SQS and API Gateway</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*xhtRssAOElWdIKqB90XzFg.png" /></figure><h3><strong>What is this article about?</strong></h3><p>This article is another example of Python and what its relationships is to AWS services. Knowing Python is really an integral piece for anyone that wants to automate and utilize serverless architecture in the cloud. I don&#39;t think I am saying anything groundbreaking in stating how important it is to learn scripting if you are a technology professional. It can give you the opportunity to automate mundane tasks and save your company money. So, like I stated previously just another small example of the power of scripting!</p><p>This article will explore the following:</p><ul><li>Creating an SQS queue in AWS using Python</li><li>Creating a Lambda function that will use Python to send messages to the SQS queue</li><li>Create an API gateway that has an HTTP API type trigger</li><li>Test the trigger to verify the message was sent</li></ul><p><strong>A Disclaimer</strong></p><p>Before I get started, I have gotten to the point of my articles where I am not going to go in to deep on what you need in regard to setting up your permissions and connecting tools to AWS etc. I assume you know these things as a technology professional. If you do not there are plenty of resources available on medium and YouTube that can help you with those pieces.</p><p>That being said …... let gets started!</p><h3><strong>1. Creating an SQS queue using Python.</strong></h3><p>Below is the screenshot showing the simple Python script that I used to create the SQS Queue. Some important pieces of this are importing boto3 (The SDK), using the resource (sqs), using the <strong>create_queue</strong> command and making sure you name your queue besides <strong>QueueName </strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*6N1kUTUs7ceXYVgktoBRKg.png" /><figcaption>Python Code used to create the queue</figcaption></figure><p>To verify that it is was created, you can login it to your AWS instance, go to SQS. You should see the queue you created. It should match the name you provided in the script and the URL should match what was printed to your screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7rdZTAIdpTJv7j71feH5yg.jpeg" /><figcaption>The SQS Queue in my AWS console</figcaption></figure><h3>2. <strong>Creating the Lambda function</strong></h3><p>In your AWS console go to the Lambda section. From there you want to choose create function. Some of the key parts of this is you must give it a name and choose Python 3.7. Then select the <strong>Create function </strong>button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UNRDpyRIJdB5poaNhvjBHg.png" /></figure><p>Once created you should be presented with the following screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9_r0fPRM5biEmS8MaXNxSA.png" /><figcaption>Your Lambda function screen</figcaption></figure><p>There are a couple of key points to the above screen:</p><ol><li>The <strong>lambda_function.py</strong> — this is where we will enter your Python code to send the message to the SQS queue.</li><li>The other is you need to ensure the Lambda function has the correct <strong>IAM</strong> role to give access to SQS to allow Lambda to send a message to the queue.</li></ol><p>Here is a screenshot of the Python that I will be using that will send a message to my newly created queue. This needs to be pasted into the lambda_function.py section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DpAZJ2kB6VLzonc_SQfaHw.png" /></figure><p>Here is a screenshot of the code in the Lambda function</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-qW2Rv0f8qOlG7XaK0kGKw.png" /></figure><p>I tried testing it and received an error. I realized I needed to change the Iam role to give the function the right permission. If you go to <strong>Configuration&gt;Permissions</strong> you can find the role that was automatically created for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zC-BN1eIAsMEOxvAJoQgtA.png" /></figure><p>If you click on the role name you can then add the correct permissions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nM6RGYNSFWw8WeKRnzHK0Q.png" /></figure><p>For this example, I chose the <strong>AmazonSQSFullAccess </strong>role. I would recommend being more granular with roles/permissions in a production environment.</p><p>To test this, you can create a test event and use the <strong>API Gateway AWS Proxy</strong></p><p>If it works you should receive the following when you run the test:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*fm-Os-aoEpg29HEepTtkXw.png" /><figcaption>Results of testing the lambda function</figcaption></figure><p>Next up adding the trigger!</p><h3><strong>3. Adding an API gateway that has an HTTP API type trigger</strong></h3><p>To the left of the Lambda function choose add trigger button:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/1*0hhiZ8PAu6Lw9B1883TEMw.png" /></figure><p>Configure the API Gateway like the following and choose the <strong>Add </strong>button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*kipsm9PwWYWytTS8SXgUTQ.png" /></figure><p>When completed your screen should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l6WJJ3l6MrF-sxoQB8bEQA.png" /></figure><p>If you click on the API endpoint you should receive the following output from a browser:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b6jf6s0XEKr2Yv1s4opGuA.png" /></figure><p>It should show you the same output from before, when we tested the function.</p><h3>4. <strong>The final step is to verify our SQS queue</strong></h3><p>If you go to your SQS queue you should see that there are messages available:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*81QpxLPALtSg8afF36119w.png" /></figure><p>Choose your queue and select the <strong>send and receive messages </strong>button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*55Q6EupSKt6e8vg1FxC01g.png" /></figure><p>Then choose the <strong>Poll for messages </strong>button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2MLKWvGROcKgt-rS8FzFhg.png" /></figure><p>You should see your messages:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*we3Hw9AM0gnBGxST_YoUzg.png" /><figcaption>Messages received after polling</figcaption></figure><p>The body of these messages should be created from the random number you generated using the Lambda function.</p><h3><strong>In conclusion and links</strong></h3><p>Well another project completed. It was great to complete this as many of these services I was aware of but, never fully vetted and tested. For my the Python scripts I used, here is my link to Github <a href="https://github.com/marccoady/FinishedProjects">branch</a> that has them.</p><h4><strong>Keep on Scripting in the Cloud!</strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea910dc03658" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Python and Boto3 to interact with DynamoDB]]></title>
            <link>https://medium.com/@marccoady/using-python-and-boto3-to-interact-with-dynamodb-3c82b15ac6ab?source=rss-6b9f1800c4d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c82b15ac6ab</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[aws-dynamodb]]></category>
            <dc:creator><![CDATA[Marc Coady]]></dc:creator>
            <pubDate>Sat, 09 Jul 2022 18:19:22 GMT</pubDate>
            <atom:updated>2022-07-09T18:22:53.898Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*6ngO-DSanXgu30bvID12FA.jpeg" /></figure><p><strong>What is Python</strong></p><p>Python is an advanced scripting language that can be used to automate tasks in cloud environments. It is particularly useful in managing an AWS infrastructure.</p><p><strong>What is Boto3</strong></p><p>Boto3 is the SDK that is used in Python that gives you the ability to manage and interact with AWS resources. This powerful tool can help you with your automation tasks in AWS.</p><p><strong>What is DynamoDB</strong></p><p>DynamoDB is a fully managed proprietary NoSQL database that supports key–value and document data structures and is part of the AWS offerings.</p><p><strong>Scope of this article</strong></p><p>I wanted to create a quick article that highlights the Technlogies mentioned in the title. I will create a python script that will create a DyanamoDB table, show how to add items to the table and finally scan the table for information.</p><p><strong>Prerequisites (This is high level and will not be addressing prereqs in this article. The assumption is you are familiar with many of these tools already)</strong></p><ol><li>An IDE — or some tool you will use to have python and boto3 interact with AWS</li><li>Installed awscli</li><li>Installed boto3</li><li>IAM user credentials with programmatic access and admin access</li><li>AWS configure (using the IAM keys created in step 4)</li></ol><h3><strong>Creating the Dyanamodb table</strong></h3><p><strong>Let&#39;s get started!</strong></p><p>From your preferred IDE (I am using cloud 9) or coding tool start by importing boto3 and using the following code to name the table, setup our Dynamodb. For my example I am creating a table named ‘pizza’, I will use this table to list my top ten pizza places in Seattle WA.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*c_BfWUhf2q9bj3EWcWqZBA.png" /></figure><p>If this runs successfully you will have a <strong>CREATING</strong> response next to <strong>Table status</strong>. You should also see the table in AWS like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Skw43bMBFF9c3wLQx_zELg.png" /></figure><h3>Adding items to the Dyanamodb table</h3><p>Next, I am going to create a python script to add items to the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JSaotT-flDL87wm3GKHkZw.png" /></figure><p>If you are successful, you should see your items created in your table in AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*2i09N7ekxMz0Fi3YDrR1Kg.png" /></figure><h3>Scanning the Dyanamodb table</h3><p>Lastly, I created a simple script that will scan the table using Python and return the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t3k6bxwPqEmsan4S0URX3Q.png" /></figure><p>So that is it for this article. Check Github below for the scripts I used. They are very simple but hopefully someone out there can use this to get started and learn more about Python and AWS!</p><p><strong>My Github</strong></p><p>Here is a <a href="https://github.com/marccoady/Dyanamodb">link</a> to the repo on my github that has the code used in this article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c82b15ac6ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Playing with CloudFront]]></title>
            <link>https://medium.com/@marccoady/aws-playing-with-cloudfront-51efc24adbcd?source=rss-6b9f1800c4d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/51efc24adbcd</guid>
            <category><![CDATA[cloudfront]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[s3-bucket]]></category>
            <dc:creator><![CDATA[Marc Coady]]></dc:creator>
            <pubDate>Sat, 18 Jun 2022 19:35:19 GMT</pubDate>
            <atom:updated>2022-06-18T19:35:19.827Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*R9sEAGT8TC-Mvb7aXqF0Yw.png" /></figure><h3><strong>What is CloudFront</strong></h3><p>Amazon CloudFront is a web service that improves the speed of the web content in your AWS environment. It can help with files that are hosted on the web such as: .html, .css, .js, and image files. The content is distributed through Amazon’s network of data centers called edge locations. Essentially when a user requests content, CloudFront will work to distribute that content from the closest location to that user for lower latency and provide a better experience.</p><h3><strong>Scope of this article</strong></h3><p>For this project we are going to create a bucket to display an image. We will then configure CloudFront to distribute the content hosted on the website.</p><h3><strong>Lets setup a simple website</strong></h3><p>The best way to do this is to create an S3 bucket.</p><ul><li>Log in to your <strong>AWS account</strong></li><li>Go to <strong>S3</strong></li><li>Choose <strong>Create bucket</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HCgX7o06hXMFHmOe9caYg.png" /></figure><ul><li>Name your bucket</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rntnhzXg6EIOZzJbWigawA.png" /></figure><ul><li>Choose <strong>ACLs disabled</strong> option</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sH6LrM1ICeNO_kHnDU4LVQ.png" /></figure><ul><li>Make sure to <strong>Block all public access</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*lNMmnnQZpHAHzxXJi0E1dg.png" /></figure><ul><li>Keep everything the same and choose <strong>Create bucket</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XmFtl1Pgg56ddq6vTbecUQ.png" /></figure><ul><li>You should now see your bucket created. Click into the bucket by choosing the name. Find an image you would like to be served by your website and upload it to your bucket.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OqpySUFebITZ96E07Uhh4Q.png" /></figure><p>Now that we have the image we want to distribute. Lets get CloudFront ready.</p><h3><strong>Here comes cloudfront!</strong></h3><ul><li>Go to CloudFront in the AWS console.</li><li>Next select <strong>Create distribution</strong></li><li>Setup your distribution with your own settings, here are mine as an example</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*R-3rJi9hrXdbYh7QOqnRIw.png" /></figure><ul><li>leave everything default, but ensure you choose <strong>redirect HTTP to HTTPS</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*L8BvcTzULQGPDT0-br1r8w.png" /></figure><ul><li>It will take a few minutes to deploy</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mV4zgQWvYgURoEQFg1jd5A.png" /></figure><ul><li>In the meantime verify that you <strong>cant access </strong>your object using the S3 Url</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*ChJ4S7ITX9Ce9mNlNDrIAw.png" /></figure><ul><li>You can also see if the bucket policy has been updated by CloudFront</li><li>It should look like the following:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ha1kwsZmXCORnBopKC-1-Q.png" /><figcaption><strong>Note that it states it was created by PolicyForCloudfrontPrivateContent</strong></figcaption></figure><ul><li>Lastly just test that you can access the image through CloudFront. To do this find the Distribution domain name and reference the file name. For example (<strong>yourname.cloudfront.net/image.jpg</strong>)</li><li>You can get the Distribution domain name under the details of your CloudFront distribution</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ufpv84I4PljPdbifPKLR7g.png" /></figure><ul><li>Like Magic one of the greatest video games ever created!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pytob_AuWJlRCEeeBXwj9g.png" /></figure><ul><li>This is using CloudFront to distribute this image! That was a fun little project to show the power of AWS, S3 buckets and CloudFront!</li></ul><p>I hope you enjoyed this quick read.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51efc24adbcd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>