Skip to content

Muyun2023/AWS_CDK_LeetcodeMonitor

Repository files navigation

A CDK project that notifies users about their LeetCode progress via email. Utilized Github Action to create an automated deployment pipeline

LeetCode Progress Tracker

Technologies Used: AWS S3, AWS SES, AWS Eventbridge, AWS Step Function, AWS Lambda, AWS CDK, Python, TypeScript, Requests Library, JSON

• Developed a serverless application using AWS Lambda to track and retrieve user progress on LeetCode, integrating with a third-party API to gather real-time data on LeetCode problem-solving activities.
• Architected the solution with AWS CDK, defining the infrastructure as code to automate the deployment of AWS resources, including S3 buckets for data storage, Lambda functions for processing, and SES and Eventbridge for sending daily emails.
• Implemented a Python-based Lambda function that fetches the latest 10 submissions and the overall solved question summary for a specified LeetCode user, returning the data as a JSON object.
• Demonstrated strong proficiency in cloud-based serverless architecture, API integration, and Python scripting, contributing to the seamless delivery of an automated tracking tool for coding practice.

This is a sample email you will receive: 5

This is the design diagram: 6

This shows the design works correctly: 7


Must-Dos before running the project (search for TODO in the code):

  1. Create a Lambda Layer from the ZIP file in S3, which includes the requests library . This is done manually by uploading the ZIP file to a S3 bucket: requests_layer.zip 3

  2. Find the deploy.yml at .github/workflows, you will see ${{ secrets.AWS_ACCESS_KEY_ID_GAMMA }}, ${{ secrets.AWS_SECRET_ACCESS_KEY_GAMMA }}. these secrets need to be added to the GitHub repository. Go to repository settings -> secrets and variables (left panel) -> action -> new repository secret 1 2

  3. Replace with your SES-verified email and destination email. Go to AWS console, go to SES service, on the left panel, click on identities under Configuration, and create a new identity 4

  4. Complete the TODO list note in codes. Pay attention to the account id, access key, secret access key, and region, replace them to your own information. Currently deployed to one region: us-east-2. You can uncomment the deploy.yml to deploy to more prod stages/regions


How to get started:

  • aws configure set up aws account connection -> in ChatGPT, search "how to set up aws configure" . if you don't have the AWS Access Key ID and Secret Access Key, search "AWS Access Key ID and Secret Access Key"
$ aws configure
AWS Access Key ID [None]: yourID
AWS Secret Access Key [None]: yourKey
Default region name [None]: us-east-2
Default output format [None]: json
  • npm run build compile typescript to js
  • cdk bootstrap If this is your first time using AWS resources, you need to run cdk bootstrap once before running cdk deploy,
  • cdk deploy This is an optional step as you can run below git commands. deploy this stack to your default AWS account/region
  • git add .
  • git commit -m "new code"
  • git push

Useful commands

  • aws configure set up aws account connection
  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • cdk bootstrap before running cdk deploy, you need to run cdk bootstrap once when deploying to a new region
  • npx cdk deploy deploy this stack to your default AWS account/region
  • npx cdk diff compare deployed stack with current state
  • npx cdk synth emits the synthesized CloudFormation template

special mention: thanks to this useful API provided in https://github.com/alfaarghya/alfa-leetcode-api i don't see leetcode's graphql. It's removed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published