{"id":13424828,"url":"https://github.com/aws/chalice","last_synced_at":"2025-05-13T10:56:03.490Z","repository":{"id":37396529,"uuid":"59868262","full_name":"aws/chalice","owner":"aws","description":"Python Serverless Microframework for AWS","archived":false,"fork":false,"pushed_at":"2025-04-30T21:52:08.000Z","size":9642,"stargazers_count":10839,"open_issues_count":487,"forks_count":1004,"subscribers_count":236,"default_branch":"master","last_synced_at":"2025-05-05T20:45:53.398Z","etag":null,"topics":["aws","aws-apigateway","aws-lambda","cloud","lambda","python","python27","python3","serverless","serverless-framework"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aws.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.rst","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-05-27T23:27:13.000Z","updated_at":"2025-05-05T06:19:10.000Z","dependencies_parsed_at":"2023-12-15T17:31:24.177Z","dependency_job_id":"cceeef29-da6b-41ab-9a18-17a3068aa199","html_url":"https://github.com/aws/chalice","commit_stats":{"total_commits":1779,"total_committers":204,"mean_commits":8.720588235294118,"dds":"0.38448566610455315","last_synced_commit":"83d195d62f9e01d1d8ce3cff06e1fd76bc1c052e"},"previous_names":["awslabs/chalice"],"tags_count":94,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Fchalice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Fchalice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Fchalice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Fchalice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aws","download_url":"https://codeload.github.com/aws/chalice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253773923,"owners_count":21962195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-apigateway","aws-lambda","cloud","lambda","python","python27","python3","serverless","serverless-framework"],"created_at":"2024-07-31T00:00:59.897Z","updated_at":"2025-05-13T10:56:03.434Z","avatar_url":"https://github.com/aws.png","language":"Python","readme":"===========\nAWS Chalice\n===========\n\n.. image:: https://badges.gitter.im/awslabs/chalice.svg\n   :target: https://gitter.im/awslabs/chalice?utm_source=badge\u0026utm_medium=badge\n   :alt: Gitter\n.. image:: https://readthedocs.org/projects/chalice/badge/?version=latest\n   :target: http://aws.github.io/chalice/?badge=latest\n   :alt: Documentation Status\n\n\n.. image:: https://aws.github.io/chalice/_images/chalice-logo-whitespace.png\n   :target: https://aws.github.io/chalice/\n   :alt: Chalice Logo\n\n\nChalice is a framework for writing serverless apps in python. It allows\nyou to quickly create and deploy applications that use AWS Lambda.  It provides:\n\n* A command line tool for creating, deploying, and managing your app\n* A decorator based API for integrating with Amazon API Gateway, Amazon S3,\n  Amazon SNS, Amazon SQS, and other AWS services.\n* Automatic IAM policy generation\n\n\nYou can create Rest APIs:\n\n.. code-block:: python\n\n    from chalice import Chalice\n\n    app = Chalice(app_name=\"helloworld\")\n\n    @app.route(\"/\")\n    def index():\n        return {\"hello\": \"world\"}\n\nTasks that run on a periodic basis:\n\n.. code-block:: python\n\n    from chalice import Chalice, Rate\n\n    app = Chalice(app_name=\"helloworld\")\n\n    # Automatically runs every 5 minutes\n    @app.schedule(Rate(5, unit=Rate.MINUTES))\n    def periodic_task(event):\n        return {\"hello\": \"world\"}\n\n\nYou can connect a lambda function to an S3 event:\n\n.. code-block:: python\n\n    from chalice import Chalice\n\n    app = Chalice(app_name=\"helloworld\")\n\n    # Whenever an object is uploaded to 'mybucket'\n    # this lambda function will be invoked.\n\n    @app.on_s3_event(bucket='mybucket')\n    def handler(event):\n        print(\"Object uploaded for bucket: %s, key: %s\"\n              % (event.bucket, event.key))\n\nAs well as an SQS queue:\n\n.. code-block:: python\n\n    from chalice import Chalice\n\n    app = Chalice(app_name=\"helloworld\")\n\n    # Invoke this lambda function whenever a message\n    # is sent to the ``my-queue-name`` SQS queue.\n\n    @app.on_sqs_message(queue='my-queue-name')\n    def handler(event):\n        for record in event:\n            print(\"Message body: %s\" % record.body)\n\n\nAnd several other AWS resources.\n\nOnce you've written your code, you just run ``chalice deploy``\nand Chalice takes care of deploying your app.\n\n::\n\n    $ chalice deploy\n    ...\n    https://endpoint/dev\n\n    $ curl https://endpoint/api\n    {\"hello\": \"world\"}\n\nUp and running in less than 30 seconds.\nGive this project a try and share your feedback with us here on Github.\n\nThe documentation is available\n`here \u003chttp://aws.github.io/chalice/\u003e`__.\n\nQuickstart\n==========\n\n.. quick-start-begin\n\nIn this tutorial, you'll use the ``chalice`` command line utility\nto create and deploy a basic REST API.  This quickstart uses Python 3.7,\nbut AWS Chalice supports all versions of python supported by AWS Lambda,\nwhich includes Python 3.7 through python 3.12.\n\nTo install Chalice, we'll first create and activate a virtual environment\nin python3.7::\n\n    $ python3 --version\n    Python 3.7.3\n    $ python3 -m venv venv37\n    $ . venv37/bin/activate\n\nNext we'll install Chalice using ``pip``::\n\n    $ python3 -m pip install chalice\n\nYou can verify you have chalice installed by running::\n\n    $ chalice --help\n    Usage: chalice [OPTIONS] COMMAND [ARGS]...\n    ...\n\n\nCredentials\n-----------\n\nBefore you can deploy an application, be sure you have\ncredentials configured.  If you have previously configured your\nmachine to run boto3 (the AWS SDK for Python) or the AWS CLI then\nyou can skip this section.\n\nIf this is your first time configuring credentials for AWS you\ncan follow these steps to quickly get started::\n\n    $ mkdir ~/.aws\n    $ cat \u003e\u003e ~/.aws/config\n    [default]\n    aws_access_key_id=YOUR_ACCESS_KEY_HERE\n    aws_secret_access_key=YOUR_SECRET_ACCESS_KEY\n    region=YOUR_REGION (such as us-west-2, us-west-1, etc)\n\nIf you want more information on all the supported methods for\nconfiguring credentials, see the\n`boto3 docs\n\u003chttp://boto3.readthedocs.io/en/latest/guide/configuration.html\u003e`__.\n\n\nCreating Your Project\n---------------------\n\nThe next thing we'll do is use the ``chalice`` command to create a new\nproject::\n\n    $ chalice new-project helloworld\n\nThis will create a ``helloworld`` directory.  Cd into this\ndirectory.  You'll see several files have been created for you::\n\n    $ cd helloworld\n    $ ls -la\n    drwxr-xr-x   .chalice\n    -rw-r--r--   app.py\n    -rw-r--r--   requirements.txt\n\nYou can ignore the ``.chalice`` directory for now, the two main files\nwe'll focus on is ``app.py`` and ``requirements.txt``.\n\nLet's take a look at the ``app.py`` file:\n\n.. code-block:: python\n\n    from chalice import Chalice\n\n    app = Chalice(app_name='helloworld')\n\n\n    @app.route('/')\n    def index():\n        return {'hello': 'world'}\n\n\nThe ``new-project`` command created a sample app that defines a\nsingle view, ``/``, that when called will return the JSON body\n``{\"hello\": \"world\"}``.\n\n\nDeploying\n---------\n\nLet's deploy this app.  Make sure you're in the ``helloworld``\ndirectory and run ``chalice deploy``::\n\n    $ chalice deploy\n    Creating deployment package.\n    Creating IAM role: helloworld-dev\n    Creating lambda function: helloworld-dev\n    Creating Rest API\n    Resources deployed:\n      - Lambda ARN: arn:aws:lambda:us-west-2:12345:function:helloworld-dev\n      - Rest API URL: https://abcd.execute-api.us-west-2.amazonaws.com/api/\n\nYou now have an API up and running using API Gateway and Lambda::\n\n    $ curl https://qxea58oupc.execute-api.us-west-2.amazonaws.com/api/\n    {\"hello\": \"world\"}\n\nTry making a change to the returned dictionary from the ``index()``\nfunction.  You can then redeploy your changes by running ``chalice deploy``.\n\n.. quick-start-end\n\nNext Steps\n----------\n\nYou've now created your first app using ``chalice``.  You can make\nmodifications to your ``app.py`` file and rerun ``chalice deploy`` to\nredeploy your changes.\n\nAt this point, there are several next steps you can take.\n\n* `Tutorials \u003chttps://aws.github.io/chalice/tutorials/index.html\u003e`__\n  - Choose from among several guided tutorials that will\n  give you step-by-step examples of various features of Chalice.\n* `Topics \u003chttps://aws.github.io/chalice/topics/index.html\u003e`__ - Deep\n  dive into documentation on specific areas of Chalice.\n  This contains more detailed documentation than the tutorials.\n* `API Reference \u003chttps://aws.github.io/chalice/api.html\u003e`__ - Low level\n  reference documentation on all the classes and methods that are part of the\n  public API of Chalice.\n\nIf you're done experimenting with Chalice and you'd like to cleanup, you can\nuse the ``chalice delete`` command, and Chalice will delete all the resources\nit created when running the ``chalice deploy`` command.\n\n::\n\n    $ chalice delete\n    Deleting Rest API: abcd4kwyl4\n    Deleting function aws:arn:lambda:region:123456789:helloworld-dev\n    Deleting IAM Role helloworld-dev\n\n\nFeedback\n========\n\nWe'd also love to hear from you.  Please create any Github issues for\nadditional features you'd like to see over at\nhttps://github.com/aws/chalice/issues.  You can also chat with us\non gitter: https://gitter.im/awslabs/chalice\n","funding_links":[],"categories":["Hosting","Python","Python Frameworks and Tools","General Frameworks","Serverless","Python Frameworks, Libraries, and Tools","Other Awesome Lists","Serverless 🦋","后端开发框架及项目","Frameworks \u0026 CLIs","Tools","Python Learning Resources","Amazon Web Services","Third-Party Extensions","DevOps Tools"],"sub_categories":["Serverless","In-memory data grids","Non-CloudSec Stuff (TODO: move this elsewhere)","Interfaces","管理面板","E-Books","VS Code Extensions for Developer Productivity","Objective-C Tools, Libraries, and Frameworks","viii. Linear Regression","Mesh networks","JavaScript Libraries for Machine Learning","Hosting"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws%2Fchalice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faws%2Fchalice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws%2Fchalice/lists"}