Getting error while invoking API using AWS Lambda. (AWS Lambda + AWS API Gateway+ Postman)
I get an error while invoking the AWS SageMaker endpoint API from a Lambda function. When I call this using Postman, I am getting an error like:
{
"errorMessage": "module initialization error"
}
amazon-web-services aws-lambda amazon-sagemaker
add a comment |
I get an error while invoking the AWS SageMaker endpoint API from a Lambda function. When I call this using Postman, I am getting an error like:
{
"errorMessage": "module initialization error"
}
amazon-web-services aws-lambda amazon-sagemaker
this is what many of us have encountered and many questions are present on stackOverflow about it also - it would help if you share the URL of the exact API call with the data that you are sending to API gateway
– Akber Iqbal
Nov 22 '18 at 5:40
add a comment |
I get an error while invoking the AWS SageMaker endpoint API from a Lambda function. When I call this using Postman, I am getting an error like:
{
"errorMessage": "module initialization error"
}
amazon-web-services aws-lambda amazon-sagemaker
I get an error while invoking the AWS SageMaker endpoint API from a Lambda function. When I call this using Postman, I am getting an error like:
{
"errorMessage": "module initialization error"
}
amazon-web-services aws-lambda amazon-sagemaker
amazon-web-services aws-lambda amazon-sagemaker
edited Nov 23 '18 at 15:55
Praneeth Peiris
1,104726
1,104726
asked Nov 22 '18 at 5:31
Ashish JangirAshish Jangir
12
12
this is what many of us have encountered and many questions are present on stackOverflow about it also - it would help if you share the URL of the exact API call with the data that you are sending to API gateway
– Akber Iqbal
Nov 22 '18 at 5:40
add a comment |
this is what many of us have encountered and many questions are present on stackOverflow about it also - it would help if you share the URL of the exact API call with the data that you are sending to API gateway
– Akber Iqbal
Nov 22 '18 at 5:40
this is what many of us have encountered and many questions are present on stackOverflow about it also - it would help if you share the URL of the exact API call with the data that you are sending to API gateway
– Akber Iqbal
Nov 22 '18 at 5:40
this is what many of us have encountered and many questions are present on stackOverflow about it also - it would help if you share the URL of the exact API call with the data that you are sending to API gateway
– Akber Iqbal
Nov 22 '18 at 5:40
add a comment |
3 Answers
3
active
oldest
votes
Just to make it clear, you can't call SageMaker endpoints directly using PostMan (even if it is, it would not be straightforward).
You may need to use AWS SDK (i.e. boto) for that.
Ref : https://aws.amazon.com/blogs/machine-learning/call-an-amazon-sagemaker-model-endpoint-using-amazon-api-gateway-and-aws-lambda/
What I would suggest is to create a small HTTP server with Flask and use the AWS SDK (Boto) to call the endpoint. Then you can call your Flask endpoint using PostMan.
add a comment |
We recommend using AWS SDK to invoke your endpoint. AWS SDK clients handle the serialization for you as well as request signing, etc. It would be really hard to get it right manually with postman.
We have the SDK client available in many languages, including Java, Python, JS, etc.
https://docs.aws.amazon.com/sagemaker/latest/dg/API_runtime_InvokeEndpoint.html#API_runtime_InvokeEndpoint_SeeAlso
add a comment |
Next time please include more details in your question. eg. POST request data, Headers etc.
Anyways, to help you out in calling Sagemaker endpoint using Postman -
- In 'Authorization' tab, select type as 'AWS Signature'.
- Enter your Access and Secret key of the IAM user which has permission to Sagemaker resources.
- Enter the AWS region. eg.us-east-1
- Enter 'Service Name' as 'sagemaker'
- Select the right content type. Some ML algorithms only accept 'text/csv'.
- Select request type as 'POST'
- Enter the Sagemaker Invocation url. eg:'https://runtime.sagemaker.us-east-1.amazonaws.com/endpoints/xgboost-xxxx-xx-xx-xx-xx-xx-xxx/invocations'
Try it out and let me know if you have any issues.
Here is how your Postman should look -

