Note: Copied over from https://bitbucket.org/atlassian/localstack/issues/59/how-do-i-use-localstack-for-net-core
NOT A BUG
I'm new to localstack and I did not know where to ask questions like this as I could not find any forum for localstack.
I'm facing difficulties in deploying my application developed in [.Net Core] using Visual Studio on localstack.
I'm trying to execute the samples provided with Visual Studio(Blogs and Hello) for learning.
Could you guys please provide me with the steps to execute my application on localstack?
Following are the details : 1). Runtime : dotnetcore1.0 2). OS : Windows 3). Application uses API Gateway which invokes lambda function developed in C# using .Net Core 1.0.
Can you please give some feedback here?
After some testing I was able to do it.
Steps were,
version: '2.1'
services:
localstack:
image: localstack/localstack:latest
container_name: localstack
hostname: localstack
ports:
- "4567-4583:4567-4583"
- "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}"
environment:
- SERVICES=${SERVICES- }
- DEBUG=${DEBUG- }
- DATA_DIR=${DATA_DIR- }
- PORT_WEB_UI=${PORT_WEB_UI- }
- LAMBDA_EXECUTOR=docker
- KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
- y=unix:///var/run/docker.sock
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /tmp/localstack:/tmp/localstack
Then I've used the zip file in https://github.com/localstack/localstack/blob/master/tests/integration/lambdas/dotnetcore2/dotnetcore2.zip (which is in the local stack repo)
After docker spins up I've run the following commands:
aws --endpoint-url=http://192.168.3.100:4574 lambda create-function --function-name=f1 --runtime=dotnetcore2.0 --role=r1 --handler=DotNetCore2::DotNetCore2.Lambda.Function::SimpleFunctionHandler --zip-file fileb://dotnetcore2.zip
aws lambda --endpoint-url=http://192.168.3.100:4574 invoke --function-name f1 result.log
Notes: My docker image was running under 192.168.3.100 ip (which is an Unix VM with docker, that's why the endpoint-url parameter value)
And it worked.
Closing this for housekeeping reasons. This should be resolved in the meantime. Please comment here if the problem persists. Thanks
Most helpful comment
Can you please give some feedback here?
After some testing I was able to do it.
Steps were,
version: '2.1'
services:
localstack:
image: localstack/localstack:latest
container_name: localstack
hostname: localstack
ports:
- "4567-4583:4567-4583"
- "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}"
environment:
- SERVICES=${SERVICES- }
- DEBUG=${DEBUG- }
- DATA_DIR=${DATA_DIR- }
- PORT_WEB_UI=${PORT_WEB_UI- }
- LAMBDA_EXECUTOR=docker
- KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
- y=unix:///var/run/docker.sock
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /tmp/localstack:/tmp/localstack
Then I've used the zip file in https://github.com/localstack/localstack/blob/master/tests/integration/lambdas/dotnetcore2/dotnetcore2.zip (which is in the local stack repo)
After docker spins up I've run the following commands:
aws --endpoint-url=http://192.168.3.100:4574 lambda create-function --function-name=f1 --runtime=dotnetcore2.0 --role=r1 --handler=DotNetCore2::DotNetCore2.Lambda.Function::SimpleFunctionHandler --zip-file fileb://dotnetcore2.zip
aws lambda --endpoint-url=http://192.168.3.100:4574 invoke --function-name f1 result.log
Notes: My docker image was running under 192.168.3.100 ip (which is an Unix VM with docker, that's why the endpoint-url parameter value)
And it worked.