Serverless CI/CD Resume Website in AWS (The Cloud Resume Challenge)
Published: 2023-07-25 19:24:52

According to the official path of this challenge (<a href="https://cloudresumechallenge.dev/docs/the-challenge/aws/" target="_blank">link here</a>), the initial step was to obtain the Cloud Practitioner certification. However, I chose a different approach and decided to focus on my project first and then working directly towards achieving the Solutions Architect Associate certification as my ultimate goal. Currently, I am actively pursuing this certification at the end of my project journey.

My journey into web development began with building my very first website, which proved to be both challenging and highly educational. Trying to create an attractive and responsive website, I looked for ideas from various sources, including a tutorial from the YouTube channel "<a href="https://youtu.be/0YFrGy_mzjY" target="_blank">Great Stack</a>", which heavily influenced the design of my website.

Then I deployed my frontend files to an S3 bucket and generated a CloudFront distribution to serve the static website. If the Route53 domain directly routes to a publicly accessible S3 bucket as the website source, HTTPS cannot be used. So my main goal in using CloudFront was to enable HTTPS. However, while working on it and learning about CloudFront, I realized that it offers much more than just HTTPS support. It is a content delivery network with additional capabilities, acting as an intermediary between the website's origin server and the end-users, optimizing content delivery by caching and distributing resources to edge locations worldwide.

To address the HTTPS issue and to use a custom DNS domain name, I acquired the domain "asrinyilmaz.com" and created records to point to the CloudFront distribution. The process required an SSL certificate for the custom domain, which I obtained through AWS Certificate Manager. Once added to my CloudFront distribution and with the proper Route53 configuration, my website was finally accessible via HTTPS, marking a significant milestone in my journey.

As the frontend approached completion, I shifted my focus to building backend components, specifically a visitor count and a form submission functionality. For this, I utilized AWS API Gateway, AWS Lambda, and AWS DynamoDB. After writing and testing the Python code locally, I proceeded to set up DynamoDB, deployed the code to AWS Lambda, and established an API Gateway for both functionalities.

![Lambda Function - Visitor Count](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xgsjh2446fwb3fa0izml.png)
<figure>
  <figcaption>Visitor Count - Lambda Function</figcaption>
</figure>

With a fully functional website covering both frontend and backend, my attention turned to the critical component missing from my setup - the CI/CD Pipeline. Realizing the importance of automated testing and deployment, I began writing tests for my backend components. To streamline the process, I defined my AWS resources, excluding S3 bucket and Route53 domain, as "Infrastructure as Code" using SAM templates. Although initially challenging due to my limited experience with declarative templating, I became more comfortable with it. Later on, I found it more convenient to declare resources as CloudFormation resources, as both SAM and CloudFormation resources can coexist within the same template. This allowed me to have a unified and comprehensive template for managing my AWS resources.


![Visitor Count - SAM Template](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rukj08ttvjqmyivl8gj4.png)
<figure>
  <figcaption>Visitor Count - SAM Template</figcaption>
</figure>

To further optimize the development process, I created separate repositories for the frontend and backend components. Utilizing GitHub Actions, I set up automated testing and deployment workflows. Now, whenever there is a push to the main branch, backend tests are executed, and if successful, the code is deployed to AWS Lambda. Similarly, for the frontend repository, whenever there is a push to the main branch, all changes are deployed, updating the S3 bucket with new items, and triggering a new CloudFront invalidation.


![Github Actions Test](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o1rnilg14goto4a4rycx.png)
<figure>
  <figcaption>Github Actions Test</figcaption>
</figure>

Since test is successful, deploy is triggered.

![Github Actions Deployment](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ohzyhg2j8xaqkfiyziz.png)
<figure>
  <figcaption>Github Actions Deployment</figcaption>
</figure>



During the Cloud Resume Challenge, I fully engaged myself in cloud-related activities, focusing on deploying a strong cloud infrastructure using AWS services and automation techniques. From enabling HTTPS with CloudFront to setting up a CI/CD Pipeline using SAM templates for Infrastructure as Code. I am currently working towards obtaining the Solutions Architect Associate certification and hoping to get certified soon :)