ThrottleSettings

class aws_cdk.aws_apigateway.ThrottleSettings(*, burst_limit=None, rate_limit=None)

Bases: object

Container for defining throttling parameters to API stages or methods.

Parameters:
  • burst_limit (Union[int, float, None]) – The maximum API request rate limit over a time ranging from one to a few seconds. Default: none

  • rate_limit (Union[int, float, None]) – The API request steady-state rate limit (average requests per second over an extended period of time). Default: none

Link:

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html

ExampleMetadata:

infused

Example:

# integration: apigateway.LambdaIntegration


api = apigateway.RestApi(self, "hello-api")

v1 = api.root.add_resource("v1")
echo = v1.add_resource("echo")
echo_method = echo.add_method("GET", integration, api_key_required=True)

plan = api.add_usage_plan("UsagePlan",
    name="Easy",
    throttle=apigateway.ThrottleSettings(
        rate_limit=10,
        burst_limit=2
    )
)

key = api.add_api_key("ApiKey")
plan.add_api_key(key)

Attributes

burst_limit

The maximum API request rate limit over a time ranging from one to a few seconds.

Default:

none

rate_limit

The API request steady-state rate limit (average requests per second over an extended period of time).

Default:

none