问题
Using the aws sagemaker cli tools it's possible to invoke endpoint that are hosted in sagemaker using a command like:
aws sagemaker-runtime invoke-endpoint --body file://container/local_test/payload.json \
--endpoint-name $(DEPLOYMENT_NAME)-staging \
--content-type application/json \
--accept application/json \
output.json
By default, this command goes to the /invocations
endpoint. Is it possible to go to a different endpoint? For example, if I implemented a health-report
endpoint? It's definately possible to make one as in the BYOM example. I'm just not sure how I'd access it.
Thanks!
回答1:
Currently sagemaker-runtime has a single invoke-endpoint method.
Calling other REST resources is most likely doable if you'll call the endpoint URL yourself over HTTP (that is without using aws sagemaker-runtime), however, you'll probably need to take care of the required sigv4 authentication header.
回答2:
/invocations is not a SageMaker Endpoint, it's a HTTP request path where the prediction request is handled.
See documentation: https://docs.aws.amazon.com/sagemaker/latest/dg/API_runtime_InvokeEndpoint.html
Request syntax:
POST /endpoints/EndpointName/invocations HTTP/1.1
Content-Type: ContentType
Accept: Accept
To your endpoint, the request is like:
POST /endpoints/$(DEPLOYMENT_NAME)-staging/invocations HTTP/1.1
Content-Type: ContentType
Accept: Accept
来源:https://stackoverflow.com/questions/51333159/is-it-possible-to-hit-endpoints-hosted-in-sagemaker-besides-invocations