A Plumber's Guide to Cloud
Tags: computerscience, aws, codenewbie, serverless
Published: 2020-07-27 16:16:51

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/eoav7icxk6j3ol2w1sck.png)
Hey everyone! My name is Daniel Singletary from the Metro Atlanta area and I am an Industrial and Residential Plumber. I am currently working towards transitioning into the IT industry out of the trades. Two totally different worlds with not much carryover, am I right? Wrong. Let me illustrate this with a recent example. 

I was called out to a shopping center with some colleagues to take a look at an odor issue every business in the complex was having. Upon arrival, we smelled nothing and so we began the search only to turn up empty-handed after talking with several of the store managers. We left the property for the day, leaving behind our contact information with the instructions to the managers and employees to call us as soon as the odor resurfaces. A few days go by, we get a call on Monday around early lunchtime from one of the employees in a salon at the complex saying the smell is horrendous. Another plumber and I drive over and sure enough, the bathrooms in this salon are awful, oddly enough we can feel air movement coming from the base of the toilets. We remove the toilets from the floor and to our amazement find a current of air blowing out of the sewer system, imagine a leaf blower blowing sewer gas in your face. 

Now for everyone not familiar with plumbing systems, this should not be happening much less, possible. Needless to say the other plumber and I look at each other and realize that neither one of us has a SINGLE iota of an idea on how this is happening. Over the next three days, we start from opposite ends of the complex and narrow down the possible problem areas to two businesses, a restaurant, and the salon. 

At this point, we have removed and re-sealed countless fixtures and finally decide we are going to "smoke-test" the two businesses by blowing smoke bombs down two plumbing vents on the roof. Our theory is that wherever sewer odor can get in so can smoke, EXCEPT we can see smoke with a flashlight. We get to work and 6 hours later we have our culprit. Somebody tied a vent hood for a commercial stove, into the plumbing system literally forcing all the air (much like a leaf blower) into the sewer. Needless to say, the issue was resolved and life moved on but how does this tie in with tech? Read on and you will see where my epiphany happened during this project.
 
I was sent a link to a project created by a gentleman named Forrest Brazeal after work one day challenging me to something he dubbed "The Cloud Resume Project".

After reading through the instructions set forth by Forrest, I was excited to try as I had never touched any cloud-related services in any practical application before that day. I was familiar with Amazon Web Services as I had been recommended to look into by a friend of mine and subsequently earned my CCP (Certified Cloud Practioner) certification a few weeks before taking on this challenge.

<h3>The Objectives:</h3>
 1. AWS Cloud Practioner certification was a prerequisite to the challenge.
 2. Resume needed to written in HTML, styled with CSS, and hosted on an S3 bucket.
 3. The website had to have a custom domain name via Route53 and secured with HTTPS using Cloudfront.
 4. On the website there needed to be a visitor counter written in Javascript that was backed by a database holding the count.
 5. This database would need information, so a backend Lambda function written in Python would need to be provisioned.
 6. An API was required to middle man the interactions of the micro-services.
 7. Tests needed to be written for the Lambda function to ensure a failsafe for possible breaks caused by future changes.
 8. The backend portion of the project had to be built and deployed from a SAM template utilizing AWS SAM CLI.
 9. CI/CD needed to set up through Github for any future changes.

Finally, a blog post describing our journey throughout this project and in my case, the final reflection on a project I had originally deemed "Seems pretty simple".

<h3>My Tribulation...I mean Journey!</h3>

Before we dive in I want to start with my experience in this project is a little unique, I had never written a line of Python prior to this project nor had I used any of the AWS services in a real-world application. This project was an uphill battle from the very beginning however one thing I never expected was for my experience in Plumbing to carry over to Cloud.

**Onto the good stuff,** 
Right out of the gate I had to actually write a resume for this project, which I did in HTML from the beginning so I could kill two birds with one stone. Afterward, I threw everything into an S3 bucket set up for static website hosting. So far so good, I was feeling confident with the pace I was moving at this point. I then moved onto Route 53 and Cloudfront, my first real slowdown. After learning all about certificates and troubleshooting my record tables for a few hours, my site was up!

At this point, I was feeling great about the project so far, and unbeknownst to me began to fall in love with the Cloud. The practicality and potential implementations made my head spin! Unfortunately, duty called and COVID-19 had me tied up for quite a few weeks working in hospitals and clinics but this would not deter me from Forrest's challenge.

Once I got settled back in, I began work immediately on DynamoDB and my Lambda functions. This part of the challenge took me quite a while, as I had no idea how to write code for services I had never used. After a few days, I had a working function, a working test, and a beautiful table (at least to me), and began to look into SAM. SAM was a huge learning curve for a few reasons in my case. Firstly, up to this point, I had provisioned everything through the console as I wanted to familiarize myself with how things worked. I assumed this would make things easier to understand when I reached the Infrastructure as Code aspect of the challenge. (I personally still feel this was a good choice for me and would recommend it to any beginner.) Lastly, SAM introduced CORs errors to me which nearly caused me to pull my hair out and this was where Plumbing met Cloud for me.
After days of struggling, I was getting nowhere with CORS and even when I did make a breakthrough I just broke something else. 

**<h3>So I bought a whiteboard.</h3>**
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/eult4sdyv2fsn201ls6t.jpg)

I mapped out the project like I would on an engineered print for a plumbing system and began ruling out what could be the issue. To be honest with you all, in the world of plumbing you are bound to run into many problems that you don't understand, don't make sense, or shouldn't be possible. Whenever this happens, we break the whole system down into pieces until we can narrow our search down to a few areas. Afterward, we begin troubleshooting for as long as necessary for a diagnosis. 

**This is when it hit me**, our worlds are not too far apart.
Python tests, segmenting code into blocks for easier troubleshooting, and the roadmap for how all these services can tie together are the very same principles for how we troubleshoot a plumbing system. Let's reference my experience from the beginning of this post, the shopping center. 

For starters, problems are not always going to present themselves in an easy to understand way. Similar to CORs errors and us finding sewer gas blowing back on us, it didn't make sense. So we narrowed down our search by starting on two sides, much like how you write your code with space between modules and comments so you can step through it for troubleshooting instead of tearing through the whole script. Then we used smoke bombs to make the problem reveal itself, even if a little unorthodox. Similar to how tests for code can show you exactly where your problem lies BUT only if you design them too and sometimes you have to think outside the box for a solution or test. Finally, we had to implement a solution for the problem which in our case had to be done at night to prevent downtime for the businesses. Cloud is not any different, even if you find the problem you can't bring everything down whenever you want to fix it, your client or customer base comes first. This is the whole point behind local testing and testing environments, to mitigate the number of problems that surface in the real infrastructure to prevent downtime. 

With all of this in mind, I got back to work on figuring out CORs and some other issues.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/exvgrte1l0b2yhgczddc.png)
After bringing my laptop to work a few days, I got my stack deployed and working successfully. I knew at this point that I was home free, I set up my CI/CD with Github, put on the finishing, and reached out to Forrest to turn it all in.

There were several points in this project that made me internally scream but with the skills I brought away from this project like CloudFormation, Cloudfront, S3, Route53, DynamoDB, Python, JS, Serverless architecture, along with a plethora of other services and industry standards made it all worth it. This project reinforced my belief that my transition into tech is the correct one. Even more importantly it gave me a path to look into, and that is the beautiful world of Cloud. 

**Please check out my site/resume at: https://www.dsresume.com/**

Thank you Forrest Brazeal for creating this challenge, and thank you for creating the opportunity to meet the other takers of this challenge and network with like-minded individuals.