- Newest
- Most votes
- Most comments
Hello there,
you can accomplish this using stage variables. After deploying your HTTP API, go to one of the stages, edit, and go down to Stage variables.
Add a key (i.e. lambda_function_version) and as value, the version number of the lambda function you prefer.
Go to the Integration details of your API endpoint and in the Integration target section, use the ARN of the lambda function with the variable you setup previously:
arn:aws:lambda:us-east-1:xxxxxxxxxxxx:function:MyDearLambdaFunction:${stageVariables.lambda_function_version}
Repeat the process for other stages of your API.
Remember that Stage variables don't support cross-account Lambda functions.
Here's the documentation with more details. Hope this helps.
Sadly this does not work anymore. Whenever you put a stageVariable into integration target (if integration type is "Lambda function") it fails with "1 validation error detected: Value <arn> at 'functionName' failed to satisfy constraint: Member must satisfy regular expression pattern: <regex>"
Relevant content
- asked 2 years ago
- asked a year ago
- Accepted Answerasked 8 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
Thank you very much! Do you confirm that none of the above is (yet) doable using CDK2? Not even the part where I can set the stage variable in the Route Integration?
This does not work anymore. It's shown "AWS ARN for integration must contain path or action" on UI. May be a bug? Please help.