Created
September 18, 2021 02:34
-
-
Save yeisoncruz16/b55137cc07119e9c8d547405761e65a8 to your computer and use it in GitHub Desktop.
Trigger lambda function using AWS Elastic load balance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: sample-lambda-alb | |
provider: | |
name: aws | |
runtime: nodejs14.x | |
stage: ${opt:stage, 'dev'} | |
region: ${opt:region, 'us-west-2'} | |
profile: crazy | |
alb: | |
targetGroupPrefix: tg-${opt:stage, 'dev'}- # this is the name for the target group | |
custom: | |
alb: # If you are using the same ALB ARN you must set uniq priority | |
priority: | |
prod: 1 | |
dev: 2 | |
functions: | |
validate-user: | |
description: "Example lambda using elastic load balance" | |
handler: handler.producer | |
name: sample-lambda-alb-${opt:stage, 'dev'} | |
timeout: 900 # This is set to 15min | |
memorySize: 128 | |
events: | |
- alb: | |
listenerArn: ALB_LISTENER_ARN | |
priority: ${self:custom.alb.priority.${opt:stage, self:provider.stage}} | |
method: GET | |
conditions: | |
path: /validate-user/${opt:stage, 'dev'} # enable both url /validate-user/dev and /validate-user/dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You will need to create an
ALB
typeapplication
and also create a listener without target, after that just copy the ARN and replace ir forALB_LISTENER_ARN