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)?

preguntada hace 2 años872 visualizaciones
1 Respuesta
2
Respuesta aceptada

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
EXPERTO
Uri
respondido hace 2 años
  • 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.

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas