I want to pass the API ID to the "customauthorizerFunc" Lambda function as an environment var. I'm passing other information but I don't know how to reference the API ID when using a Lambda Proxy Event in a serverless.yml config. Here's an example of what I'm working with:
provider:
name: aws
...
environment:
env: ${self:custom.stage}
region: ${aws:region}
awsid: ${aws:accountId}
servicename: ${self:custom.stage}-${self:service}
# RestApiId: !Ref ApiGatewayRestApi
functions:
mylambdafunction:
handler: MyLambdaFunction.lambda_handler
...
events:
- http:
path: /thing/{thing1}
method: get
...
integration: lambda-proxy
authorizer:
name: customauthorizerFunc
resultTtlInSeconds: 0
identitySource: method.request.header.Authorization
identityValidationExpression: NONE
type: token
customauthorizerFunc:
handler: CustomAuthorizer.lambda_handler
role: defaultrole
timeout: 5
memorySize: 128