How I completed Cloud Resume Challenge

How I completed Cloud Resume Challenge

Using Google Cloud

My resume page

My code

In the spring of 2023 I decided to attempt the Cloud Resume Challenge after searching for cloud project ideas online. What drew me most to this project was that the author, Forrest Brazeal, does not provide you with a comprehensive "how-to" guide but rather outlines a series of steps that you must complete in order to produce the finished product, a personal resume webpage created using Google Cloud and other DevOps tools. The project was also a great way to get hands on experience using GCP and an opportunity to create something I could show a potential employer. What follows is a summary of my experience completing the Cloud Resume Challenge and some of my key takeaways.

Obtaining GCP Certification

My first steps towards completing the challenge was to obtain an introductory GCP certification. I found this process extremely helpful since I didn't have much knowledge of cloud technology before beginning this project. I registered to take GCP Cloud Digital Leader exam and started the studying process. I used several resources to prepare for the test and found the materials from Exam Pro to be the most helpful.

Soon after earning the digital leader certification I decided to start the process of studying for the GCP Associate Cloud Engineer exam. At first, I was a bit overwhelmed when I started reading through the exam topics and I started to feel that I was in over my head. In total, I spent about 4-6 months studying to take the ACE exam. I must have read the official study guide about 3 times and taken about 10 practice tests before feeling confident enough to sit for the exam. In the end, the hard work paid off and I passed the test on the first go around.

Getting started

After reading through the challenge steps I created a diagram describing the overall architecture of the finished product. I had to create two projects, one for my backend services and another for my frontend services. Creating the frontend resume page seemed easy enough but I was beginning to see how creating the backend was going to be a learning experience.

The Frontend: Deploying a static website using HTML/CSS

I don't have much experience with web design so I used a Bootstrap template for my resume webpage. I brushed up on my limited HTML and CSS knowledge and updated my resume.

The GCP documentation for hosting static website is very thorough. I found this step pretty straightforward and didn't experience any major challenges. I deployed an application load balancer and attached an SSL certificate for HTTPS. Using my Google Domain I created a DNS record that pointed to my load balancer's backend and my site was up and running!

The Backend: Creating a Website Visitor Counter

This is the part of the challenge where I started to slow down. I created a Cloud Function using Python that queried and updated my Firestore database with the number of visitors to my resume page. I found the client library documentation a bit unclear so I spent a lot of time debugging and redeploying my function until I had it working properly. I learned how crucial the error logs were while testing my Cloud Function and it helped expedite the whole debugging process.

@functions_framework.http
def test(request):

    client = datastore.Client()
    kind = 'visitor_counter'
    key = client.key(kind, 'website_visitors')

    #Retrieve entity with current visitor count 
    counter_entity = client.get(key)

    #Create initial visitor count if entity does not already exist and set to 0 
    if not counter_entity: 
        counter_entity = datastore.Entity(key=key)
        counter_entity['count'] = 0

    #Update the number of visitors and update the database
    counter_entity['count'] += 1
    client.put(counter_entity)

    total_visitors = {'total_views': str(counter_entity['count'])}

Connecting the Frontend with the Backend

Once my Cloud Function was up and running the next step was to create an API that communicates with my database using API Gateway. I spent a fair amount of time familiarizing myself with REST APIs and on how to create an OpenAPI document. I found this part of the challenge a bit daunting since I was not very familiar on how APIs actual work much less on how to write a configuration file for an API.

After deploying the API gateway I updated my HTML document with the few lines of JavaScript needed to make calls to my API. My website visitor counter was complete but it could certainly be improved. Forrest offers up some suggestions or "mods" that can be implemented to either improve your project or further challenge you. I plan to improve the visitor counter to be less of a "hit" counter in the next iteration of my project.

Lastly, I ran end-to-end testing using Cypress to ensure that my API and webpage were working as expected. This step was a little tricky as I had to learn how to write the Cypress spec file and run a local development server using VS Code. I feel as though I could have been a little more thorough on this step but I do plan to spend a little more time reading up on the Cypress documentation to try and make my tests more robust.

Infrastructure as Code and CI/CD

I decided to use Terraform as my IaC tool since most of the tools and resources that I had been using up to this point were specific to GCP. While studying for the ACE exam I took the "Getting started with Terraform for Google Cloud" course which was a great introduction to Terraform. I am glad I took detailed notes while taking the course since they were very useful while writing my first Terraform configuration file. The most challenging part of this step was that I initially deployed my infrastructure directly from my computer and was storing the state file locally. This created some issues when attempting to initialize Terraform using Gitlab until I realized I had to store the state files in a storage bucket.

For CI/CD, I went with Gitlab for my backend and Github for the frontend website code. This step was also a challenge as I had to contend with authentication to GCP via Workload Identity Federation and service accounts. I found this part of the challenge was extremely practical as I was able to get more familiar with Github actions, source control, and best practices for authentication.

Takeaways

Completing this project was both difficult and rewarding. I appreciate the fact that I feel more confident using cloud technology and I learned a great deal in the process. Reflecting back on the experience the following thoughts come to mind:

  • Take time and read the documentation thoroughly. It's tempting to skim through the documentation pages and Stack Overflow searching for the quick fix. It pays to read and understand what it is that you are doing.

  • Stuck on a problem? Step away for a bit. Taking time away from your screen and reading documentation when you are stuck on a problem is important.There were a few instances that an idea popped into my head while I was doing something unrelated which eventual led to me solving the issue.

  • It's impossible to know everything. There were several times when I did not think I could complete the project. I remember having some serious doubts as I was working on the final stages of the project (Terraform and CI/CD). Continuing to work through these hurdles is when you learn the most.

As mentioned earlier, I do plan on improving my project and taking on some of the mods in the near future. For now, I am excited to take on more challenges and continue the learning process.