\n\n
then fill up your body with the relevant content type.
\nthen add or remove additional headers like variant-name or model-name, if you have them set up and the headers should look like shown in this screenshot:
URL and credentials in the above screenshots doesn't work anymore, duh!
\nand if you want code to invoke the endpoint directly using some back-end language, here's code for python.
\n","author":{"@type":"Person","name":"Naveen Reddy Marthala"},"upvoteCount":5}}}Reputation: 679
based on the aws documentation, maximum timeout limit is less that 30 seconds in api gateway.so hooking up an sagemaker endpoint with api gateway wouldn't make sense, if the request/response is going to take more than 30 seconds. is there any workaround ? adding a lambda in between api gateway and sagemaker endpoint is going to add more time to process request/response, which i would like to avoid. also, there will be added time for lambda cold starts and sagemaker serverless endpoints are built on top of lambda so that will also add cold start time. is there a way to invoke the serverless sagemaker endpoints , without these overhead?
Upvotes: 4
Views: 6415
Reputation: 3133
It is indeed possible to invoke sagemaker endpoints from sagemaker without using any other AWS services and that is also manifested by the fact that they have invocation URLs.
Here's how you set it up:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "sagemaker:InvokeEndpoint",
"Resource": "arn:aws:sagemaker:<region>:<account-id>:endpoint/<endpoint-name>"
}
]
}
you can replace <endpoint-name>
with *
to let this user invoke all endpoints.
use the ACCESS-KEY and SECRET-ACCESS-KEY to configure authorisation in postman like shown in this screenshot. also add the parameters in advanced tab like shown in the screenshot.
then fill up your body with the relevant content type.
then add or remove additional headers like variant-name or model-name, if you have them set up and the headers should look like shown in this screenshot:
URL and credentials in the above screenshots doesn't work anymore, duh!
and if you want code to invoke the endpoint directly using some back-end language, here's code for python.
Upvotes: 5
Reputation: 4047
You can connect SageMaker endpoints to API Gateway directly, without intermediary Lambdas, using mapping templates https://aws.amazon.com/fr/blogs/machine-learning/creating-a-machine-learning-powered-rest-api-with-amazon-api-gateway-mapping-templates-and-amazon-sagemaker/
You can also invoke endpoints with AWS SDKs (eg CLI, boto3), no need to do it for API GW necessarily.
Upvotes: 2