AWS Chalice: Quick Start
In this post, I am going to use Chalice to deploy a sample application on AWS API Gateway and Lambda.
What is Chalice?
Chalice is an AWS framework for writing serverless applications in
Python. https://aws.github.io/chalice/quickstart.html
Similar technologies include SAM. See https://aws.github.io/chalice/faq.html for more detail.
Install
% python3 -m pip install chalice
Note: you need to have aws credentials set. See https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html
Create Project
% chalice new-project helloworldYour project has been generated in ./helloworld% cd helloworld% tree -a.├── .chalice│ └── config.json├── .gitignore├── app.py└── requirements.txt
Run Locally
% chalice local
Serving on http://127.0.0.1:8000
% curl http://127.0.0.1:8000
{"hello":"world"}
Deploy & Cleanup
% chalice deploy
...
Rest API URL: https://xxxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/api/
% curl https://xxxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/api/
{"hello":"world"}
% chalice delete
Comments
Post a Comment