Awesome AWS Chalice
List of resources for using AWS Chalice
AWS Chalice (join us in our community Slack channel) is Amazon Web Services' premier solution to writing infinitely scalable serverless Python applications based on AWS Lambda. Chalice provides an extensible build process via
chalice generate-pipeline
, allowing you to orchestrate the deployment (chalice deploy
) of any dependencies or outputs, such as infrastructure code written in the CDK, executable artifacts, backend APIs or front-end applications. Chalice is suited for:
- Writing https APIs that wrap infrastructure on AWS.
- Building libraries of Ops functions (DevOps, DevSecOps, NetDevOps, NetOps, NetSecOps, CI/CD Pipeline, ChatOps, etc.).
- Managing AWS accounts programmatically.
- Creating web applications with your favorite front-end toolkit, just as jQuery UI or AWS Amplify.
- Providing the web API backend layer to cross-platform Win/Mac/Linux/Android/iOS desktop and mobile applications written in Qt for Python (PySide6).
Chalice's design is based on decorators. It is written by the AWS Chalice team. Think of Chalice as your primary entry point to whatever it is that you want to do on AWS, or in the cloud.
Contents
- AWS Projects
- AWS Python SDKs
- AWS Samples for Python
- AWS Labs Samples
- 3rd Party Tools
- Tooling for Writing Chalice Code
- Blog Posts and Feature Releases
- Built on Chalice
- Miscellaneous Awesomeness
AWS Projects
- AWS Data Wrangler
GitHub
- "Pandas on AWS": Easy integration with Athena, Glue, Redshift, Timestream, QuickSight, Chime, CloudWatchLogs, DynamoDB, EMR, SecretManager, PostgreSQL, MySQL, SQLServer and S3 (Parquet, CSV, JSON and EXCEL).
- AWS SDK for Javascript
aws.amazon.com
- With the AWS SDK for Javascript, you can authenticate your users on the front-end using Cognito, and from there code up a management interface for much of AWS. Note however that not all AWS services are supported yet. You can see which servics are supported in aws-sdk-js/clients/all.js.
- AWS Cloud Development Kit (CDK)
aws.amazon.com
- The AWS CDK is written in Javascript and, via JSii, is available to Python. With the
chalice-cdk
CDK Construct for Chalice you can deploy your Chalice application viacdk deploy
. Alternately, with Chalice'schalice generate-pipeline
extensible build process, you can deploy your CDK infrastructure when you deploy your Chalice application. In other words, you can either use the CDK to deploy your Chalice application, or use Chalice to deploy your CDK application. If you primarily write Chalice applications, you can use the CDK primarily for deploying your infrastructure layer.
- The AWS CDK is written in Javascript and, via JSii, is available to Python. With the
- AWS Solutions Constructs Patterns
aws.amazon.com
- These are vetted architectural patterns for the AWS CDK that allow you to easily chain together multiple products per solutions construct, and to also chain those patterns together. Many of the patterns are serverless in nature.
- AWS Serverless Application Repository
aws.amazon.com
- Weave these serverless applications into your Chalice application, such as the AthenaDynamoDBConnector which allows you to query DynamoDB using SQL via Athena. Take note that while many are published by AWS teams, some of these applications are published by third parties and should be evaluated before being put into production.
- JSii
GitHub
- JSii is the library that enables the AWS CDK to generalize from Javascript to Python. You can use JSii to call CDK code that may not have been interfaced to Python in a CDK Construct yet.
- DynamoDB Global Tables
aws.amazon.com
- A fully managed extension to DynamoDB for global NoSQL scale-out of your Chalice application.
- Aurora Serverless Global Database 2
aws.amazon.com
- A serverless OLTP database for your Chalice application that scales out to hundreds of thousands of transactions per second, with secondary cluster replications in up to 5 regions. Rumor has it that it runs Amazon.com.
- AWS Amplify
docs.amplify.aws
- In particular the Amplify UI Components, written in Javascript. Chalice makes it easy to create routing-based APIs that wrap the heavy lifting, while Amplify helps with the front-end Javascript, such as reactive programming based on React. You can use Chalice's built-in support for authorization via Cognito user pools, and you can pair Amplify's support for GraphQL with the Chalice-GraphQL 3rd-party library. You can also use Amplify CLI to deploy your Chalice application.
- Amazon Athena Federated Query
docs.aws.amazon.com
- This allows you to write Athena "data source connector" Lambda functions that can be used to query across hybrid data sources achieving a mesh topology for your ad-hoc Data Lake. You can write these data source connectors with Chalice using its ability to create pure Lambda functions, and run your federated queries from Chalice in SQL using a third party module such as SQLAlchemy.
AWS Python SDKs
- AWS SDK for Python (boto3)
boto3.amazonaws.com
- In addition to providing Python interfaces to most AWS services, Amazon will often release setup/teardown code for new services as boto3 scripts (i.e. AWS Detective and AWS GuardDuty) before they are available in CloudFormation or the CDK. You can modify these scripts to be run from Chalice. There is also an asynchronous version of boto3 available, aioboto3, that is compatible with Python 3's built-in
async
andawait
asynchronous programming keywords. With aioboto3 you can, for example, perform massively parallel writes and reads to S3 or DynamoDB.
- In addition to providing Python interfaces to most AWS services, Amazon will often release setup/teardown code for new services as boto3 scripts (i.e. AWS Detective and AWS GuardDuty) before they are available in CloudFormation or the CDK. You can modify these scripts to be run from Chalice. There is also an asynchronous version of boto3 available, aioboto3, that is compatible with Python 3's built-in
- AWS X-Ray SDK for Python
docs.aws.amazon.com
- The X-Ray SDK for Python is a must have for using the X-Ray console to trace and visualize your Chalice-based microservices architecture. In addition, this SDK can dynamically instrument tracing into other libraries that are useful for Chalice, such as boto3, aioboto3, pynamodb, sqlite3, psycopg2, pymongo and PyMySQL using
from aws_xray_sdk.core import patch_all;patch_all();
- The X-Ray SDK for Python is a must have for using the X-Ray console to trace and visualize your Chalice-based microservices architecture. In addition, this SDK can dynamically instrument tracing into other libraries that are useful for Chalice, such as boto3, aioboto3, pynamodb, sqlite3, psycopg2, pymongo and PyMySQL using
- AWS IoT SDK for Python
GitHub
- Add Internet of Things support to your Chalice application. This pairs well with Chalice's built-in support for events based on Kinesis Streams. There is also a Python SDK for Greengrass, which runs Lambda functions ON Greengrass IoT edge devices. These functions can trigger application logic in Chalice via IoT --> Kinesis Streams.
- AWS C Common Runtime
GitHub
- The most high performance Python-on-AWS applications may make use of the AWS C Common Runtime, which is written in... C! You'll need to use the AWS CRT Python module to make the magic happen.
- AWS Encryption SDK for Python
GitHub
- This is a client-side encryption library, meaning a library for using hard encryption hosted by AWS, in your application logic.
- AWS SageMaker SDK for Python
GitHub
- This SDK allows you to train and deploy machine learning models in Python, from Chalice, in frameworks such as TensorFlow, MXNet, or models that you created in SageMaker. It also supports hosting Apache SparkML models, allowing you to integrate with your AWS EMR cluster.
- AWS Step Functions Data Science SDK for Python
GitHub
- This SDK is for data scientists who want to create workflows that train and publish machine learning models, as orchestrated by AWS Step Functions, without having to worry about provisioning infrastructure.
- AWS Braket SDK for Python
GitHub
- This SDK allows you to interact with D-Wave quantum computing devices on AWS Braket from Chalice, enabling applications from quantum annealing to random number generation.
- AWS DynamoDB Encryption SDK for Python
GitHub
- This client-side SDK helps you encrypt your sensitive data before sending it to DynamoDB.
AWS Samples for Python
AWS Samples are example solution architectures created by AWS and published on GitHub. Here is the complete list of 500+ Python samples. This section contains the best serverless samples, which you can use as inspiration.
- AWS Control Tower Account Creation Automation
GitHub
- AWS Serverless Ecommerce Platform
GitHub
- Recurring Security Hub Summary Email
GitHub
- SQS dead letter queue replay with backoff and jitter
GitHub
- Tokenization and Encryption of Sensitive Data
GitHub
- AWS ParallelCluster serverless API
GitHub
- Amazon WorkMail Lambda Templates
GitHub
- S3 Glacier Bulk Retrieval
GitHub
- AutoML with AutoGluon, Amazon SageMaker, and AWS Lambda
GitHub
- Processing ML Workloads asynchronously in Batch using SageMaker Batch Transform
GitHub
- Serverless Tracking Pixel
GitHub
- Serverless Reference Architecture: Real-time File Processing
GitHub
- Serverless Reference Architecture: IoT Backend
GitHub
- AWS X-Ray Serverless Samples
GitHub
AWS Labs Samples
Sample serverless solution architectures code in Python from AWS Labs, which tends to be more feature complete than AWS Samples.
- Serverless Data Lake Framework (SDLF)
GitHub
- Media Insights Engine
GitHub
- Serverless Transit Network Orchestrator
GitHub
- Amazon Aurora Postgres Advanced Monitoring
GitHub
- AWS Serverless Twitter Event Source
GitHub
- Serverless Subtitles
GitHub
- AWS Serverless Financial Functions
GitHub
3rd Party Tools
- PynamoDB: A Pythonic wrapper for DynamoDB
GitHub
- PynamoDB is a pythonic interface to DynamoDB for data modelling. Example: terraform-registry.
GitHub
- PynamoDB is a pythonic interface to DynamoDB for data modelling. Example: terraform-registry.
- S3Fs
ReadTheDocs
- A filesystem-like interface to S3 built on
botocore
.
- A filesystem-like interface to S3 built on
- PySide6
qt.io
- PySide6 is the official Qt module for Python, for writing cross-platform Win/Mac/Linux/Android/iOS applications. With PySide6 and QtQuick you can very quickly write desktop Python applications that integrate with Chalice. You can use Chalice to authenticate via Cognito user pools, and to write an API layer for your application that is backed by any AWS service. You can use Chalice's extensible build system to create and publish cross-platform Qt executables.
- Hy: A lisp written in Python
hylang.org
- Hy is a multi-paradigm general-purpose programming language in the Lisp family, inspired by Clojure and written in Python. You can use it to pipeline Chalice λ functions together (functional programming), achieving lambda-based programming that is as effortless as Bash pipelines on the Linux command line. You can mix Hy and Python in the same file.
- Toolz: A set of utility functions for iterators, functions, and dictionaries
GitHub
- Toolz is a python module that allows you to import functional programming primitives, going beyond Python's built-in map-reduce-filter idioms.
- AWS Limit Checker
GitHub
- Python code for automatically detecting when you are about to run up against AWS limits.
Tooling for Writing Chalice Code
- Lucidchart
lucid.app
- Lucid allows you to hand-craft AWS Solutions Architecture diagrams. They have the 2017 and 2019 AWS icon packs by default.
- CloudMoji™
cloudmoji.com
- CloudMoji has the 2021 icon packs for AWS, Azure and GCP, and enables you to use them with Lucidchart.
- AWS Toolkit for PyCharm
aws.amazon.com
- Amazon has thrown its weight behind the PyCharm IDE with this AWS Toolkit, which enables you to seamlessly switch between accounts, to use a proxy, and other features, from inside the PyCharm editor. There is also the AWS Toolkit for VSCode, IntelliJ IDEA, Eclipse and JetBrains.
- Anaconda Python Distribution.
anaconda.com
- Anaconda provides a consistent Python development environment. You can use Anaconda on AWS Lambda if you mount an EFS filesystem that has it, or if you use a container image for your Lambda functions. This is not yet tightly integrated with Chalice, however, it works very well for local development.
Blog Posts and Feature Releases
02-2021
Amplify Flutter is Now Generally Available: Build Beautiful Cross-Platform AppsAWS Blog
02-2021
Using container images to run PyTorch models in AWS LambdaAWS Blog
01-2021
AWS Chalice adds support for the AWS CDKAWS Blog
12-2020
Packaging AWS Lambda functions as container imagesA Cloud Guru
12-2020
New for AWS Lambda – 1ms Billing Granularity Adds Cost SavingsAWS Blog
12-2020
Implementing version control using Amazon DynamoDBAWS Blog
- Includes code on
GitHub
: Amazon DynamoDB Design Patterns
- Includes code on
11-2020
Introducing Middleware Stack in Modular AWS SDK for JavaScriptaws.amazon.com
10-2020
Qt for Python 6 releasedqt.io
10-2020
How do I give internet access to a Lambda function that's connected to an Amazon VPC?aws.amazon.com
10-2020
AWS Lambda Extensions: What are they and why do they matterLumigo
- Extensions allow you to monitor your Lambda functions, such as CPU and network utilization.
10-2020
AWS Chalice now supports Amazon Kinesis and Amazon DynamoDB StreamsAWS Blog
- By integrating Chalice with DynamoDB streams, you can create sophisticated business logic using DynamoDB's ablity to trigger lambda functions based on events.
09-2020
Using AWS Lambda Layers with AWS ChaliceAWS Blog
- With automatic lambda layers, you don't have to wait for your large lambda layer to upload every time you deploy your application.
08-2020
Following serverless best practices with AWS Chalice and Lambda PowertoolsAWS Blog
- Allows you to ie trace with AWS X-Ray, and to create middleware - code that is called before, during and after each lambda invocation.
08-2020
Automatically deploy a Serverless REST API from GitHub with AWS ChaliceAWS Blog
07-2020
Creating low-latency, high-volume APIs with Provisioned ConcurrencyGitHub
- Chalice does not yet support Provisioned Concurrency out of the box, but it plans to.
GitHub
- Chalice does not yet support Provisioned Concurrency out of the box, but it plans to.
07-2020
Configuring custom domain names with AWS ChaliceAWS Blog
06-2020
AWS Chalice Now Supports YAML TemplatesAWS Blog
- Allows you to deploy Chalice using the AWS Serverless Application model, for integration with CloudFormation.
06-2020
AWS Solutions Constructs – A Library of Architecture Patterns for the AWS CDKAWS Blog
06-2020
Using Amazon EFS for AWS Lambda in your serverless applicationsAWS Blog
- A building block for mounting an Elastic File System with Chalice, which should be combined with CDK support.
05-2020
Introducing the AWS Chalice test clientAWS Blog
04-2020
Use Amazon DynamoDB Accelerator (DAX) from AWS Lambda to increase performance while reducing costsGitHub
02-2020
Painless AWS Chalice Application DebugMedium
03-2019
Modularizing a Chalice Application for TeamsMedium
- How to leverage the
chalicelib
directory to enable a team of developers to work on Chalice.
- How to leverage the
05-2019
Getting started with the AWS Cloud Development Kit and Python03-2019
Run your Python Scripts as Slack Commands (ChatOps)Medium
12-2018
Building Serverless Python Apps Using AWS ChaliceReal Python Blog
Built on Chalice
current
Coworks Microframework- Coworks is a complete microservices framework for Chalice that utilizes AWS Step Functions for implementing business logic, as an alternative to DynamoDB event triggers.
current
Agave: REST API for Chalice BluePrintscurrent
aws-chalice-swagger: AWS Chalice template project with Swagger UIGitHub
- Chalice comes with Swagger support, this project shows you how to use it.
01-2021
Lambda Multi-threading in ChaliceGitHub
- Lambda functions can have up to 6 vCPU cores and 10GB RAM, this simple example shows how to use a map/reduce across cores in Chalice.
12-2020
chalice-cicd-app: Deploy Chalice using AWS CodeStar via the AWS CDKGitHub
11-2020
aws-chalice-boilerplateGitHub
- Among other things, demonstrates how to use
chalice.cli.CLIFactory
.
- Among other things, demonstrates how to use
11-2020
chalice_dockerized: How to deploy Chalice with docker-composeGitHub
11-2020
Chalice-GraphQL: Adds Facebook's GraphQL support to your Chalice application11-2020
Chalice + LocalStack08-2020
chalice-extended-action: Automated deployment of your Chalice application via GitHub ActionsGitHub
06-2020
pytest-chalice: A set of py.test fixtures for AWS Chalice02-2020
chalice-cognito-auth: A library for setting up login routes in a Chalice app- Connect Chalice to a Cognito user pool for single-sign on (SSO).
10-2019
Domovoi - Extension to Chalice that supports Automatic Load BalancingGitHub
01-2019
Damn Vulnerable Functions as a ServiceGitHub
- Example insecure FaaS repository built on Chalice
Miscellaneous Awesomeness
Stack Overflow
10-2020
Using APISpec to enable using Swagger with Chalice09-2020
AWS IAM Policy required for AWS Chalice07-2020
Calling a Lambda from a Lambda in Chalice without going through API Gateway again
Chalice Documentation
- How to create pure Lambda functions in Chalice
- Continuous Deployment with Chalice
- Chalice has support for dev/stage/prod out-of-the-box, in addition to CodeBuild, CodeDeploy and CodePipeline.
- Configuration File
- By setting
api_gateway_endpoint_type
you can deploy into a VPC.
- By setting
Paid Tracing
- sentry-python: application monitoring platform to diagnose, fix, and optimize code performance
GitHub
- Lumigo Python agent for distributed tracing and performance monitoring
GitHub
- IOpipe Analytics & Distributed Tracing Agent for Python
GitHub
Videos
01-2021
PySide6, Qt Quick, Material Design, VS Code And Python 3.9.1 - Tutorial Modern GUI - Part 110-2020
Building your first REST API with AWS’s Open Data Sets and Chalice - Christian WeberYouTube
09-2020
AWS Chalice Hands-On Walkthrough, a Python Serverless Microframework for AWSYouTube
08-2020
AWS Chalice - Walkthrough of the Media Query Sample Application04-2019
Udemy Online Course - AWS Chalice: Build Serverless REST APIs on AWSUdemy
Support
- chalice.dev Slack channel
chalice.dev
- cdk.dev Slack channel
cdk.dev
Misc
- AWS Nuke
GitHub
- Steampipe
steampipe.io
- Steampipe allows you to query your AWS infrastructure, IAM policies, etc., using SQL.
- Click
PalletsProjects
- You can pair Flask's Click project to decorate your Chalice apps so as to have a CLI.
- AWS CDK Patterns
GitHub