amazon-web-servicesaws-api-gatewayaws-api-gateway-v2

AWS API Gateway limit beyond 29 seconds - not being respected?


As a follow up to How can I set the AWS API Gateway timeout higher than 30 seconds?, I've successfully increased my account-level service-quota timeout for this region to 120,000 ms beyond the 29,000 ms default (designed to handle a downstream LLM call via bedrock).

I have the following cloudformation template snippet to which I've added the increased timeout.

However, the gateway is still timing out with a 504 at 29 seconds according to my front-end client!

Is the update not being respected, or propagating? Is it a regional issue? HTTP vs REST type?

Please assist, thanks!

  MyApiMethod:
    Type: AWS::ApiGateway::Method
    Properties:
      HttpMethod: "POST"
      ResourceId: !Ref MyApiResource
      RestApiId: !Ref MyApi
      AuthorizationType: "NONE"
      Integration:
        Type: "AWS_PROXY"
        IntegrationHttpMethod: "POST"
        Uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${PrimaryLambdaFunction.Arn}/invocations"
        TimeoutInMillis: 120000  # Increased from default of 29 secs via account-level service quota increase
      MethodResponses:
        - StatusCode: '200'  # Update to match the expected success status
          ResponseParameters:
            method.response.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
            method.response.header.Access-Control-Allow-Methods: "'POST,OPTIONS'"
            method.response.header.Access-Control-Allow-Origin: "'*'"

Solution

  • I had to set the protocol to REGIONAL in the cloudformation template to make this work.

      MyApi:
        Type: AWS::ApiGateway::RestApi
        Properties:
          Name: "MyApp"
          EndpointConfiguration:
            Types:
              - REGIONAL
    

    With thanks to @derpirscher for the guidance and inspiration!