chocolate cake
chocolate cake

Reputation: 2479

Run lambda function with localstack

I try to run my lambda function with localstack. I installed awscli-local and localstack

pip3 install awscli-local

pip3 install --user localstack --ignore-installed six

And then I started localstack

LAMDBA_EXECUTOR=docker localstack start --docker

When I now want to create my lambda function

aws lambda create-function --function-name Test --zip-file fileb://myLambda.zip --handler index.handler --runtime 'nodejs6.10' --endpoint http://localhost:4574 --role admin

I get this error

An error occurred (ResourceConflictException) when calling the CreateFunction operation: Function already exist: Test

Listing the functions returns nothing

aws lambda list-functions --endpoint http://localhost:4574

Does someone know why localstack thinks that the function is already there?

Upvotes: 3

Views: 6278

Answers (2)

Fred Hart
Fred Hart

Reputation: 21

I'm also seeing this issue. Though it does not happen each time I try to create a lambda in localstack. What I have noticed is that lambda create seems to take a rather long time and cause a lot of CPU consumption on my mac while it is creating the lambda. My initial guess is that because of the time being take to create the ambda, something is timing out during the lambda creation and it's as if the creation is retried internally and it finds the lambda exits. If I query for the lambda after receiving this error message with awslocal, I see it exists.

I am running this on a MBP with 32Gb of memory and upped the allocation of resources to the Docker engine to 16Gb and 8 processors in hopes of solving this with additional resources, but that has not seemed to help. Suggestions welcome.

Upvotes: -1

WallMobile
WallMobile

Reputation: 1959

You can invoke lambdas directly in localstack from the Commandeer App. It installs localstack under the hood with docker.

enter image description here

There is a button on the lambda detail that allows you to specify the payload and then view the cloudwatch logs.

enter image description here

Upvotes: 0

Related Questions