Head in the Cloud - taking on the Cloud Resume Challenge
Tags: aws, python, devops, cloud
Published: 2020-07-24 21:27:21

Not so long ago, I decided to switch careers from Educational Rehabilitation to Software Development. I taught myself Python, I did some projects and finished online courses, but I had yet to get my official first job in the field. When I encountered Forrest Brazeal's [Cloud Resume Challenge](https://cloudresumechallenge.dev/), I thought this was exactly the opportunity I needed. It allowed me to interact with cloud technologies (AWS) and build a carefully crafted project that covers a lot of the real life solutions a developer in this line of work would have to deal with. 

Since there was originally no deadline on the challenge, I decided to finish another project first, and then start studying for the AWS Certification (step 1 of the challenge). I was not yet done studying for the certification, when around the 10th of July I noticed the page had been updated with a deadline of 31st of July. A deadline of about 2-3 weeks to submit! Naturally, my reaction was something like this: 

![Panic Gif](https://dev-to-uploads.s3.amazonaws.com/i/kwc2euxuxs2g49jy80yo.gif)

To think I would be able to finish in time was crazy to me. But I did not give up. I devised an ingenious battle plan. Step 1 (and all steps after) was to get endless supplies of fuel. The following is a real photo from my kitchen:

![Coffee](https://dev-to-uploads.s3.amazonaws.com/i/ls76cwq0pk6wfm1slvrp.PNG)

---

# The Challenge

I decided to stop the studying and start with the technical part of the challenge immediately.

## HTML + CSS and some AWS Console

The first thing I did was to create the HTML and CSS skeleton for my resume. This was simple enough, although not really my cup of tea (I prefer coffee and the backend). I also decided I would leave Javascript for later, and just manually create the static website on AWS first (using S3) and put it behind Cloudfront (for HTTPS).

Other than hitting a bit of a snag with the Certificate needing to be created in a specific AWS region, this part was not too complicated and was finished within a day.

**What I learned:**
- Some more CSS
- Hands-on interaction with Cloudfront and S3 static websites
- How to use HTTPS with Cloudfront and create certificates

## A Python Lambda, some Dynamo and lots of Testing

The next thing I wanted to do was to create the backend (I would worry about connecting this to the frontend later). I first created just a basic Python Lambda using the AWS Console, and connected the Lambda with API Gateway. Once I was able to trigger it, I connected it with DynamoDB to update the counter.

At this point I was ready to add some tests. This part was really interesting to me, and I have to say that it was challenging. I did not have much experience writing tests, but after some (read: a lot of) research I came across both *pytest-mock* and *moto* libraries.

This part took me several days, but I got there in the end, and it was very rewarding!

**What I learned:**
- Using Lambda in-depth
- About API Gateway
- Using boto3 to interact with DynamoDB
- About DynamoDB incremental updates
- Testing is hard

## Infrastructure as Code

Now it was time to take what I did in the console and turn it to code. I used the AWS Serverless Application Model (SAM), and I must say while this whole part was a learning experience for me, SAM made it much easier. I didn't run into a lot of issues here, and within a day I was very happy to see my backend stack created with automation.

**What I learned:**
- About SAM and Cloudformation
- How great SAM is for creating a Serverless backend
- About Implicit vs Explicit API Gateway in SAM template

## CI/CD

This part was also new to me. I had to do some reading on Github Actions to understand more about them, and some research on finding some existing ones that fit what I needed to do.

After some time, I managed to get a Github Action for Testing any commit, and another Github Action for deploying my backend for me when master was updated. I also added a Github Action to my frontend code to update the S3 bucket and invalidate the cache when pushing to master.

The saving grace was that I had been doing Source Control with Github from the beginning, so all I had to do is automate this with Github Actions.

**What I learned:**
- How important CI/CD is in development
- About Github Actions
- How many dummy commits you have to make when trying to find a bug with CI

## Connecting it all - Javascript and the evil CORS

The final step was to connect it all. I had a backend and a frontend, but the two were not talking to each other yet. I needed to write Javascript for that. I'll admit, this should've been easier than it was, but I hadn't really done any Javascript before, and I didn't have time to learn the syntax in detail. I managed to find some resources online to help me with the specific thing I needed to do to call my backend. After lots of tinkering from not knowing the syntax (damn promises!), I got there in the end.

Or so I thought. Then I ran into CORS issues, and had to learn more about that too. OfCORS. A series of silly commits ensued as I tried to solve this issue by adding CORS at the SAM level, but eventually I realised I could just do it directly in the Lambda. 

**What I learned:**
- About CORS and what it's for
- How to setup CORS with Lambda and API Gateway
- More about how backend and frontend communicate
- A sprinkle of Javascript

## AWS Cloud Practicioner Exam

I took the exam today, and I am thrilled to say I passed! It was a very stressful day, especially since I forgot to turn off an alarm on my phone, which rang throughout the final 20 minutes of the exam (I couldn't get up to turn it off). But it was so worth it!

# The Future Is Bright?

And with this blog post, I finish the challenge, and officially enter the Champions club! I am thrilled! I want to thank [@ForrestBrazeal](https://dev.to/forrestbrazeal) for the opportunity and the amazing challenge which has given me the chance to learn so much.

I also want to thank my family, who have been telling me all my life I always have my head in the clouds - I guess they are finally officially right!

The final product: https://ines-fazlic.com/