Skip to content

InvokeEndpoint

Source: src/AWS/SageMakerRuntime/InvokeEndpoint.ts

Runtime binding for sagemaker:InvokeEndpoint — run real-time inference against a deployed SageMaker endpoint with a model-native request body.

SageMaker Runtime is a pure pay-per-call data-plane API: the endpoint itself is provisioned out of band (a deployed SageMaker model/endpoint — costly to keep running). The binding takes one or more endpoint names and grants the function sagemaker:InvokeEndpoint scoped to exactly those endpoint ARNs. Pass the request/response bodies as raw bytes — the container behind the endpoint owns the payload shape, no marshalling.

// init
const invokeEndpoint = yield* AWS.SageMakerRuntime.InvokeEndpoint(
"my-model-endpoint",
);
// runtime — Body is the raw payload the container expects
const result = yield* invokeEndpoint({
ContentType: "application/json",
Accept: "application/json",
Body: JSON.stringify({ instances: [[1, 2, 3, 4]] }),
});
const raw = new TextDecoder().decode(result.Body);