DEV Community

Kelechi Edeh
Kelechi Edeh

Posted on • Originally published at kelechiedeh.hashnode.dev

Adding CI/CD Integration to My Cloud Resume Challenge

Image description

As part of my Cloud Resume Challenge, I wanted to go beyond just creating a resume website on AWS by implementing a Continuous Integration and Continuous Deployment (CI/CD) pipeline. This added a new layer of automation, efficiency, and reliability to the project, ensuring that every update I make to my resume site goes live seamlessly. In this post, I’ll walk you through my process for setting up a CI/CD workflow using GitHub Actions to automate updates to my resume, hosted on AWS, and to handle CloudFront cache invalidation.

Why CI/CD for a Resume Site?

Adding CI/CD to a resume website might seem like overkill at first glance, but here’s why it’s a valuable addition:

  • Efficiency: I can push updates directly from GitHub, avoiding the need for manual uploads or deployments.

  • Reliability: Automated testing ensures that any changes don’t inadvertently break the site.

  • Learning Opportunity: This was a chance to practice CI/CD with AWS, a skill highly relevant to real-world DevOps and cloud-based projects.

My CI/CD Goals for the Project

  1. Automate Deployments to S3: Whenever I push updates to my GitHub repository, the workflow should sync the changes to my S3 bucket, which hosts my static website.

  2. Invalidate CloudFront Cache: After the files are updated, the CloudFront distribution’s cache should be invalidated to ensure that visitors see the latest content.

  3. Integrate Testing: Though simple, my code includes some basic HTML, CSS, and JavaScript, so any critical testing should pass before deploying.

Setting Up the CI/CD Pipeline

For this project, I used GitHub Actions as my CI/CD tool due to its seamless integration with GitHub repositories and support for AWS.

I created a .yml file in .github/workflows within my repository. This file defines the entire CI/CD pipeline, divided into two main jobs: Deploy to S3 and Invalidate CloudFront Cache.

Code repository

Let’s break down what each part does:

  1. Trigger: The workflow is triggered by a push to the master branch. Whenever I update my resume’s code in this branch, the workflow automatically runs.

  2. Deploy to S3 Job:

    Checkout: The code from the repository is checked out into the runner.

    Configure AWS Credentials: GitHub Actions configures AWS credentials from the stored secrets.

    Sync to S3: This command uploads all the files from the repository to my S3 bucket, ensuring that any outdated files are replaced, and deleted files are removed.

  3. Invalidate CloudFront Cache Job:

    Dependency on Deploy Job: This job depends on the successful completion of the S3 deployment. If deployment fails, cache invalidation won’t occur.

    Cache Invalidation: This command clears the cache in CloudFront, ensuring that the updated content is available globally without delay.

Benefits of the CI/CD Pipeline

With this CI/CD setup, every update to my resume becomes a simple commit and push. GitHub Actions takes care of uploading to S3 and clearing the CloudFront cache. This setup has brought several benefits:

  • Rapid Updates: I can make updates quickly without manual intervention.

  • Reduced Errors: Automating deployments has reduced the chance of human error.

  • Real-World DevOps Practice: Setting up this CI/CD pipeline gave me valuable experience with AWS and GitHub Actions.

Conclusion

Implementing CI/CD for my Cloud Resume Challenge has been a rewarding experience, adding both professionalism and efficiency to my project. If you’re working on a similar project, I highly recommend setting up a CI/CD pipeline with GitHub Actions. It simplifies deployment and makes it easy to keep your site updated and relevant.

. Thanks for reading, and happy coding!

Top comments (0)