DEV Community

Asrın Yılmaz
Asrın Yılmaz

Posted on

Serverless CI/CD Resume Website in AWS (The Cloud Resume Challenge)

According to the official path of this challenge (link here), 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 "Great Stack", 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

Visitor Count - Lambda Function

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

Visitor Count - SAM Template

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

Github Actions Test

Since test is successful, deploy is triggered.

Github Actions Deployment

Github Actions Deployment

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 :)

Top comments (0)