Skip to content

A CDK Implementation of acantrill's cuddle-o-tron stack

License

Notifications You must be signed in to change notification settings

jeffcatania/cuddle-o-tron-cdk

Repository files navigation

Welcome to Pet Cuddle-o-tron CDK project

This project is a Typescript CDK implementation of Adrian Cantrill's aws-serverless-pet-cuddle-o-tron. If you are new to learning AWS, I cannot recommend his Solution Architect Associate course enough.

The purpose of this repo is to codify the skills that I've learned from the course, learn CDK, and serve as a template for similar architectures.

The cdk.json file tells the CDK Toolkit how to execute the app.

Architecture

The architecture of the project will follow the architecture of Adrian's lesson. End State Architecture

Steps to install and deploy code

  1. Install CDK and run cdk bootstrap to setup your cdk environment if you haven't already.
  2. Rename .env.example to .env to enable dotenv environment variables
  3. Update environment variables in .env file for your configuration.
  4. Run cdk synth to generate the CloudFormation files in cdk.out directory. Inspect files created.
  5. Run cdk deploy to deploy changes to your AWS environment.
  6. Log into the AWS console and view the created CuddleOTron stack in the CloudFormation tab.
  7. Once deployed, go to the S3 console to open the Index.html file in your browser. Fill out the form using the SES_VERIFIED_RECEIVER_EMAIL you configured in the .env file.
  8. Watch the process run in the Step Functions tab. Validate if theres any errors.
  9. Check your RECEIVER email address. You should have an email. If its not there, check your spam folder.

Useful commands

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • npm run test-coverage perform the jest unit tests with code coverage report
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template

Non Functional Features

I am using the project as a testing ground for good code hygiene practices as I intend to use this as a basis for future AWS projects.

  • Running CDK using Typescript
  • Automated testing using Jest and the CDK Template framework. Aiming for 75% code coverage.
  • Automated Code Linting with Prettier via git pre-commit hook.
  • GitHub action for CI.

TODO

  • Write integration tests for each stage of the pipeline.
  • Refactor Email Reminder Construct file to seperate files.
  • Add CD to GitHub Action.
  • Migrate Lambda code from Python to Typescript for consistency. Include unit tests.
  • Add code generators for new initializing new constructs, s3, and lambdas. (I like hygen)
  • Templatize this whole codebase for use in future projects.