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 Resposta
2
Resposta aceita

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
ESPECIALISTA
Uri
respondido há 2 anos
  • 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.

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas