Search code examples
javaamazon-web-servicesaws-lambdaaws-sam-cli

How do I set the ARN for a AWS SAM Local Lambda function?


I would like to set the ARN for my java lambda function that I run locally with SAM Local in Eclipse.

In my Junit-Test I can do this by setting it with context.setInvokedFunctionArn but how can I do this if I run this as SAM Local? I am guessing I do this in the serverless.template, but I couldn't find how to do this exactly.

Best regards!


Solution

  • SAM local is using lambci/docker-lambda project under the hood, which allows specifying function ARN using AWS_LAMBDA_FUNCTION_INVOKED_ARN enviroment variable, client/invoke logic for java