Skip to content

A specially crafted AWS CDK template that is designed as a reference for a fully serverless application Simple, clean, and easy to get started with your custom requirements.

License

Notifications You must be signed in to change notification settings

Atharva21/cdk-poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An AWS CDK Template.

workflow status codecov

A specially crafted AWS CDK template that is designed as a reference for a fully serverless application
Simple, clean, and easy to get started with your custom requirements.

Is it for you?

  • Designed for beginners to quickly get started with AWS CDK.
  • Uses python for the lambda backend and typescript for 'infrastructure as a code'.
  • Stuck how to integrate AWS services with CDK? Or how to setup a python lambda testing and deployment pipeline? This template is for you to refer!

Setup

  • Fork repo & clone

    git clone https://github.com/<USERNAME>/cdk-poc.git
    cd ./cdk-poc
  • Setup python virtual environment

    pipenv install --dev

    dont have pipenv? checkout pipenv installation guide.

  • Develop:

    • For changes in AWS deploy stack, navigate to deploy
      cd ./deploy/
      install npm packages
      yarn
      You can edit the template stack in deploy/lib/cdk-poc-stack.ts. In this file, we can create infrastructure as code, for reference check out AWS CDK documentation
      • Example template architecture:
        You will find below stack in the template you can add/delete components as per your needs.
        cdk-poc
    • For changes in Lambda functions, navigate to src/functions
      cd ./src/functions/
      Here you will find two template functions Producer and Consumer You can edit/add/delete your own lambda functions here, just ensure that they are referred in the stack file mentioned above Note that lambda layer creation is taken care in CI workflow so you need not worry about it.
  • Test:

    • Template uses pytest with moto to mock aws environment to run the tests

      pipenv run python -m pytest ./src/tests/
    • To generate a coverage report

      pipenv run python -m pytest ./src/tests/ --cov=. --cov-report=html
    • Run Linter

      pipenv run python -m flake8 ./src
  • Deploy: In order to use the CI workflow we need these three github repo secrets

    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
    • AWS_REGION

    checkout how to find access & secret keys

    once these are configured, we can simply push / merge on the main branch which will trigger a CI workflow to build, test and deploy stack on aws. The workflow will generate a artifact named aws-artifacts which can be downloaded post workflow run.

    For pull requests, CI workflow will only build and test, and not deploy.

  • Destroy: In order to destroy/takedown the deployed stack in your AWS account, you can manually run the teardown workflow. It destroys all the resources created under the cdk-stack file.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

About

A specially crafted AWS CDK template that is designed as a reference for a fully serverless application Simple, clean, and easy to get started with your custom requirements.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •