I recently started to brush up on my skills in order to further my career. My desired field...DevOps. I have some basic coding experience, more on Ops side than the Dev. But I enjoy both. While perusing through a slack group I am a part of, I stumbled upon a few members discussing the "Cloud Resume Challenge" and I noticed how other members (some a lot further along in their career than me) were chiming in and saying how its a great way to learn and gives you something to show at the end of it. If you are interested in doing this challenge for yourself, here is the link:
https://cloudresumechallenge.dev/docs/the-challenge/aws/
But lengthy introduction aside, let me go over how my challenge went.
Lets start off with this. I did not do Step 1 of the challenge. I did start studying for a certification, however life happened and I had to shift gears. I decided that I didn't need a Cert to take on this challenge and I encourage you to do the same if that is the only thing stopping you.
I wont elaborate on the steps in depth. But I jumped into AWS and created a static website via the AWS console. I utilized S3, CloudFront, DynamoDB, Route 53, Api Gateway and AWS Lambda to accomplish this. This is where I ran into my first hurdle, working with Lambda.
Python is the language I am most comfortable with. I wasn't worried about writing the code, it was more figuring out how to integrate all the pieces, what library I needed, and the syntax for said libraries. The AWS documentation is VAST and its very easy to get lost. But with enough googling I found the pages I was looking for and cleared this obstacle.
The next step was to use JavaScript to call the API, which would invoke the lambda function. And depending on which route was called, would either update the counter in DynamoDB and retrieve the updated value, OR just return the current value.
My victory was short lived because I had no idea how difficult this next part would be for me. IaC otherwise known as Infrastructure as Code. Specifically with AWS SAM.
Now the challenge does state that you can use Terraform instead of SAM, however I figured I would try my hand at SAM as its similar to using CloudFormation. And I wanted to learn that anyway.
Before I started on the SAM template. I needed to create some repos for my frontend code and backend code. Since my wife expects me to able to read her mind, I will pretend that you wanted to see a picture of the Repos.
I saw that I needed to configure CI/CD later on in the challenge. So in classic procrastinator fashion I worked on that first.
I had to do two things for my Frontend. I needed to update my S3 bucket whenever I made changes to my frontend code, AND I need to invalidate the Cloudfront cache so that it would pull the updated files. Otherwise my website would still being using outdated code, etc. This was not super difficult. Just a lot of trial and error and getting used to the proper syntax. YAML is not forgiving.
Once I got the frontend CI/CD going, I had to finally tackle the Derrick Henry of steps for me in this challenge, AWS SAM.
I would say the hardest part of getting this to work. Was the the experience of finding a needle in a stack of needles when it came to documentation. I would click on a link only to be directed to click on another link, and then another link. This happened for every iteration of this part of the challenge.
I first successfully created all the resources. The API gateway, Lambda Function, and DymnamoDB table. But when I tried to access the website nothing worked. I then messed with permissions within the SAM template and got those to work. Only to be slapped in the face with CORS errors.
After I figured out how to configure CORS settings in the SAM template, I spent 2 full days pulling my hair out wondering why after doing what the error told me to do, it wasn't working.
Spoiler Alert: I forgot to add the right path to the API URL.
Once my minor error turned nightmare was over. I moved on get the Lambda function to properly invoke. (another simple thing that took me ages to figure out). After a long fight, things started to ease up. I successfully was able to create all my resources with proper permissions, and my website was doing what it supposed too.
My Backend CI/CD does two things. If I make any changes to the python code, or SAM template it will update my CloudFormation Stack and resources to reflect the changes. I also needed to have a python test as part of the steps. I added a easy status code checker and called it a day(don't judge me I wanted this project over with).
If I had an Enterprise plan on my Github account, I could gate pull requests from merging if the Status code test failed. But I am more like a champagne taste with a beer budget type of guy, so It just yells at me that it failed but won't enforce the rule.
Now that my CI/CD is complete. The moment you have all been waiting for. What the website does when its complete.
Before:
After:
Yup the website counter updates if a new visitor goes to the website.
Overall I am happy with the things I learned. And it goes to show that if you google hard enough, you will eventually stumble onto the right AWS documentation. Thank you for reading this.
Top comments (0)