16 Followers
·
Follow

The Cloud Resume Challenge with GCP

Image for post
Image for post

The Cloud Resume Challenge is an initiative by Forrest Brazeal to help new people to break into the Cloud industry, as many people are losing their jobs because of the coronavirus pandemic.

The challenge was to build a resume website using AWS. After seeing the challenge and many people finishing it, I was really interested to see if I can complete the same challenge with GCP.

TL;DR: The final product is here.

So, what’s the difference between the two cloud providers’ stack? Compare to Forrest’s original challenge, these are the changes I have made:

1. Your resume needs to have the AWS Cloud Practitioner certification on it

I have the GCP Associate Cloud Engineer certificate.

2. Your resume needs to be written in HTML

This requirement is kept as it is.

3. Your resume needs to be styled with CSS

I am a total noob in frontend development, so I borrowed André Fontenelle’s theme. Thank you André.

4. Your HTML resume should be deployed online as an Amazon S3 static website

I used Google Cloud Storage bucket to host my website.

5. The S3 website URL should use HTTPS for security. You will need to use Amazon CloudFront to help with this.

In order to achieve this, I created an External HTTPS Load Balancer pointing to my GCS bucket as a backend bucket and attach a Google managed SSL certificate to it. In the load balancer config, I also added a default HTTP to HTTPS redirect rule. To use Cloud CDN, I just need to tick Enable CDN box.

I attached an SSL Policy, restrict TLS version to minimum 1.2 and restrict a set of ciphers to make the website more secure. Finally, I enabled QUIC to test it out as I have heard of QUIC/ HTTP 3 before but never got the chance to try them.

6. Point a custom DNS domain name to the CloudFront distribution, so your resume can be accessed at something like my-c00l-resume-website.com. You can use Amazon Route 53 or any other DNS provider

So I registered my domain with Google Domains and use Cloud DNS to set DNS records pointing to my Load Balancer’s static IP.

7. Your resume webpage should include a visitor counter that displays how many people have accessed the site. You will need to write a bit of Javascript to make this happen. Here is a helpful tutorial to get you started in the right direction.

This requirement is kept as it is.

8. The visitor counter will need to retrieve and update its count in a database somewhere. I suggest you use Amazon’s DynamoDB for this.

Instead of DynamoDB, I made use of Cloud Firestore to store the counter. It’s the next generation of Cloud Datastore.

9. Do not communicate directly with DynamoDB from your Javascript code. Instead, you will need to create an API that accepts requests from your web app and communicates with the database. I suggest using AWS’s API Gateway and Lambda services for this.

Cloud Functions supports HTTP trigger so I did not have to use another product to create an API for my function like Lambda. I used Go 1.13 and Firestore Go SDK to write the function code.

10. You should also include some tests for your function code.

I have only added a dummy test to make sure I can test my code. Will backfill it will actual function test later.

11. You should not be configuring your API resources — the DynamoDB table, the API Gateway, the Lambda function — manually

I used Cloud Deployment Manager to help me create and deploy my function.

12. You do not want to be updating either your back-end API or your front-end website by making calls from your laptop, though. You want them to update automatically whenever you make a change to the code.

13. Create a second private GitHub repository for your website code. Create GitHub Actions such that when you push new website code, the S3 bucket automatically gets updated. (You may need to invalidate your CloudFront cache in the code as well.)

For this, Cloud Build is an excellent choice. I have setup a Cloud Build trigger so that every time I push to master branch in my GitHub repo, it will run a pipeline where my function codes get tested, the website codes get synced to the Cloud Storage bucket and the new function version is deployed via Deployment Manager.

14. Finally, in the text of your resume, you should link a short blog post describing some things you learned while working on this project. Dev.to is a great place to publish if you don’t have your own blog.

So here it is, I use Medium instead because I like it more.

In general, the challenge was really fun. It helped me improve my skills and knowledges both in AWS and GCP. For this particular challenge, some parts are easier in AWS, some are easier in GCP. Depending on your use case, pick what you think will be the most suitable. I would love to discuss more about these 2 cloud providers.

As Forrest suggests, I won’t put a detailed instruction of how to do it here yet but I will definitely update my blog with codes and guides later.

Please reach out if you guys have any question regarding my version of the challenge.

Email: quang@quangngo.net

Twitter: https://twitter.com/quangsb

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store