HTTP API - Invoke lambda alias

0

There is a lot of information about how to invoke a lambda alias with the was REST API, but the same procedure does not work for the HTTP API.

The aws documentation suggests that you can reference lambda function aliases with it's full arn, which makes sense except the lambda selection will not accept a full arn.

I have also given the API access to the lambda with the following CLI command (account number replaced with xx):

aws lambda add-permission --function-name "arn:aws:lambda:eu-central-1:xxxxxxxxxxxx:function:devops-demo:development" --source-arn "arn:aws:execute-api:eu-central-1:xxxxxxxxxxxx:cqu0317x92///devops-demo" --principal apigateway.amazonaws.com --statement-id 256d766f-41b1-4207-83f1-7ada60de637b --action lambda:InvokeFunction

How can I invoke a lambda with alias from an HTTP API (not the REST API)?

1 Answer
2
Accepted Answer

Use the following format, it works for me:

arn:aws:lambda:<region>:<account>:function:<function name>:<alias>, e.g., arn:aws:lambda:eu-west-1:123456789:function:my_function:my_alias

The UI says it can't find it, but you are able to save.

profile pictureAWS
EXPERT
Uri
answered 2 years ago
  • Thank you. Hearing that this worked for you gave me enough support to work out the answer. This format does indeed work, and when giving permission you must reference the endpoint with the full resource path.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions