Cloud Resume Challenge — Week 4
4 min readJun 23, 2023
Week 4: Represent your cloud resources as configuration, so they can be deployed identically in any environment — and automate those deployments using a CI (continuous integration) pipeline.
Forrest Brazeal’s “Cloud Resume Challenge” is an exciting way to enhance both your cloud and development skills. This challenge requires you to design, develop, and deploy a resume website on AWS using various cloud services.
Helpful resources:
- The Learn resources for GitHub Actions
- Getting started with the AWS CDK — AWS Cloud Development Kit (AWS CDK) v2 (amazon.com)
- My Blog on Cloud Development Kit
Architecture:
TASK — 1 : Create a Stack using IAC
- For creating Infrastructure I used Cloud Development Kit (CDK), since I am familiar with it. You can opt for different infeastructure as code tools like terraform, cloudformation , pulumi , etc
TASK — 2 : Create a CI Pipeline using GitHub Action
- Prerequisites: Ensure that you have the necessary permissions to create and manage GitHub Actions workflows in your repository. You should also have access to the infrastructure deployment tools and configurations required for your project.
- Create Workflow File: In your GitHub repository, navigate to the
.github/workflows/
directory (create it if it doesn't exist) and create a new YAML file, e.g.,ci.yml
. This file will define your CI workflow. - Define Workflow Trigger: Begin the workflow file by specifying the event(s) that will trigger the workflow. For example, you might want to trigger the workflow on every push to the
main
branch or when a pull request is opened or updated. - Specify Workflow Jobs: Within the workflow file, define one or more jobs that represent the steps of your CI pipeline. Each job can contain one or more steps that will be executed sequentially.
- Checkout Source Code: Start each job by checking out the source code from your repository. This ensures that subsequent steps have access to the latest code changes.
- Install Dependencies: If your infrastructure deployment process requires any dependencies or tools, such as specific CLI tools or libraries, include steps to install them.
- Run Tests and Linting: If you have automated tests or linting processes for your infrastructure code, include the necessary steps to run them. This helps ensure that the code changes are valid and conform to your project’s standards.
- Deploy Infrastructure: Add the steps to deploy your infrastructure to the desired environment. This can involve executing scripts, running deployment commands, or interacting with infrastructure-as-code tools like Terraform, CloudFormation, or Ansible.
- Environment-specific Configurations: If your infrastructure deployment process requires environment-specific configurations (e.g., credentials, endpoints, or secrets), ensure that these are properly managed and securely stored. You can use GitHub Secrets to store sensitive information and access them within your workflow.
- Notifications and Reporting: Consider adding steps to send notifications or reports about the deployment status or any potential issues. This could involve sending emails, posting messages to Slack, or integrating with other communication channels.
- Error Handling and Cleanup: Implement error handling mechanisms in case any step fails during the CI process. You might want to roll back changes, clean up temporary resources, or notify relevant team members.
- Branch and Environment Mapping: If you intend to deploy to multiple environments based on different branches, ensure that your workflow handles the mapping between branches and environments appropriately. For example, you might deploy to a staging environment for pull requests and a production environment for the main branch.
- Workflow Testing: Before committing and pushing the workflow file, consider testing it locally using the GitHub Actions Local Runner or the provided simulation feature in the GitHub Actions editor. This allows you to catch any syntax or logical errors before triggering the workflow on actual events.
- Commit and Push Workflow: Finally, commit and push the workflow file to your repository. GitHub Actions will automatically detect the new workflow and start executing it based on the specified trigger events.
Errors :
- Error in GitHub Action
- It wasn’t able to find the lambda path , since .js was present in .gitignore. I removed .js from .gitignore and tried pushing again with temporary changes. It Worked !!!