# APIGateWay Method Integration With Lambda

**URL:** <https://forum.serverless.com/t/apigateway-method-integration-with-lambda/2862>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [October 11, 2017, 8:06pm UTC](https://forum.serverless.com/t/apigateway-method-integration-with-lambda/2862 "2017-10-11T20:06:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ross](https://avatars.discourse-cdn.com/v4/letter/r/e274bd/32.png) [@Ross](https://forum.serverless.com/u/Ross)\
**Post date:** [October 11, 2017, 8:06pm UTC](https://forum.serverless.com/t/apigateway-method-integration-with-lambda/2862/1 "2017-10-11T20:06:45Z")

</div>

With “AWS::ApiGateway::Method” , we can define a RestAPI + Method as below:

```
functions:
  getToken:
    handler: index.getToken
resources:
  Resources:
    RestApi:
      Type: AWS::ApiGateway::RestApi
      Properties:
        Name: ARestService
        Description: "A Token API"

    RestApiMethod: 
      Type: "AWS::ApiGateway::Method"
      Properties: 
        RestApiId: 
          Ref: "RestApi"
        ResourceId: 
          Fn::GetAtt: 
            - "RestApi"
            - "RootResourceId"
        HttpMethod: "POST"
        AuthorizationType: "NONE"
        Integration:
          IntegrationHttpMethod: POST
          Type: HTTP
          Uri: "www.xxxx.com/getToken"
          IntegrationResponses:
            - StatusCode: 200
.....

```

And for the method integration, found there is NO Support for Lambda type but others like HTTP.  
is it a way to set type as lambda and uri as lambda uri or better with getAttr fn from defined function above , like below

```
Integration:
  IntegrationHttpMethod: POST
  Type: LAMBDA
  Uri: "ref: getToken" # getToken function was defined first
  IntegrationResponses:
    - StatusCode: 200

```

I know this may be done by events - http structure, but feel the Method Integration is a better place ( supposedly)
