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:

    1. $ 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:

    1. ___ _ _ _ _ ___ ___ ___
    2. / __|| || | /_\ | | |_ _|/ __|| __|
    3. | (__ | __ | / _ \ | |__ | || (__ | _|
    4. \___||_||_|/_/ \_\|____||___|\___||___|
    5. The python serverless microframework for AWS allows
    6. Amazon API Gateway and AWS Lambda.
    7. Please enter the project name
    8. [?] Enter the project name: localstack-test
    9. [?] Select your project type: REST API
    10. > REST API
    11. S3 Event Handler
    12. Lambda Functions only
    13. Legacy REST API Template
    14. [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 :

    1. $ chalice-local local
    2. 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:

    1. $ chalice-local deploy
    2. Creating deployment package.
    3. Creating IAM role: localstack-test-dev
    4. Creating lambda function: localstack-test-dev
    5. Creating Rest API
    6. Resources deployed:
    7. - Lambda ARN: arn:aws:lambda:us-east-1:000000000000:function:localstack-test-dev