Model

Provides a SageMaker model resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var model = new Aws.Sagemaker.Model("model", new Aws.Sagemaker.ModelArgs
        {
            ExecutionRoleArn = aws_iam_role.Foo.Arn,
            PrimaryContainer = new Aws.Sagemaker.Inputs.ModelPrimaryContainerArgs
            {
                Image = "174872318107.dkr.ecr.us-west-2.amazonaws.com/kmeans:1",
            },
        });
        var assumeRole = Output.Create(Aws.Iam.GetPolicyDocument.InvokeAsync(new Aws.Iam.GetPolicyDocumentArgs
        {
            Statements = 
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementArgs
                {
                    Actions = 
                    {
                        "sts:AssumeRole",
                    },
                    Principals = 
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalArgs
                        {
                            Identifiers = 
                            {
                                "sagemaker.amazonaws.com",
                            },
                            Type = "Service",
                        },
                    },
                },
            },
        }));
        var role = new Aws.Iam.Role("role", new Aws.Iam.RoleArgs
        {
            AssumeRolePolicy = assumeRole.Apply(assumeRole => assumeRole.Json),
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/iam"
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/sagemaker"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := sagemaker.NewModel(ctx, "model", &sagemaker.ModelArgs{
            ExecutionRoleArn: pulumi.String(aws_iam_role.Foo.Arn),
            PrimaryContainer: &sagemaker.ModelPrimaryContainerArgs{
                Image: pulumi.String("174872318107.dkr.ecr.us-west-2.amazonaws.com/kmeans:1"),
            },
        })
        if err != nil {
            return err
        }
        assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
            Statements: []iam.GetPolicyDocumentStatement{
                iam.GetPolicyDocumentStatement{
                    Actions: []string{
                        "sts:AssumeRole",
                    },
                    Principals: []iam.GetPolicyDocumentStatementPrincipal{
                        iam.GetPolicyDocumentStatementPrincipal{
                            Identifiers: []string{
                                "sagemaker.amazonaws.com",
                            },
                            Type: "Service",
                        },
                    },
                },
            },
        }, nil)
        if err != nil {
            return err
        }
        _, err = iam.NewRole(ctx, "role", &iam.RoleArgs{
            AssumeRolePolicy: pulumi.String(assumeRole.Json),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

model = aws.sagemaker.Model("model",
    execution_role_arn=aws_iam_role["foo"]["arn"],
    primary_container={
        "image": "174872318107.dkr.ecr.us-west-2.amazonaws.com/kmeans:1",
    })
assume_role = aws.iam.get_policy_document(statements=[{
    "actions": ["sts:AssumeRole"],
    "principals": [{
        "identifiers": ["sagemaker.amazonaws.com"],
        "type": "Service",
    }],
}])
role = aws.iam.Role("role", assume_role_policy=assume_role.json)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const model = new aws.sagemaker.Model("m", {
    executionRoleArn: aws_iam_role_foo.arn,
    primaryContainer: {
        image: "174872318107.dkr.ecr.us-west-2.amazonaws.com/kmeans:1",
    },
});
const assumeRole = pulumi.output(aws.iam.getPolicyDocument({
    statements: [{
        actions: ["sts:AssumeRole"],
        principals: [{
            identifiers: ["sagemaker.amazonaws.com"],
            type: "Service",
        }],
    }],
}, { async: true }));
const role = new aws.iam.Role("r", {
    assumeRolePolicy: assumeRole.json,
});

Create a Model Resource

new Model(name: string, args: ModelArgs, opts?: CustomResourceOptions);
def Model(resource_name, opts=None, containers=None, enable_network_isolation=None, execution_role_arn=None, name=None, primary_container=None, tags=None, vpc_config=None, __props__=None);
func NewModel(ctx *Context, name string, args ModelArgs, opts ...ResourceOption) (*Model, error)
public Model(string name, ModelArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ModelArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ModelArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ModelArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Model Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The Model resource accepts the following input properties:

ExecutionRoleArn string

A role that SageMaker can assume to access model artifacts and docker images for deployment.

Containers List<ModelContainerArgs>

Specifies containers in the inference pipeline. If not specified, the primary_container argument is required. Fields are documented below.

EnableNetworkIsolation bool

Isolates the model container. No inbound or outbound network calls can be made to or from the model container.

Name string

The name of the model (must be unique). If omitted, this provider will assign a random, unique name.

PrimaryContainer ModelPrimaryContainerArgs

The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the container argument is required. Fields are documented below.

Tags Dictionary<string, string>

A map of tags to assign to the resource.

VpcConfig ModelVpcConfigArgs

Specifies the VPC that you want your model to connect to. VpcConfig is used in hosting services and in batch transform.

ExecutionRoleArn string

A role that SageMaker can assume to access model artifacts and docker images for deployment.

Containers []ModelContainer

Specifies containers in the inference pipeline. If not specified, the primary_container argument is required. Fields are documented below.

EnableNetworkIsolation bool

Isolates the model container. No inbound or outbound network calls can be made to or from the model container.

Name string

The name of the model (must be unique). If omitted, this provider will assign a random, unique name.

PrimaryContainer ModelPrimaryContainer

The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the container argument is required. Fields are documented below.

Tags map[string]string

A map of tags to assign to the resource.

VpcConfig ModelVpcConfig

Specifies the VPC that you want your model to connect to. VpcConfig is used in hosting services and in batch transform.

executionRoleArn string

A role that SageMaker can assume to access model artifacts and docker images for deployment.

containers ModelContainer[]

Specifies containers in the inference pipeline. If not specified, the primary_container argument is required. Fields are documented below.

enableNetworkIsolation boolean

Isolates the model container. No inbound or outbound network calls can be made to or from the model container.

name string

The name of the model (must be unique). If omitted, this provider will assign a random, unique name.

primaryContainer ModelPrimaryContainer

The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the container argument is required. Fields are documented below.

tags {[key: string]: string}

A map of tags to assign to the resource.

vpcConfig ModelVpcConfig

Specifies the VPC that you want your model to connect to. VpcConfig is used in hosting services and in batch transform.

execution_role_arn str

A role that SageMaker can assume to access model artifacts and docker images for deployment.

containers List[ModelContainer]

Specifies containers in the inference pipeline. If not specified, the primary_container argument is required. Fields are documented below.

enable_network_isolation bool

Isolates the model container. No inbound or outbound network calls can be made to or from the model container.

name str

The name of the model (must be unique). If omitted, this provider will assign a random, unique name.

primary_container Dict[ModelPrimaryContainer]

The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the container argument is required. Fields are documented below.

tags Dict[str, str]

A map of tags to assign to the resource.

vpc_config Dict[ModelVpcConfig]

Specifies the VPC that you want your model to connect to. VpcConfig is used in hosting services and in batch transform.

Outputs

All input properties are implicitly available as output properties. Additionally, the Model resource produces the following output properties:

Arn string

The Amazon Resource Name (ARN) assigned by AWS to this model.

Id string
The provider-assigned unique ID for this managed resource.
Arn string

The Amazon Resource Name (ARN) assigned by AWS to this model.

Id string
The provider-assigned unique ID for this managed resource.
arn string

The Amazon Resource Name (ARN) assigned by AWS to this model.

id string
The provider-assigned unique ID for this managed resource.
arn str

The Amazon Resource Name (ARN) assigned by AWS to this model.

id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Model Resource

Get an existing Model resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ModelState, opts?: CustomResourceOptions): Model
static get(resource_name, id, opts=None, arn=None, containers=None, enable_network_isolation=None, execution_role_arn=None, name=None, primary_container=None, tags=None, vpc_config=None, __props__=None);
func GetModel(ctx *Context, name string, id IDInput, state *ModelState, opts ...ResourceOption) (*Model, error)
public static Model Get(string name, Input<string> id, ModelState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Arn string

The Amazon Resource Name (ARN) assigned by AWS to this model.

Containers List<ModelContainerArgs>

Specifies containers in the inference pipeline. If not specified, the primary_container argument is required. Fields are documented below.

EnableNetworkIsolation bool

Isolates the model container. No inbound or outbound network calls can be made to or from the model container.

ExecutionRoleArn string

A role that SageMaker can assume to access model artifacts and docker images for deployment.

Name string

The name of the model (must be unique). If omitted, this provider will assign a random, unique name.

PrimaryContainer ModelPrimaryContainerArgs

The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the container argument is required. Fields are documented below.

Tags Dictionary<string, string>

A map of tags to assign to the resource.

VpcConfig ModelVpcConfigArgs

Specifies the VPC that you want your model to connect to. VpcConfig is used in hosting services and in batch transform.

Arn string

The Amazon Resource Name (ARN) assigned by AWS to this model.

Containers []ModelContainer

Specifies containers in the inference pipeline. If not specified, the primary_container argument is required. Fields are documented below.

EnableNetworkIsolation bool

Isolates the model container. No inbound or outbound network calls can be made to or from the model container.

ExecutionRoleArn string

A role that SageMaker can assume to access model artifacts and docker images for deployment.

Name string

The name of the model (must be unique). If omitted, this provider will assign a random, unique name.

PrimaryContainer ModelPrimaryContainer

The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the container argument is required. Fields are documented below.

Tags map[string]string

A map of tags to assign to the resource.

VpcConfig ModelVpcConfig

Specifies the VPC that you want your model to connect to. VpcConfig is used in hosting services and in batch transform.

arn string

The Amazon Resource Name (ARN) assigned by AWS to this model.

containers ModelContainer[]

Specifies containers in the inference pipeline. If not specified, the primary_container argument is required. Fields are documented below.

enableNetworkIsolation boolean

Isolates the model container. No inbound or outbound network calls can be made to or from the model container.

executionRoleArn string

A role that SageMaker can assume to access model artifacts and docker images for deployment.

name string

The name of the model (must be unique). If omitted, this provider will assign a random, unique name.

primaryContainer ModelPrimaryContainer

The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the container argument is required. Fields are documented below.

tags {[key: string]: string}

A map of tags to assign to the resource.

vpcConfig ModelVpcConfig

Specifies the VPC that you want your model to connect to. VpcConfig is used in hosting services and in batch transform.

arn str

The Amazon Resource Name (ARN) assigned by AWS to this model.

containers List[ModelContainer]

Specifies containers in the inference pipeline. If not specified, the primary_container argument is required. Fields are documented below.

enable_network_isolation bool

Isolates the model container. No inbound or outbound network calls can be made to or from the model container.

execution_role_arn str

A role that SageMaker can assume to access model artifacts and docker images for deployment.

name str

The name of the model (must be unique). If omitted, this provider will assign a random, unique name.

primary_container Dict[ModelPrimaryContainer]

The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the container argument is required. Fields are documented below.

tags Dict[str, str]

A map of tags to assign to the resource.

vpc_config Dict[ModelVpcConfig]

Specifies the VPC that you want your model to connect to. VpcConfig is used in hosting services and in batch transform.

Supporting Types

ModelContainer

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Image string

The registry path where the inference code image is stored in Amazon ECR.

ContainerHostname string

The DNS host name for the container.

Environment Dictionary<string, string>

Environment variables for the Docker container. A list of key value pairs.

ModelDataUrl string

The URL for the S3 location where model artifacts are stored.

Image string

The registry path where the inference code image is stored in Amazon ECR.

ContainerHostname string

The DNS host name for the container.

Environment map[string]string

Environment variables for the Docker container. A list of key value pairs.

ModelDataUrl string

The URL for the S3 location where model artifacts are stored.

image string

The registry path where the inference code image is stored in Amazon ECR.

containerHostname string

The DNS host name for the container.

environment {[key: string]: string}

Environment variables for the Docker container. A list of key value pairs.

modelDataUrl string

The URL for the S3 location where model artifacts are stored.

image str

The registry path where the inference code image is stored in Amazon ECR.

containerHostname str

The DNS host name for the container.

environment Dict[str, str]

Environment variables for the Docker container. A list of key value pairs.

modelDataUrl str

The URL for the S3 location where model artifacts are stored.

ModelPrimaryContainer

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Image string

The registry path where the inference code image is stored in Amazon ECR.

ContainerHostname string

The DNS host name for the container.

Environment Dictionary<string, string>

Environment variables for the Docker container. A list of key value pairs.

ModelDataUrl string

The URL for the S3 location where model artifacts are stored.

Image string

The registry path where the inference code image is stored in Amazon ECR.

ContainerHostname string

The DNS host name for the container.

Environment map[string]string

Environment variables for the Docker container. A list of key value pairs.

ModelDataUrl string

The URL for the S3 location where model artifacts are stored.

image string

The registry path where the inference code image is stored in Amazon ECR.

containerHostname string

The DNS host name for the container.

environment {[key: string]: string}

Environment variables for the Docker container. A list of key value pairs.

modelDataUrl string

The URL for the S3 location where model artifacts are stored.

image str

The registry path where the inference code image is stored in Amazon ECR.

containerHostname str

The DNS host name for the container.

environment Dict[str, str]

Environment variables for the Docker container. A list of key value pairs.

modelDataUrl str

The URL for the S3 location where model artifacts are stored.

ModelVpcConfig

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

SecurityGroupIds List<string>
Subnets List<string>
SecurityGroupIds []string
Subnets []string
securityGroupIds string[]
subnets string[]
security_group_ids List[str]
subnets List[str]

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.