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 réponse
2
Réponse acceptée

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
répondu il y a 2 ans
  • 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.

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions