We’re trying to automatically add an alb trigger to one of our lambda functions. I’ve looked at this doc (https://www.serverless.com/framework/docs/providers/aws/events/alb/) as well as the source code for the serverless alb event, but haven’t managed to get things working. My understanding is that the alb event adds a rule to a preexisting alb and also creates the target group to be linked with the lambda. If I’m misunderstanding this please let me know, any advice is appreciated. In addition to this, it looks like only one http header value is expected. Our current rule checks multiple http headers and I wanted to confirm that I’m unable to do that with this alb event.
Here is my serverless.yml.
service:
name: pe
plugins:
- serverless-pseudo-parameters
package:
exclude:
- ".*/local/**"
provider:
name: aws
runtime: nodejs12.x
region: ${opt:region}
role: ${opt:lambdaRole}
deploymentBucket: ${opt:deploymentBucket}
functions:
queueEmailStatus:
handler: lambdas/queueEmailStatus.handler
events:
- alb:
listenerArn: ${opt:albListener}
priority: 10
conditions:
method:
- POST
path: /email-status-listener
header:
name: authorization
values:
- ${opt:basicAuth}
environment:
MQ_DESTINATION: ${opt:MQ_DESTINATION}
MQ_HOST: ${opt:MQ_HOST}
MQ_PASSWORD: ${opt:MQ_PASSWORD}
MQ_USERNAME: ${opt:MQ_USERNAME}
vpc:
securityGroupIds:
- ${opt:securityGroup}
subnetIds:
"Fn::Split":
- ","
- ${opt:privateSubnets}