Model
Source:
src/AWS/SageMaker/Model.ts
An Amazon SageMaker Model — the immutable pairing of an inference
container image (and optional S3 model artifacts) with an execution role.
A model is pure configuration: it costs nothing until it is deployed to an
endpoint via an EndpointConfig + Endpoint.
SageMaker models are immutable — any change other than tags replaces the model.
Creating Models
Section titled “Creating Models”Model from an ECR image
import * as AWS from "alchemy/AWS";
const role = yield* AWS.IAM.Role("SageMakerRole", { assumeRolePolicyDocument: { Version: "2012-10-17", Statement: [{ Effect: "Allow", Principal: { Service: "sagemaker.amazonaws.com" }, Action: ["sts:AssumeRole"], }], }, managedPolicyArns: ["arn:aws:iam::aws:policy/AmazonSageMakerFullAccess"],});
const model = yield* AWS.SageMaker.Model("MyModel", { executionRoleArn: role.roleArn, primaryContainer: { Image: "123456789012.dkr.ecr.us-west-2.amazonaws.com/my-inference:latest", ModelDataUrl: "s3://my-bucket/model.tar.gz", },});Serverless deployment (Model → EndpointConfig → Endpoint)
const config = yield* AWS.SageMaker.EndpointConfig("MyConfig", { productionVariants: [{ VariantName: "AllTraffic", ModelName: model.modelName, ServerlessConfig: { MemorySizeInMB: 2048, MaxConcurrency: 5 }, }],});const endpoint = yield* AWS.SageMaker.Endpoint("MyEndpoint", { endpointConfigName: config.endpointConfigName,});