I am new to Amazon SageMaker and I am closely following this tutorial https://aws.amazon.com/blogs/machine-learning/creating-a-machine-learning-powered-rest-api-with-amazon-api-gateway-mapping-templates-and-amazon-sagemaker/ to create a machine learning-powered REST API with Amazon API Gateway mapping templates and Amazon SageMaker
when I run the following command on terminal (Step 2 of the Tutorial )
aws sagemaker-runtime invoke-endpoint \
--endpoint-name <endpoint-name> \
--body '{"instances": [{"in0":[863],"in1":[882]}]}' \
--content-type application/json \
--accept application/json \
results
I get the following Error: Invalid base64: "{"instances": [{"in0":[863],"in1":[882]}]}"
My endpoint is InService
on the SageMaker console and the example Jupyter notebook run successfully. (I also substituted <endpoint-name>
with the actual name - same error received with/without quotations around the name)
Using zsh here is the aws cli version:
aws --version
aws-cli/2.0.15 Python/3.7.4 Darwin/19.4.0 botocore/2.0.0dev19
Wondering what the problem could be. Any help is appreciated
The problem is that the body contents is being expected to be base 64 encoded, try base64 encoding the body before passing it to the invoke statement.