AWS CloudFormation: API Gateway File Size Exceeded

252 views Asked by At

I have my OpenAPI spec stored in s3 and I am currently currently using the template shown below in my CloudFormation code:

  RestAPI:
    Type: AWS::ApiGateway::RestApi
    Condition: NeedsRestApi
    DependsOn: [A, B]
    Properties:
      EndpointConfiguration:
        Types:
          - REGIONAL
      Body:
        Fn::Transform:
          Name: AWS::Include
          Parameters:
            Location:
              Fn::Sub: s3://${bucket}/${env}/application/temp-service/api_gateway.yaml

When I try to deploy it in CloudFormation, it complains about the Api Gateway size being larger than AWS:Include supports (450 KB):

Transform AWS::Include failed with: The specified S3 object is too big.

I also tried using BodyS3LocationApproach without using AWS::Include:

      BodyS3Location:
        Bucket:
          Fn::Sub: ${bucket}
        Key:
          Fn::Sub: ${env}/application/temp-service/api_gateway.yaml

However, the above approach generates an error since my api_gateway.yaml content has some dynamic values which will be populated on the fly in CloudFormation:

Resource handler returned message: "Invalid OpenAPI input. (Service: ApiGateway,

Can you please suggest correct and alternative way of loading my big api_gateway file into CloudFormation template and create the RESTAPI resource and deploy respective rest api(s) the AWS api-gateway?

0

There are 0 answers