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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