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 Risposta
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
con risposta 2 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande