Skip to main content

models

Creates, updates, deletes, gets or lists a models resource.

Overview

Namemodels
TypeResource
Idaws.sagemaker.models

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
containersarrayThe containers in the inference pipeline.
creation_timestring (date-time)A timestamp that shows when the model was created.
deployment_recommendationobjectA set of recommended deployment configurations for the model.
enable_network_isolationbooleanIf True, no inbound or outbound network calls can be made to or from the model container.
execution_role_arnstringThe Amazon Resource Name (ARN) of the IAM role that you specified for the model. (pattern: <code>arn:aws[a-z-]*:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@-_/]+</code>)
inference_execution_configobjectSpecifies details of how containers in a multi-container endpoint are called.
model_arnstringThe Amazon Resource Name (ARN) of the model. (pattern: <code>arn:aws[a-z-]:sagemaker:[a-z0-9-]:[0-9]{12}:model/.*</code>)
model_namestringName of the SageMaker model. (pattern: <code>[a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9])?</code>)
primary_containerobjectDescribes the container, as part of model definition.
vpc_configobjectSpecifies an Amazon Virtual Private Cloud (VPC) that your SageMaker jobs, hosted models, and compute resources have access to. You can control access to and from your resources by configuring a VPC. For more information, see Give SageMaker Access to Resources in your Amazon VPC.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_modelselectregionDescribes a model that you created using the CreateModel API.
list_modelsselectregionLists models created with the CreateModel API.
create_modelinsertregion, ModelNameCreates a model in SageMaker. In the request, you name the model and describe a primary container. For the primary container, you specify the Docker image that contains inference code, artifacts (from prior training), and a custom environment map that the inference code uses when you deploy the model for predictions. Use this API to create a model if you want to use SageMaker hosting services or run a batch transform job. To host your model, you create an endpoint configuration with the CreateEndpointConfig API, and then create an endpoint with the CreateEndpoint API. SageMaker then deploys all of the containers that you defined for the model in the hosting environment. To run a batch transform using your model, you start a job with the CreateTransformJob API. SageMaker uses your model and your dataset to get inferences which are then saved to a specified S3 location. In the request, you also provide an IAM role that SageMaker can assume to access model artifacts and docker image for deployment on ML compute hosting instances or for batch transform jobs. In addition, you also use the IAM role to manage permissions the inference code needs. For example, if the inference code access any other Amazon Web Services resources, you grant necessary permissions via this role.
delete_modeldeleteregionDeletes a model. The DeleteModel API deletes only the model entry that was created in SageMaker when you called the CreateModel API. It does not delete model artifacts, inference code, or the IAM role that you specified when creating the model.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Describes a model that you created using the CreateModel API.

SELECT
containers,
creation_time,
deployment_recommendation,
enable_network_isolation,
execution_role_arn,
inference_execution_config,
model_arn,
model_name,
primary_container,
vpc_config
FROM aws.sagemaker.models
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a model in SageMaker. In the request, you name the model and describe a primary container. For the primary container, you specify the Docker image that contains inference code, artifacts (from prior training), and a custom environment map that the inference code uses when you deploy the model for predictions. Use this API to create a model if you want to use SageMaker hosting services or run a batch transform job. To host your model, you create an endpoint configuration with the CreateEndpointConfig API, and then create an endpoint with the CreateEndpoint API. SageMaker then deploys all of the containers that you defined for the model in the hosting environment. To run a batch transform using your model, you start a job with the CreateTransformJob API. SageMaker uses your model and your dataset to get inferences which are then saved to a specified S3 location. In the request, you also provide an IAM role that SageMaker can assume to access model artifacts and docker image for deployment on ML compute hosting instances or for batch transform jobs. In addition, you also use the IAM role to manage permissions the inference code needs. For example, if the inference code access any other Amazon Web Services resources, you grant necessary permissions via this role.

INSERT INTO aws.sagemaker.models (
ModelName,
PrimaryContainer,
Containers,
InferenceExecutionConfig,
ExecutionRoleArn,
Tags,
VpcConfig,
EnableNetworkIsolation,
region
)
SELECT
'{{ ModelName }}' /* required */,
'{{ PrimaryContainer }}',
'{{ Containers }}',
'{{ InferenceExecutionConfig }}',
'{{ ExecutionRoleArn }}',
'{{ Tags }}',
'{{ VpcConfig }}',
{{ EnableNetworkIsolation }},
'{{ region }}'
RETURNING
model_arn
;

DELETE examples

Deletes a model. The DeleteModel API deletes only the model entry that was created in SageMaker when you called the CreateModel API. It does not delete model artifacts, inference code, or the IAM role that you specified when creating the model.

DELETE FROM aws.sagemaker.models
WHERE region = '{{ region }}' --required
;