How to remove tickmark Use Lambda Proxy integration on aws api

1.5k views Asked by At

Iam using sam template for creating api+lambdas but i have an issue facing How to remove tickmark Use Lambda Proxy integration on using in sam template enter image description hereaws api ??????

1

There are 1 answers

0
Jackson On

You cannot do that with SAM because it's limited and they have chosen to keep it light and minimal (per my experience arguing with them at Github over additional features). What you can do is to mix the SAM with cloudformation types:

ApiGatewayRestApi:
  Type: AWS::ApiGateway::RestApi
  Properties:
    ApiKeySourceType: HEADER
    Description: An API Gateway with a Lambda Integration
    EndpointConfiguration:
      Types:
        - EDGE
    Name: lambda-api

ApiGatewayResource:
  Type: AWS::ApiGateway::Resource
  Properties:
    ParentId: !GetAtt ApiGatewayRestApi.RootResourceId
    PathPart: 'lambda'
    RestApiId: !Ref ApiGatewayRestApi

ApiGatewayMethod:
  Type: AWS::ApiGateway::Method
  Properties:
    ApiKeyRequired: false
    AuthorizationType: NONE
    HttpMethod: POST
    Integration:
      ConnectionType: INTERNET
      Credentials: !GetAtt ApiGatewayIamRole.Arn
      IntegrationHttpMethod: POST
      PassthroughBehavior: WHEN_NO_MATCH
      TimeoutInMillis: 29000
      Type: AWS
      Uri: !Sub 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunction.Arn}/invocations'
    OperationName: 'lambda'
    ResourceId: !Ref ApiGatewayResource
    RestApiId: !Ref ApiGatewayRestApi

Notice the integration type is set to AWS instead of AWS_PROXY. For more information about CFT types checkout documentation. Also important to note is that without proxying, you may need to provide model and req/res templates. Also SAM CLI local will not work with req/res templates.