@praneeth-peiris Have a look. You can call Sagemaker endpoint using Postman.
– Priyank Kapasi
Nov 26 '18 at 5:38
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%2f53424429%2fgetting-error-while-invoking-api-using-aws-lambda-aws-lambda-aws-api-gateway%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Just to make it clear, you can't call SageMaker endpoints directly using PostMan (even if it is, it would not be straightforward).
You may need to use AWS SDK (i.e. boto) for that.
Ref : https://aws.amazon.com/blogs/machine-learning/call-an-amazon-sagemaker-model-endpoint-using-amazon-api-gateway-and-aws-lambda/
What I would suggest is to create a small HTTP server with Flask and use the AWS SDK (Boto) to call the endpoint. Then you can call your Flask endpoint using PostMan.
add a comment |
Just to make it clear, you can't call SageMaker endpoints directly using PostMan (even if it is, it would not be straightforward).
You may need to use AWS SDK (i.e. boto) for that.
Ref : https://aws.amazon.com/blogs/machine-learning/call-an-amazon-sagemaker-model-endpoint-using-amazon-api-gateway-and-aws-lambda/
What I would suggest is to create a small HTTP server with Flask and use the AWS SDK (Boto) to call the endpoint. Then you can call your Flask endpoint using PostMan.
add a comment |
Just to make it clear, you can't call SageMaker endpoints directly using PostMan (even if it is, it would not be straightforward).
You may need to use AWS SDK (i.e. boto) for that.
Ref : https://aws.amazon.com/blogs/machine-learning/call-an-amazon-sagemaker-model-endpoint-using-amazon-api-gateway-and-aws-lambda/
What I would suggest is to create a small HTTP server with Flask and use the AWS SDK (Boto) to call the endpoint. Then you can call your Flask endpoint using PostMan.
Just to make it clear, you can't call SageMaker endpoints directly using PostMan (even if it is, it would not be straightforward).
You may need to use AWS SDK (i.e. boto) for that.
Ref : https://aws.amazon.com/blogs/machine-learning/call-an-amazon-sagemaker-model-endpoint-using-amazon-api-gateway-and-aws-lambda/
What I would suggest is to create a small HTTP server with Flask and use the AWS SDK (Boto) to call the endpoint. Then you can call your Flask endpoint using PostMan.
answered Nov 22 '18 at 17:13
Praneeth PeirisPraneeth Peiris
1,104726
1,104726
add a comment |
add a comment |
We recommend using AWS SDK to invoke your endpoint. AWS SDK clients handle the serialization for you as well as request signing, etc. It would be really hard to get it right manually with postman.
We have the SDK client available in many languages, including Java, Python, JS, etc.
https://docs.aws.amazon.com/sagemaker/latest/dg/API_runtime_InvokeEndpoint.html#API_runtime_InvokeEndpoint_SeeAlso
add a comment |
We recommend using AWS SDK to invoke your endpoint. AWS SDK clients handle the serialization for you as well as request signing, etc. It would be really hard to get it right manually with postman.
We have the SDK client available in many languages, including Java, Python, JS, etc.
https://docs.aws.amazon.com/sagemaker/latest/dg/API_runtime_InvokeEndpoint.html#API_runtime_InvokeEndpoint_SeeAlso
add a comment |
We recommend using AWS SDK to invoke your endpoint. AWS SDK clients handle the serialization for you as well as request signing, etc. It would be really hard to get it right manually with postman.
We have the SDK client available in many languages, including Java, Python, JS, etc.
https://docs.aws.amazon.com/sagemaker/latest/dg/API_runtime_InvokeEndpoint.html#API_runtime_InvokeEndpoint_SeeAlso
We recommend using AWS SDK to invoke your endpoint. AWS SDK clients handle the serialization for you as well as request signing, etc. It would be really hard to get it right manually with postman.
We have the SDK client available in many languages, including Java, Python, JS, etc.
https://docs.aws.amazon.com/sagemaker/latest/dg/API_runtime_InvokeEndpoint.html#API_runtime_InvokeEndpoint_SeeAlso
answered Nov 23 '18 at 20:56
Han WangHan Wang
11
11
add a comment |
add a comment |
Next time please include more details in your question. eg. POST request data, Headers etc.
Anyways, to help you out in calling Sagemaker endpoint using Postman -
- In 'Authorization' tab, select type as 'AWS Signature'.
- Enter your Access and Secret key of the IAM user which has permission to Sagemaker resources.
- Enter the AWS region. eg.us-east-1
- Enter 'Service Name' as 'sagemaker'
- Select the right content type. Some ML algorithms only accept 'text/csv'.
- Select request type as 'POST'
- Enter the Sagemaker Invocation url. eg:'https://runtime.sagemaker.us-east-1.amazonaws.com/endpoints/xgboost-xxxx-xx-xx-xx-xx-xx-xxx/invocations'
Try it out and let me know if you have any issues.
Here is how your Postman should look -

