Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass a request to sagemaker using postman

I've trained a model on sagemaker and have created the endpoint. I'm trying to invoke the endpoint using postman. But when training the model and even after that, I have not specified any header for the training data. I'm at a loss as to how to create payload while sending a post request to sagemaker

like image 321
Sujay DSa Avatar asked Apr 05 '18 15:04

Sujay DSa


People also ask

How do you use endpoints in SageMaker?

Deploy your model and create an HTTPS endpoint. Provide the endpoint configuration to SageMaker. The service launches the ML compute instances and deploys the model or models as specified in the configuration. Once you have your model and endpoint configuration, use the CreateEndpoint API to create your endpoint.

Which method deploys a model in SageMaker?

To host a model through Amazon EC2 using Amazon SageMaker, deploy the model that you trained in Create and Run a Training Job by calling the deploy method of the xgb_model estimator. When you call the deploy method, you must specify the number and type of EC2 ML instances that you want to use for hosting an endpoint.


1 Answers

Here's an example for calling the sagemaker endpoint created in the quickstart guide. You can call it using text/csv or application/json formats:

In Postman: The url you want is POST https://runtime.sagemaker.{{region}}.amazonaws.com/endpoints/{{aws_model_name}}/invocations

In the Authorization tab, choose type AWS Signature and put in the values for your AccessKey and SecretKey (recommend you use variables for these), and sagemaker for Service Name.

Under Headers add:

Content-Type : text/csv

Accept: application/json

In Body: paste in your body, separated by commas (if yr following the quickstart guide, in the notebook you can simply run print(valid_set[0][60:61]) to get an example vector. You'll need to convert that value set into comma separated values

Clicking Send and you should be good to go!

For sending JSON data, change the Content-Type to application/json and you'll want the structure to look like this:

{
    "instances":[
        {
            "configuration": {},
            "features": [...]
        }
     ]
}
like image 181
pbh Avatar answered Sep 17 '22 14:09

pbh