tlanigan
tlanigan

Reputation: 959

How do I call a SageMaker Endpoint using the AWS CLI (

I'm trying to invoke the iris endpointfrom the SageMaker example notebooks using the aws cli. I've tried using the following command:

!aws sagemaker-runtime invoke-endpoint \
--endpoint-name sagemaker-tensorflow-py2-cpu-2018-03-19-21-27-52-956 \
--body "[6.4, 3.2, 4.5, 1.5]" \
--content-type "application/json" \
output.json

I get the following response:

{
    "InvokedProductionVariant": "AllTraffic", 
    "ContentType": "*/*"
}

What am I doing wrong?

Upvotes: 6

Views: 6445

Answers (2)

Prathamesh dhanawade
Prathamesh dhanawade

Reputation: 513

Just FYI, I was running the command for a flask endpoint and wanted to add that when mentioning --body as json I had to add the quotes as:

--body "{ \"host\": \"some.example.com\", \"userId\": [ \"some-string\" ] }"

I am now looking for a way to specify a json file instead of this body which would be easier for a CI/CD pipeline, per say !

Upvotes: 2

Winston-at-AWS
Winston-at-AWS

Reputation: 96

If you've gotten that response, your request is successful. The output should be in the output file you specified - output.json :)

Upvotes: 7

Related Questions