Programmatically invoke a specific endpoint of a webservice hosted on AWS Lambda
I have a multi-endpoint webservice written in Flask and running on API Gateway and Lambda thanks to Zappa.
I have a second, very tiny, lambda, written in Node, that periodically hits one of the webservice endpoints. I do this by configuring the little lambda to have Internet access then use Node's https.request
with these options:
const options = {
hostname: 'XXXXXXXXXX.execute-api.us-east-1.amazonaws.com',
port: 443,
path: '/path/to/my/endpoint',
method: 'POST',
headers: {
'Authorization': `Bearer ${s3cretN0tSt0r3d1nTheC0de}`,
}
};
and this works beautifully. But now I am wondering whether I should instead make the little lambda invoke the API endpoint directly using the AWS SDK. I have seen other S.O. questions on invoking lambdas from lambdas but I did not see any examples where the target lambda was a multi-endpoint webservice. All the examples I found used new AWS.Lambda({...})
and then called invokeFunction
with params.
Is there a way to pass, say, an event to the target lambda which contained the path of the specific endpoint I want to call? (and the auth headers, etc.) * * * * OR * * * * is this just a really dumb idea, given that I have working code already? My thinking is that a direct SDK lambda invocation might (is this true?) bypass API Gateway and be cheaper, BUT, hitting the endpoint directly via API Gateway is better for logging. And since the periodic lambda runs once a day, it's probably free anyway.
If what I have now is best, that's a fine answer. A lambda invocation answer would be cool too, since I've not been able to find a good example in which the target lambda had multiple https endpoints.
amazon-web-services aws-lambda
add a comment |
I have a multi-endpoint webservice written in Flask and running on API Gateway and Lambda thanks to Zappa.
I have a second, very tiny, lambda, written in Node, that periodically hits one of the webservice endpoints. I do this by configuring the little lambda to have Internet access then use Node's https.request
with these options:
const options = {
hostname: 'XXXXXXXXXX.execute-api.us-east-1.amazonaws.com',
port: 443,
path: '/path/to/my/endpoint',
method: 'POST',
headers: {
'Authorization': `Bearer ${s3cretN0tSt0r3d1nTheC0de}`,
}
};
and this works beautifully. But now I am wondering whether I should instead make the little lambda invoke the API endpoint directly using the AWS SDK. I have seen other S.O. questions on invoking lambdas from lambdas but I did not see any examples where the target lambda was a multi-endpoint webservice. All the examples I found used new AWS.Lambda({...})
and then called invokeFunction
with params.
Is there a way to pass, say, an event to the target lambda which contained the path of the specific endpoint I want to call? (and the auth headers, etc.) * * * * OR * * * * is this just a really dumb idea, given that I have working code already? My thinking is that a direct SDK lambda invocation might (is this true?) bypass API Gateway and be cheaper, BUT, hitting the endpoint directly via API Gateway is better for logging. And since the periodic lambda runs once a day, it's probably free anyway.
If what I have now is best, that's a fine answer. A lambda invocation answer would be cool too, since I've not been able to find a good example in which the target lambda had multiple https endpoints.
amazon-web-services aws-lambda
What is the purpose of your periodic Lambda? Is it simply for reducing cold starts or is there some business purpose for it (such as cron tasks)?
– dashmug
Dec 28 '18 at 0:11
It's a cron.... one of the endpoints does a little analytic computation. Yes the "little lambda doing the cron thing" could have had access to the (Aurora) database, but the way it is now, the API is the sole thing sitting in front of the database for now.
– Ray Toal
Dec 28 '18 at 5:23
add a comment |
I have a multi-endpoint webservice written in Flask and running on API Gateway and Lambda thanks to Zappa.
I have a second, very tiny, lambda, written in Node, that periodically hits one of the webservice endpoints. I do this by configuring the little lambda to have Internet access then use Node's https.request
with these options:
const options = {
hostname: 'XXXXXXXXXX.execute-api.us-east-1.amazonaws.com',
port: 443,
path: '/path/to/my/endpoint',
method: 'POST',
headers: {
'Authorization': `Bearer ${s3cretN0tSt0r3d1nTheC0de}`,
}
};
and this works beautifully. But now I am wondering whether I should instead make the little lambda invoke the API endpoint directly using the AWS SDK. I have seen other S.O. questions on invoking lambdas from lambdas but I did not see any examples where the target lambda was a multi-endpoint webservice. All the examples I found used new AWS.Lambda({...})
and then called invokeFunction
with params.
Is there a way to pass, say, an event to the target lambda which contained the path of the specific endpoint I want to call? (and the auth headers, etc.) * * * * OR * * * * is this just a really dumb idea, given that I have working code already? My thinking is that a direct SDK lambda invocation might (is this true?) bypass API Gateway and be cheaper, BUT, hitting the endpoint directly via API Gateway is better for logging. And since the periodic lambda runs once a day, it's probably free anyway.
If what I have now is best, that's a fine answer. A lambda invocation answer would be cool too, since I've not been able to find a good example in which the target lambda had multiple https endpoints.
amazon-web-services aws-lambda
I have a multi-endpoint webservice written in Flask and running on API Gateway and Lambda thanks to Zappa.
I have a second, very tiny, lambda, written in Node, that periodically hits one of the webservice endpoints. I do this by configuring the little lambda to have Internet access then use Node's https.request
with these options:
const options = {
hostname: 'XXXXXXXXXX.execute-api.us-east-1.amazonaws.com',
port: 443,
path: '/path/to/my/endpoint',
method: 'POST',
headers: {
'Authorization': `Bearer ${s3cretN0tSt0r3d1nTheC0de}`,
}
};
and this works beautifully. But now I am wondering whether I should instead make the little lambda invoke the API endpoint directly using the AWS SDK. I have seen other S.O. questions on invoking lambdas from lambdas but I did not see any examples where the target lambda was a multi-endpoint webservice. All the examples I found used new AWS.Lambda({...})
and then called invokeFunction
with params.
Is there a way to pass, say, an event to the target lambda which contained the path of the specific endpoint I want to call? (and the auth headers, etc.) * * * * OR * * * * is this just a really dumb idea, given that I have working code already? My thinking is that a direct SDK lambda invocation might (is this true?) bypass API Gateway and be cheaper, BUT, hitting the endpoint directly via API Gateway is better for logging. And since the periodic lambda runs once a day, it's probably free anyway.
If what I have now is best, that's a fine answer. A lambda invocation answer would be cool too, since I've not been able to find a good example in which the target lambda had multiple https endpoints.
amazon-web-services aws-lambda
amazon-web-services aws-lambda
asked Dec 27 '18 at 20:16
Ray Toal
65.5k10121179
65.5k10121179
What is the purpose of your periodic Lambda? Is it simply for reducing cold starts or is there some business purpose for it (such as cron tasks)?
– dashmug
Dec 28 '18 at 0:11
It's a cron.... one of the endpoints does a little analytic computation. Yes the "little lambda doing the cron thing" could have had access to the (Aurora) database, but the way it is now, the API is the sole thing sitting in front of the database for now.
– Ray Toal
Dec 28 '18 at 5:23
add a comment |
What is the purpose of your periodic Lambda? Is it simply for reducing cold starts or is there some business purpose for it (such as cron tasks)?
– dashmug
Dec 28 '18 at 0:11
It's a cron.... one of the endpoints does a little analytic computation. Yes the "little lambda doing the cron thing" could have had access to the (Aurora) database, but the way it is now, the API is the sole thing sitting in front of the database for now.
– Ray Toal
Dec 28 '18 at 5:23
What is the purpose of your periodic Lambda? Is it simply for reducing cold starts or is there some business purpose for it (such as cron tasks)?
– dashmug
Dec 28 '18 at 0:11
What is the purpose of your periodic Lambda? Is it simply for reducing cold starts or is there some business purpose for it (such as cron tasks)?
– dashmug
Dec 28 '18 at 0:11
It's a cron.... one of the endpoints does a little analytic computation. Yes the "little lambda doing the cron thing" could have had access to the (Aurora) database, but the way it is now, the API is the sole thing sitting in front of the database for now.
– Ray Toal
Dec 28 '18 at 5:23
It's a cron.... one of the endpoints does a little analytic computation. Yes the "little lambda doing the cron thing" could have had access to the (Aurora) database, but the way it is now, the API is the sole thing sitting in front of the database for now.
– Ray Toal
Dec 28 '18 at 5:23
add a comment |
1 Answer
1
active
oldest
votes
You can invoke the Lambda function directly using the invoke method in AWS SDK.
var params = {
ClientContext: "MyApp",
FunctionName: "MyFunction",
InvocationType: "Event",
LogType: "Tail",
Payload: <Binary String>,
Qualifier: "1"
};
lambda.invoke(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
/*
data = {
FunctionError: "",
LogResult: "",
Payload: <Binary String>,
StatusCode: 123
}
*/
});
Refer the AWS JavaScript SDK lambda.invoke method for more details.
Thanks. I'm well aware of that documentation page, but what I don't know is where to put the/path/to/my/endpoint
in the invocation. Nothing on that page seems to indicate how this is done. What am I missing?
– Ray Toal
Dec 29 '18 at 7:35
What are you referring as endpoint? Are you referring to API Gateway endpoint?
– Ashan
Dec 29 '18 at 7:39
Well I wrote a Flask app with 30 "endpoints" or whatever you call them. I used Zappa to push the Flask app up to AWS as a single lambda function. I want to make an HTTPS request to just one of those 30 endpoints. I realize API Gateway has its own notion of endpoint. But I mean endpoint as in one of the things in a classic REST API. This seems like such a simple thing to do, yet I'm flustered by not seeing any example anywhere, which leads me to believe that what I am trying to do is stupid, and I should leave well enough alone and go with what I already have, which is working.
– Ray Toal
Dec 29 '18 at 8:28
To elaborate. My lambda is a flask app atXXXXXXXXXX.execute-api.us-east-1.amazonaws.com
. As a webservice, it exposes things likePOST /things
,GET /things
,GET /things/{id}
,DELETE /things/{id}
,POST /dailyreport/things
. My question: How do I do a lambda invocation that makes an HTTPS POST call to ONLY thePOST /dailyreport/things
"endpoint." I understand that "endpoint" might not be the right word in AWS-speak, but I was wondering if the AWS SDK can do this. This lambda does not look like a "single function" that is easy to hit with lambda invoke. Or is it???
– Ray Toal
Dec 29 '18 at 8:32
It seems like you have already created an API Gateway mapping. The URL xxxx.execute-api.us.... is an API Gateway URL. You won't need any SDK to connect the Lambda function. Check your API Gateway configurations in API Gateway section in AWS Web Console.
– Ashan
Dec 29 '18 at 22:57
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f53950399%2fprogrammatically-invoke-a-specific-endpoint-of-a-webservice-hosted-on-aws-lambda%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can invoke the Lambda function directly using the invoke method in AWS SDK.
var params = {
ClientContext: "MyApp",
FunctionName: "MyFunction",
InvocationType: "Event",
LogType: "Tail",
Payload: <Binary String>,
Qualifier: "1"
};
lambda.invoke(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
/*
data = {
FunctionError: "",
LogResult: "",
Payload: <Binary String>,
StatusCode: 123
}
*/
});
Refer the AWS JavaScript SDK lambda.invoke method for more details.
Thanks. I'm well aware of that documentation page, but what I don't know is where to put the/path/to/my/endpoint
in the invocation. Nothing on that page seems to indicate how this is done. What am I missing?
– Ray Toal
Dec 29 '18 at 7:35
What are you referring as endpoint? Are you referring to API Gateway endpoint?
– Ashan
Dec 29 '18 at 7:39
Well I wrote a Flask app with 30 "endpoints" or whatever you call them. I used Zappa to push the Flask app up to AWS as a single lambda function. I want to make an HTTPS request to just one of those 30 endpoints. I realize API Gateway has its own notion of endpoint. But I mean endpoint as in one of the things in a classic REST API. This seems like such a simple thing to do, yet I'm flustered by not seeing any example anywhere, which leads me to believe that what I am trying to do is stupid, and I should leave well enough alone and go with what I already have, which is working.
– Ray Toal
Dec 29 '18 at 8:28
To elaborate. My lambda is a flask app atXXXXXXXXXX.execute-api.us-east-1.amazonaws.com
. As a webservice, it exposes things likePOST /things
,GET /things
,GET /things/{id}
,DELETE /things/{id}
,POST /dailyreport/things
. My question: How do I do a lambda invocation that makes an HTTPS POST call to ONLY thePOST /dailyreport/things
"endpoint." I understand that "endpoint" might not be the right word in AWS-speak, but I was wondering if the AWS SDK can do this. This lambda does not look like a "single function" that is easy to hit with lambda invoke. Or is it???
– Ray Toal
Dec 29 '18 at 8:32
It seems like you have already created an API Gateway mapping. The URL xxxx.execute-api.us.... is an API Gateway URL. You won't need any SDK to connect the Lambda function. Check your API Gateway configurations in API Gateway section in AWS Web Console.
– Ashan
Dec 29 '18 at 22:57
add a comment |
You can invoke the Lambda function directly using the invoke method in AWS SDK.
var params = {
ClientContext: "MyApp",
FunctionName: "MyFunction",
InvocationType: "Event",
LogType: "Tail",
Payload: <Binary String>,
Qualifier: "1"
};
lambda.invoke(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
/*
data = {
FunctionError: "",
LogResult: "",
Payload: <Binary String>,
StatusCode: 123
}
*/
});
Refer the AWS JavaScript SDK lambda.invoke method for more details.
Thanks. I'm well aware of that documentation page, but what I don't know is where to put the/path/to/my/endpoint
in the invocation. Nothing on that page seems to indicate how this is done. What am I missing?
– Ray Toal
Dec 29 '18 at 7:35
What are you referring as endpoint? Are you referring to API Gateway endpoint?
– Ashan
Dec 29 '18 at 7:39
Well I wrote a Flask app with 30 "endpoints" or whatever you call them. I used Zappa to push the Flask app up to AWS as a single lambda function. I want to make an HTTPS request to just one of those 30 endpoints. I realize API Gateway has its own notion of endpoint. But I mean endpoint as in one of the things in a classic REST API. This seems like such a simple thing to do, yet I'm flustered by not seeing any example anywhere, which leads me to believe that what I am trying to do is stupid, and I should leave well enough alone and go with what I already have, which is working.
– Ray Toal
Dec 29 '18 at 8:28
To elaborate. My lambda is a flask app atXXXXXXXXXX.execute-api.us-east-1.amazonaws.com
. As a webservice, it exposes things likePOST /things
,GET /things
,GET /things/{id}
,DELETE /things/{id}
,POST /dailyreport/things
. My question: How do I do a lambda invocation that makes an HTTPS POST call to ONLY thePOST /dailyreport/things
"endpoint." I understand that "endpoint" might not be the right word in AWS-speak, but I was wondering if the AWS SDK can do this. This lambda does not look like a "single function" that is easy to hit with lambda invoke. Or is it???
– Ray Toal
Dec 29 '18 at 8:32
It seems like you have already created an API Gateway mapping. The URL xxxx.execute-api.us.... is an API Gateway URL. You won't need any SDK to connect the Lambda function. Check your API Gateway configurations in API Gateway section in AWS Web Console.
– Ashan
Dec 29 '18 at 22:57
add a comment |
You can invoke the Lambda function directly using the invoke method in AWS SDK.
var params = {
ClientContext: "MyApp",
FunctionName: "MyFunction",
InvocationType: "Event",
LogType: "Tail",
Payload: <Binary String>,
Qualifier: "1"
};
lambda.invoke(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
/*
data = {
FunctionError: "",
LogResult: "",
Payload: <Binary String>,
StatusCode: 123
}
*/
});
Refer the AWS JavaScript SDK lambda.invoke method for more details.
You can invoke the Lambda function directly using the invoke method in AWS SDK.
var params = {
ClientContext: "MyApp",
FunctionName: "MyFunction",
InvocationType: "Event",
LogType: "Tail",
Payload: <Binary String>,
Qualifier: "1"
};
lambda.invoke(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
/*
data = {
FunctionError: "",
LogResult: "",
Payload: <Binary String>,
StatusCode: 123
}
*/
});
Refer the AWS JavaScript SDK lambda.invoke method for more details.
answered Dec 28 '18 at 11:25
Ashan
10.1k21734
10.1k21734
Thanks. I'm well aware of that documentation page, but what I don't know is where to put the/path/to/my/endpoint
in the invocation. Nothing on that page seems to indicate how this is done. What am I missing?
– Ray Toal
Dec 29 '18 at 7:35
What are you referring as endpoint? Are you referring to API Gateway endpoint?
– Ashan
Dec 29 '18 at 7:39
Well I wrote a Flask app with 30 "endpoints" or whatever you call them. I used Zappa to push the Flask app up to AWS as a single lambda function. I want to make an HTTPS request to just one of those 30 endpoints. I realize API Gateway has its own notion of endpoint. But I mean endpoint as in one of the things in a classic REST API. This seems like such a simple thing to do, yet I'm flustered by not seeing any example anywhere, which leads me to believe that what I am trying to do is stupid, and I should leave well enough alone and go with what I already have, which is working.
– Ray Toal
Dec 29 '18 at 8:28
To elaborate. My lambda is a flask app atXXXXXXXXXX.execute-api.us-east-1.amazonaws.com
. As a webservice, it exposes things likePOST /things
,GET /things
,GET /things/{id}
,DELETE /things/{id}
,POST /dailyreport/things
. My question: How do I do a lambda invocation that makes an HTTPS POST call to ONLY thePOST /dailyreport/things
"endpoint." I understand that "endpoint" might not be the right word in AWS-speak, but I was wondering if the AWS SDK can do this. This lambda does not look like a "single function" that is easy to hit with lambda invoke. Or is it???
– Ray Toal
Dec 29 '18 at 8:32
It seems like you have already created an API Gateway mapping. The URL xxxx.execute-api.us.... is an API Gateway URL. You won't need any SDK to connect the Lambda function. Check your API Gateway configurations in API Gateway section in AWS Web Console.
– Ashan
Dec 29 '18 at 22:57
add a comment |
Thanks. I'm well aware of that documentation page, but what I don't know is where to put the/path/to/my/endpoint
in the invocation. Nothing on that page seems to indicate how this is done. What am I missing?
– Ray Toal
Dec 29 '18 at 7:35
What are you referring as endpoint? Are you referring to API Gateway endpoint?
– Ashan
Dec 29 '18 at 7:39
Well I wrote a Flask app with 30 "endpoints" or whatever you call them. I used Zappa to push the Flask app up to AWS as a single lambda function. I want to make an HTTPS request to just one of those 30 endpoints. I realize API Gateway has its own notion of endpoint. But I mean endpoint as in one of the things in a classic REST API. This seems like such a simple thing to do, yet I'm flustered by not seeing any example anywhere, which leads me to believe that what I am trying to do is stupid, and I should leave well enough alone and go with what I already have, which is working.
– Ray Toal
Dec 29 '18 at 8:28
To elaborate. My lambda is a flask app atXXXXXXXXXX.execute-api.us-east-1.amazonaws.com
. As a webservice, it exposes things likePOST /things
,GET /things
,GET /things/{id}
,DELETE /things/{id}
,POST /dailyreport/things
. My question: How do I do a lambda invocation that makes an HTTPS POST call to ONLY thePOST /dailyreport/things
"endpoint." I understand that "endpoint" might not be the right word in AWS-speak, but I was wondering if the AWS SDK can do this. This lambda does not look like a "single function" that is easy to hit with lambda invoke. Or is it???
– Ray Toal
Dec 29 '18 at 8:32
It seems like you have already created an API Gateway mapping. The URL xxxx.execute-api.us.... is an API Gateway URL. You won't need any SDK to connect the Lambda function. Check your API Gateway configurations in API Gateway section in AWS Web Console.
– Ashan
Dec 29 '18 at 22:57
Thanks. I'm well aware of that documentation page, but what I don't know is where to put the
/path/to/my/endpoint
in the invocation. Nothing on that page seems to indicate how this is done. What am I missing?– Ray Toal
Dec 29 '18 at 7:35
Thanks. I'm well aware of that documentation page, but what I don't know is where to put the
/path/to/my/endpoint
in the invocation. Nothing on that page seems to indicate how this is done. What am I missing?– Ray Toal
Dec 29 '18 at 7:35
What are you referring as endpoint? Are you referring to API Gateway endpoint?
– Ashan
Dec 29 '18 at 7:39
What are you referring as endpoint? Are you referring to API Gateway endpoint?
– Ashan
Dec 29 '18 at 7:39
Well I wrote a Flask app with 30 "endpoints" or whatever you call them. I used Zappa to push the Flask app up to AWS as a single lambda function. I want to make an HTTPS request to just one of those 30 endpoints. I realize API Gateway has its own notion of endpoint. But I mean endpoint as in one of the things in a classic REST API. This seems like such a simple thing to do, yet I'm flustered by not seeing any example anywhere, which leads me to believe that what I am trying to do is stupid, and I should leave well enough alone and go with what I already have, which is working.
– Ray Toal
Dec 29 '18 at 8:28
Well I wrote a Flask app with 30 "endpoints" or whatever you call them. I used Zappa to push the Flask app up to AWS as a single lambda function. I want to make an HTTPS request to just one of those 30 endpoints. I realize API Gateway has its own notion of endpoint. But I mean endpoint as in one of the things in a classic REST API. This seems like such a simple thing to do, yet I'm flustered by not seeing any example anywhere, which leads me to believe that what I am trying to do is stupid, and I should leave well enough alone and go with what I already have, which is working.
– Ray Toal
Dec 29 '18 at 8:28
To elaborate. My lambda is a flask app at
XXXXXXXXXX.execute-api.us-east-1.amazonaws.com
. As a webservice, it exposes things like POST /things
, GET /things
, GET /things/{id}
, DELETE /things/{id}
, POST /dailyreport/things
. My question: How do I do a lambda invocation that makes an HTTPS POST call to ONLY the POST /dailyreport/things
"endpoint." I understand that "endpoint" might not be the right word in AWS-speak, but I was wondering if the AWS SDK can do this. This lambda does not look like a "single function" that is easy to hit with lambda invoke. Or is it???– Ray Toal
Dec 29 '18 at 8:32
To elaborate. My lambda is a flask app at
XXXXXXXXXX.execute-api.us-east-1.amazonaws.com
. As a webservice, it exposes things like POST /things
, GET /things
, GET /things/{id}
, DELETE /things/{id}
, POST /dailyreport/things
. My question: How do I do a lambda invocation that makes an HTTPS POST call to ONLY the POST /dailyreport/things
"endpoint." I understand that "endpoint" might not be the right word in AWS-speak, but I was wondering if the AWS SDK can do this. This lambda does not look like a "single function" that is easy to hit with lambda invoke. Or is it???– Ray Toal
Dec 29 '18 at 8:32
It seems like you have already created an API Gateway mapping. The URL xxxx.execute-api.us.... is an API Gateway URL. You won't need any SDK to connect the Lambda function. Check your API Gateway configurations in API Gateway section in AWS Web Console.
– Ashan
Dec 29 '18 at 22:57
It seems like you have already created an API Gateway mapping. The URL xxxx.execute-api.us.... is an API Gateway URL. You won't need any SDK to connect the Lambda function. Check your API Gateway configurations in API Gateway section in AWS Web Console.
– Ashan
Dec 29 '18 at 22:57
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f53950399%2fprogrammatically-invoke-a-specific-endpoint-of-a-webservice-hosted-on-aws-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
What is the purpose of your periodic Lambda? Is it simply for reducing cold starts or is there some business purpose for it (such as cron tasks)?
– dashmug
Dec 28 '18 at 0:11
It's a cron.... one of the endpoints does a little analytic computation. Yes the "little lambda doing the cron thing" could have had access to the (Aurora) database, but the way it is now, the API is the sole thing sitting in front of the database for now.
– Ray Toal
Dec 28 '18 at 5:23