Cloud Resume Challenge – AWS
Published: 2022-08-07 00:19:34

I obtained my AWS Cloud Practitioner certification a few months ago and recently discovered the [Cloud Resume Challenge](https://cloudresumechallenge.dev/docs/the-challenge/aws/) on Reddit. This seemed like a great opportunity to familiarize myself with Infrastructure as Code (IaC), Lambda, Unit Testing, and CI/CD Pipelines, all of which were new but interesting to me. 

While completing this challenge, I encountered obstacles that required some troubleshooting and a bit of trial and error, but getting everything working was so satisfying. I completed the steps of the challenge out of order, using Github for Source Control early in the project to manage and track my files as I made changes. 

After I completed my Resume and had the static website available via HTTPS, I moved onto Infrastructure as Code, using AWS SAM, instead of making the Database, API Gateway, and Python Lambda function by themselves through the AWS Console.

![AWS Cloud Resume Challenge Diagram](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o3sn3ey6br7c7lhz3l9q.png)
 
#Challenge Steps/Instructions:
* Certification – [Credly Badge](https://www.credly.com/badges/d52018a0-b00c-41d3-b0af-657a1ede025b/public_url)
* HTML – [HTML File](https://github.com/mattspath/cloud-resume-challenge/blob/main/website/index.html)
* CSS – [CSS File](https://github.com/mattspath/cloud-resume-challenge/blob/main/website/stylesheet.css)
* Static Website  - S3 and Amazon Cloudfront handle this.
* HTTPS – Amazon Cloudfront and Amazon Certificate Manager handle this
* DNS – Route 53 manages mattspath.com, and points to my [resume page](https://resume.mattspath.com/).
* Javascript – [JS File](https://github.com/mattspath/cloud-resume-challenge/blob/main/website/scripts/main.js)
* Database – Dynamo DB deployed with SAM template
* API – API Gateway deployed with SAM template
* Python – Lambda [Python Function](https://github.com/mattspath/cloud-resume-challenge/blob/main/src/index.py) deployed with SAM template
* Tests – [Unit Test File](https://github.com/mattspath/cloud-resume-challenge/blob/main/src/test.py)
* Infrastructure as Code – [AWS SAM Template File](https://github.com/mattspath/cloud-resume-challenge/blob/main/template.yaml)
* CI/CD Back End – [Github Actions Backend Workflow File](https://github.com/mattspath/cloud-resume-challenge/blob/main/.github/workflows/backend.yml)
* CI/CD Front End – [Github Actions Frontend Workflow File](https://github.com/mattspath/cloud-resume-challenge/blob/main/.github/workflows/frontend.yml)  
* Blog Post – You're looking at it.



#My experience
I started by finding an HTML resume template, updating it with my resume details. Creating the S3 bucket and uploading the files was easy and straightforward, as was enabling static website hosting. Configuring the S3 bucket permissions is where I encountered my first obstacle: properly configuring permissions to allow access while maintaining bucket security. I discovered that I could use an Origin Access Identity to provide CloudFront access to my S3 bucket. 

I used Route 53 to register my domain, Mattspath.com, and to create an A record to point to my CloudFront Distribution. Once I had my FQDN identified, I was able to request a TLS certificate using AWS Certificate Manager (ACM) and reconfigure CloudFront to redirect HTTP to HTTPS and use the certificate that was generated. 

While searching how to get the visitor counter set up, I came across Amazon Serverless Application Model (SAM). Using SAM, I was able to create and deploy a template file to provision my DynamoDB table, API Gateway, and Lambda Python function. The SAM template is how I implemented Infrastructure as Code (IaC). Once I got my backend set up, I found a Javascript example to use to make the API call which increments and retrieve the visitor count. Once I added that to my HTML page, I wrote some basic unit tests in Python. 

Setting up CI/CD Pipelines for both front end and back end environments was the only remaining tasks. I opted to use Github Actions to facilitate this, which was possibly one of the most insightful parts of this project, as I had only ever used Github to host my repositories and for version control. Setting up Github Secrets to hold AWS Region, S3 Bucket, and AWS role values confidentially was a must. For both front end and back end workflows, I used ubuntu and configured them to pull my repo and set up AWS credentials. The front end workflow copies the contents of the website directory to my S3 bucket, updating my static resume website. The back end workflow installs python, boto3, runs my test file, then validates, builds, and deploys my SAM template to AWS. 

#Conclusion
This project was a lot of fun and allowed me to get practical experience with new services and features. Getting hands on with SAM to deploy Lambda, API Gateway and DynamoDB resources was insightful, as I move more towards automation and implementation of IaC within AWS. Learning how to use Github Actions to automatically test and push that SAM configuration on commit to the master branch is something that will also help me set up CI/CD pipelines to better enable that automation. This experience has left me excited to try different things in AWS, and hopefully pursue additional challenges in the future to gain more experience. 


#Additional Notes
###Github Page - [_mattspath/cloud-resume-challenge_](https://github.com/mattspath/cloud-resume-challenge)