0

I'm writing serverless apps in python and deploy use chalice, lambda, aws

Just a quick question: I would like to limit the number of the item returned from the API.

Maximum 1000 items per day

Maximum 200 items per hour

Here is sample API:

@app.route('/items', authorizer=authorizer)
def get_items():
    params = app.current_request.query_params
    tickets = AvaiableItem(params).get()
    return { 'items': items.serialize() }

How can I config the limit number?

Mazh N.
  • 1
  • 1

1 Answers1

0

Chalice does not have any builtin support for API throttling yet, but you can monitor the GitHub issue Add support for throttling per route.

In the interim, you can manually configure throttling via the AWS Console as described in Throttle API Requests for Better Throughput. You could of course also do this via boto3 if desired.

dmulter
  • 2,608
  • 3
  • 15
  • 24