Route Based throttling in a stage for HTTP endpoint of API Gateway via Cloudformation

0

I am trying to create a route Based throttling rule for my HTTP Endpoint in API Gateway. I can't seem to find the field that would let me define throttling rules for a stage in my cloudformation template.

I tried using AWS::ApiGatewayV2::Stage RouteSettings but that perform stage wide throttle, doesnt let me perform route wise throttle. Any tips on how do i solve this?

  • Have you specified a routeKey for the route you want to throttle? Can you maybe add an anonymized snippet?

  • This is the snippet for creating stage where i only see throttling option

      Stage2:
        Type: 'AWS::ApiGatewayV2::Stage'
        Properties:
          ApiId: !Ref ApiGateway
          AutoDeploy: true
          StageName: stageName
          DefaultRouteSettings:
            ThrottlingBurstLimit: 10
            ThrottlingRateLimit: 10      
        DependsOn:
          - Route1
          - Route2
          - Route3  
    

    Consider the mentioned Route1,2,3 and ApiGateway exists and is correctly configured

1 個回答
0

For HTTP API Gateways, you can specify more granular throttling via the RouteSettings Property (slightly different from the DefaultRouteSettings): https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-routesettings.

For example, https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-throttling.html shows the throttling at the Get /Pets endpoint. That should do the trick for what you are trying to do! And you can also use the DefaultRouteSettings like you have above. I'm not sure if this can be done via CloudFormation - it looks like AWS API supports it at least.

If you ever use REST APIs, check out usage plans: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html

jsonc
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南