I would like to use a serverless application model (sam.yml) file to deploy two AWS lambda functions with api gateway integration. My file looks like this:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: "Client Service"
Resources:
PetStoreServerFunction:
Type: AWS::Serverless::Function
Properties:
Handler: server.LambdaHandler::handleRequest
Runtime: java8
CodeUri: petstore-server/target/petstore-server-1.0-SNAPSHOT.jar
MemorySize: 512
Policies:
- AWSLambdaBasicExecutionRole
Timeout: 20
Events:
GetResource:
Type: Api
Properties:
Path: /server/{proxy+}
Method: any
PetStoreClientFunction:
Type: AWS::Serverless::Function
Properties:
Handler: client.LambdaHandler::handleRequest
Runtime: java8
CodeUri: petstore-client/target/petstore-client-1.0-SNAPSHOT.jar
MemorySize: 512
Policies:
- AWSLambdaBasicExecutionRole
Timeout: 20
Events:
GetResource:
Type: Api
Properties:
Path: /client/{proxy+}
Method: any
Within the lambda web console, I can see both functions created, yet I can only call one of them via the API Gateway. For the other I get {"message":"Gateway timeout"}
.
Any ideas? What is the best way to describe two function deployments within a single serverless application model?
I have seen this example: https://github.com/awslabs/serverless-application-model/blob/master/examples/2016-10-31/api_backend/template.yaml
Yet this creates two lambda functions from the same source code. This is not what I am trying to achieve. I would like to create two lambda functions from different deployments within a single sam.yml file.
.yaml
and the example.yaml
are the timeout keys. The example does not use them. Have you tried removing them? - Nicholas Martinez