Invoke Lambda Locally from Local Lambda
up vote
0
down vote
favorite
I am trying to invoke a lambda function locally that invokes another lambda function, also local.
I am using sam local start-lambda -t notificationServiceTemplate.yml --docker-network lambda-local --host 0.0.0.0
I then start my consumer lambda, that invokes the worker lambda,
aws lambda invoke --function-name ImportUsageConsumerLambda --endpoint-url http://127.0.0.1:3001
The consumer lambda function makes the invoke call using these parameters,
if (process.env.STACK_ENVIRONMENT == "local" ) {
options.endpoint = "http://0.0.0.0:3001/";
options.sslEnabled = false;
}
lambda = new AWS.Lambda(options);
It doesn't work because the lambda container cannot access localhost in outside the container, UnknownEndpoint: Inaccessible host: '0.0.0.0'. This service may not be available in the 'us-west-2' region.n
.
I understand using the endpoint 0.0.0.0:3001
will not work because that is where the start-lambda
setups the lambda endpoint that is accessible to my host and not the same network as within the lambda docker container.
I've managed to get connected to a dynamodb docker container following this question and answer here.
Is there a simple way to do this that I am missing?
Like a hostname of the lambda container that I can call from inside the lambda container, i.e. options.endpoint = "http://lambda:3001/";
?
docker aws-lambda docker-compose docker-networking aws-sam-local
add a comment |
up vote
0
down vote
favorite
I am trying to invoke a lambda function locally that invokes another lambda function, also local.
I am using sam local start-lambda -t notificationServiceTemplate.yml --docker-network lambda-local --host 0.0.0.0
I then start my consumer lambda, that invokes the worker lambda,
aws lambda invoke --function-name ImportUsageConsumerLambda --endpoint-url http://127.0.0.1:3001
The consumer lambda function makes the invoke call using these parameters,
if (process.env.STACK_ENVIRONMENT == "local" ) {
options.endpoint = "http://0.0.0.0:3001/";
options.sslEnabled = false;
}
lambda = new AWS.Lambda(options);
It doesn't work because the lambda container cannot access localhost in outside the container, UnknownEndpoint: Inaccessible host: '0.0.0.0'. This service may not be available in the 'us-west-2' region.n
.
I understand using the endpoint 0.0.0.0:3001
will not work because that is where the start-lambda
setups the lambda endpoint that is accessible to my host and not the same network as within the lambda docker container.
I've managed to get connected to a dynamodb docker container following this question and answer here.
Is there a simple way to do this that I am missing?
Like a hostname of the lambda container that I can call from inside the lambda container, i.e. options.endpoint = "http://lambda:3001/";
?
docker aws-lambda docker-compose docker-networking aws-sam-local
localhost is not 0.0.0.0, it's 127.0.0.1. It's not clear why you are using 127.0.0.1 as the endpoint in one place but not the other.
– Michael - sqlbot
Nov 11 at 1:37
Thanks, that is true. I was using 127.0.0.1 in all places, but in my vain attempts to connect the two I tried using host 0.0.0.0
– natemacinnes
Nov 11 at 1:43
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to invoke a lambda function locally that invokes another lambda function, also local.
I am using sam local start-lambda -t notificationServiceTemplate.yml --docker-network lambda-local --host 0.0.0.0
I then start my consumer lambda, that invokes the worker lambda,
aws lambda invoke --function-name ImportUsageConsumerLambda --endpoint-url http://127.0.0.1:3001
The consumer lambda function makes the invoke call using these parameters,
if (process.env.STACK_ENVIRONMENT == "local" ) {
options.endpoint = "http://0.0.0.0:3001/";
options.sslEnabled = false;
}
lambda = new AWS.Lambda(options);
It doesn't work because the lambda container cannot access localhost in outside the container, UnknownEndpoint: Inaccessible host: '0.0.0.0'. This service may not be available in the 'us-west-2' region.n
.
I understand using the endpoint 0.0.0.0:3001
will not work because that is where the start-lambda
setups the lambda endpoint that is accessible to my host and not the same network as within the lambda docker container.
I've managed to get connected to a dynamodb docker container following this question and answer here.
Is there a simple way to do this that I am missing?
Like a hostname of the lambda container that I can call from inside the lambda container, i.e. options.endpoint = "http://lambda:3001/";
?
docker aws-lambda docker-compose docker-networking aws-sam-local
I am trying to invoke a lambda function locally that invokes another lambda function, also local.
I am using sam local start-lambda -t notificationServiceTemplate.yml --docker-network lambda-local --host 0.0.0.0
I then start my consumer lambda, that invokes the worker lambda,
aws lambda invoke --function-name ImportUsageConsumerLambda --endpoint-url http://127.0.0.1:3001
The consumer lambda function makes the invoke call using these parameters,
if (process.env.STACK_ENVIRONMENT == "local" ) {
options.endpoint = "http://0.0.0.0:3001/";
options.sslEnabled = false;
}
lambda = new AWS.Lambda(options);
It doesn't work because the lambda container cannot access localhost in outside the container, UnknownEndpoint: Inaccessible host: '0.0.0.0'. This service may not be available in the 'us-west-2' region.n
.
I understand using the endpoint 0.0.0.0:3001
will not work because that is where the start-lambda
setups the lambda endpoint that is accessible to my host and not the same network as within the lambda docker container.
I've managed to get connected to a dynamodb docker container following this question and answer here.
Is there a simple way to do this that I am missing?
Like a hostname of the lambda container that I can call from inside the lambda container, i.e. options.endpoint = "http://lambda:3001/";
?
docker aws-lambda docker-compose docker-networking aws-sam-local
docker aws-lambda docker-compose docker-networking aws-sam-local
asked Nov 10 at 22:25
natemacinnes
3526
3526
localhost is not 0.0.0.0, it's 127.0.0.1. It's not clear why you are using 127.0.0.1 as the endpoint in one place but not the other.
– Michael - sqlbot
Nov 11 at 1:37
Thanks, that is true. I was using 127.0.0.1 in all places, but in my vain attempts to connect the two I tried using host 0.0.0.0
– natemacinnes
Nov 11 at 1:43
add a comment |
localhost is not 0.0.0.0, it's 127.0.0.1. It's not clear why you are using 127.0.0.1 as the endpoint in one place but not the other.
– Michael - sqlbot
Nov 11 at 1:37
Thanks, that is true. I was using 127.0.0.1 in all places, but in my vain attempts to connect the two I tried using host 0.0.0.0
– natemacinnes
Nov 11 at 1:43
localhost is not 0.0.0.0, it's 127.0.0.1. It's not clear why you are using 127.0.0.1 as the endpoint in one place but not the other.
– Michael - sqlbot
Nov 11 at 1:37
localhost is not 0.0.0.0, it's 127.0.0.1. It's not clear why you are using 127.0.0.1 as the endpoint in one place but not the other.
– Michael - sqlbot
Nov 11 at 1:37
Thanks, that is true. I was using 127.0.0.1 in all places, but in my vain attempts to connect the two I tried using host 0.0.0.0
– natemacinnes
Nov 11 at 1:43
Thanks, that is true. I was using 127.0.0.1 in all places, but in my vain attempts to connect the two I tried using host 0.0.0.0
– natemacinnes
Nov 11 at 1:43
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244027%2finvoke-lambda-locally-from-local-lambda%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
localhost is not 0.0.0.0, it's 127.0.0.1. It's not clear why you are using 127.0.0.1 as the endpoint in one place but not the other.
– Michael - sqlbot
Nov 11 at 1:37
Thanks, that is true. I was using 127.0.0.1 in all places, but in my vain attempts to connect the two I tried using host 0.0.0.0
– natemacinnes
Nov 11 at 1:43