@praneeth-peiris Have a look. You can call Sagemaker endpoint using Postman.
– Priyank Kapasi
Nov 26 '18 at 5:38
add a comment |
Next time please include more details in your question. eg. POST request data, Headers etc.
Anyways, to help you out in calling Sagemaker endpoint using Postman -
- In 'Authorization' tab, select type as 'AWS Signature'.
- Enter your Access and Secret key of the IAM user which has permission to Sagemaker resources.
- Enter the AWS region. eg.us-east-1
- Enter 'Service Name' as 'sagemaker'
- Select the right content type. Some ML algorithms only accept 'text/csv'.
- Select request type as 'POST'
- Enter the Sagemaker Invocation url. eg:'https://runtime.sagemaker.us-east-1.amazonaws.com/endpoints/xgboost-xxxx-xx-xx-xx-xx-xx-xxx/invocations'
Try it out and let me know if you have any issues.
Here is how your Postman should look -

@praneeth-peiris Have a look. You can call Sagemaker endpoint using Postman.
– Priyank Kapasi
Nov 26 '18 at 5:38
add a comment |
Next time please include more details in your question. eg. POST request data, Headers etc.
Anyways, to help you out in calling Sagemaker endpoint using Postman -
- In 'Authorization' tab, select type as 'AWS Signature'.
- Enter your Access and Secret key of the IAM user which has permission to Sagemaker resources.
- Enter the AWS region. eg.us-east-1
- Enter 'Service Name' as 'sagemaker'
- Select the right content type. Some ML algorithms only accept 'text/csv'.
- Select request type as 'POST'
- Enter the Sagemaker Invocation url. eg:'https://runtime.sagemaker.us-east-1.amazonaws.com/endpoints/xgboost-xxxx-xx-xx-xx-xx-xx-xxx/invocations'
Try it out and let me know if you have any issues.
Here is how your Postman should look -

Next time please include more details in your question. eg. POST request data, Headers etc.
Anyways, to help you out in calling Sagemaker endpoint using Postman -
- In 'Authorization' tab, select type as 'AWS Signature'.
- Enter your Access and Secret key of the IAM user which has permission to Sagemaker resources.
- Enter the AWS region. eg.us-east-1
- Enter 'Service Name' as 'sagemaker'
- Select the right content type. Some ML algorithms only accept 'text/csv'.
- Select request type as 'POST'
- Enter the Sagemaker Invocation url. eg:'https://runtime.sagemaker.us-east-1.amazonaws.com/endpoints/xgboost-xxxx-xx-xx-xx-xx-xx-xxx/invocations'
Try it out and let me know if you have any issues.
Here is how your Postman should look -

edited Nov 26 '18 at 5:39
answered Nov 26 '18 at 5:31
Priyank KapasiPriyank Kapasi
76821024
76821024
@praneeth-peiris Have a look. You can call Sagemaker endpoint using Postman.
– Priyank Kapasi
Nov 26 '18 at 5:38
add a comment |
@praneeth-peiris Have a look. You can call Sagemaker endpoint using Postman.
– Priyank Kapasi
Nov 26 '18 at 5:38
@praneeth-peiris Have a look. You can call Sagemaker endpoint using Postman.
– Priyank Kapasi
Nov 26 '18 at 5:38
@praneeth-peiris Have a look. You can call Sagemaker endpoint using Postman.
– Priyank Kapasi
Nov 26 '18 at 5:38
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.
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%2f53424429%2fgetting-error-while-invoking-api-using-aws-lambda-aws-lambda-aws-api-gateway%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
this is what many of us have encountered and many questions are present on stackOverflow about it also - it would help if you share the URL of the exact API call with the data that you are sending to API gateway
– Akber Iqbal
Nov 22 '18 at 5:40