Welcome to the repository for my Cloud Resume API Challenge! This project highlights my journey through various AWS services, culminating in the creation of a dynamic, serverless API that serves my resume data. Let's dive into the details of how this was accomplished.
Experience the API in action with this curl command:
curl https://5yw6uexaub.execute-api.us-east-1.amazonaws.com/Prod/resume
If you have jq installed, use this for a prettified JSON response:
curl -X GET https://5yw6uexaub.execute-api.us-east-1.amazonaws.com/Prod/resume | jq .
This project demonstrates the automated deployment of an AWS Lambda function using Terraform and GitHub Actions. The Lambda function acts as the backend for a resume API, providing endpoints to fetch resume details stored in a DynamoDB table.
The architecture involves:
- AWS Lambda: Runs the backend code for the API.
- AWS API Gateway: Provides a RESTful API endpoint.
- DynamoDB: Stores the json resume data.
- Terraform: Manages the infrastructure as code.
- GitHub Actions: Automates the CI/CD pipeline.
Before getting started, ensure you have the following:
- An AWS account with necessary permissions.
- Terraform installed.
- AWS CLI configured with your credentials.
- A GitHub account with access to the repository.
AWS-CLOUD-RESUME-API/
├── .github/
│ └── workflows/
│ └── deploy.yml
├── infra/
│ ├── .terraform/
│ ├── main.tf
│ ├── provider.tf
│ ├── api_gateway.tf
│ ├── lambda_function.zip
│ ├── requirements.txt
│ └── terraform.tfstate
├── lambda_function/
│ ├── lambda_function.py
│ └── resume_data.json
├── diagram.png
├── .gitignore
├── LICENSE
├── README.md
- Sign Up: Create an AWS account if you don't have one, sign up at aws.amazon.com.
- Configure AWS CLI: Configure your AWS CLI with your credentials using
aws configure
.
- Create a JSON file containing your resume data. Follow a schema Here
- Store this JSON file for later use.
- Table Name: Resumes
- Primary Key:
id
(String) - Populate the table with your resume data using the AWS Management Console, AWS CLI, or a script.
- Create a Python script (
lambda_function.py
) to fetch resume data from DynamoDB and return it in JSON format.
- Zip the
lambda_function.py
file.
- Create
main.tf
andprovider.tf
for infrastructure as code as a way to automatically create the lambda function and the API Gateway configurations .
- Create an S3 bucket in the AWS console or the AWS CLI with the same name as the one used in
provider.tf
file .
- Initialize Terraform:
terraform init
- Plan the Deployment:
terraform plan
- Apply Deployment:
terraform apply
- API Endpoint: Note the generated API endpoint URL for testing.
- Workflow: Set up a workflow file in .github/workflows/deploy.yml to automate deployments on code pushes.
- Using Curl: Test the API to ensure it returns resume data in JSON format.
- Verify CI/CD: Push changes to GitHub and ensure the GitHub Actions workflow deploys updates correctly.
For any questions or inquiries, please reach out to me at [email protected].