Skip to content

distractdiverge/chalice-demo

Repository files navigation

AWS Chalice Demo

This is a demo project, illustrating how to make use of AWS Chalice with AWS to perform ETL.

Requirements

  • Periodically check to see which records are in the 'submit' state
  • Take these records & create SQS message
  • Process numerous messages from the queue via another lambda
  • Create required infrastructure (queue, etc)

References

Logical Architecture

Logical Architecture

Testing

  • Just execute the tests
make test
  • Execute Tests & Coverage (simple report)
make test-cov-report
  • Execute the tests & produce HTML coverage report
make test-cov-html

Deployment & AWS

This project makes use of AWS Chalice to eliminate a lot of the boilerplate for creating lambdas.

deployment-pipeline

Since most of the AWS libries that are typically used require boto3, AND boto3 is included by default within a lambda's runtime AND we need a small package size to deploy, we need to perform some "post-processing" of the lambda zip package when deploying. (we manually remove the boto3 library from the zip).

We have to reduce the package size before deploy, and the only way to do that is to deploy via CloudFormation in a 3 step process.

make package-chalice # Package the Python Code & ALL libraries
make update-package # Remove Botocore & others (reduce size)
make package-cloudformation # Create the CloudFormation Package & Upload to S3
make deploy # Deploy to AWS

OR, just run the chained commands:

make package ## Executes package-chalice, update-package & package-cloudformation
make deploy 

Python VirtualEnv

The following tools are used to manage python versions & virtual environments. Make sure these are installed.

Create VirtualEnv

This only needs to be done once

pyenv virtualenv 3.9.2 <project-name>

Activate VirtualEnv

pyenv activate <project-name>

Using The VirtualEnv

Typical tasks would be:

  • Install dependencies via pip
pyenv exec pip install <something>
  • Execute python scripts
pyenv exec python ./some-file.py

About

A minimal Python project that demonstrates building, testing, and deploying a serverless REST (and WebSocket) API on AWS using AWS Chalice.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors