AWS Chalice
AWS Chalice is a serverless micro framework used to develop and deploy your serverless applications on AWS resources. Chalice provides integrated functionality with most of the AWS Toolings like S3 Storage, Simple Queue Service, API Gateway and more. It offers a handy CLI interface that allows you to easily create, develop & deploy your serverless applications.
LocalStack offers an that allows you to interact with your Chalice applications locally. Using LocalStack, you can kick-start your development process, create a new Chalice application, and test it application locally.
Start LocalStack inside a Docker container by running:
$ pip install chalice-local
You can now create a new Chalice project by running:
You will be prompted with an interactive menu where you can choose the name of your project and the project type. In this example, we are using localstack-test
as the project name and REST API
as the project type:
___ _ _ _ _ ___ ___ ___
/ __|| || | /_\ | | |_ _|/ __|| __|
| (__ | __ | / _ \ | |__ | || (__ | _|
\___||_||_|/_/ \_\|____||___|\___||___|
The python serverless microframework for AWS allows
Amazon API Gateway and AWS Lambda.
Please enter the project name
[?] Enter the project name: localstack-test
[?] Select your project type: REST API
> REST API
S3 Event Handler
Lambda Functions only
Legacy REST API Template
[CDK] Rest API with a DynamoDB table
Let’s take a look inside the project structure:
Just as with AWS, you can now test your API using :
$ chalice-local local
Serving on http://127.0.0.1:8000
You can also do a curl
to test the API:
You can use chalice-local deploy
to deploy the REST API now:
$ chalice-local deploy
Creating deployment package.
Creating IAM role: localstack-test-dev
Creating lambda function: localstack-test-dev
Creating Rest API
Resources deployed:
- Lambda ARN: arn:aws:lambda:us-east-1:000000000000:function:localstack-test-dev