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);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:
- Execution
Role stringArn A role that SageMaker can assume to access model artifacts and docker images for deployment.
- Containers
List<Model
Container Args> Specifies containers in the inference pipeline. If not specified, the
primary_containerargument is required. Fields are documented below.- Enable
Network boolIsolation 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.
- Primary
Container ModelPrimary Container Args The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the
containerargument is required. Fields are documented below.- Dictionary<string, string>
A map of tags to assign to the resource.
- Vpc
Config ModelVpc Config Args Specifies the VPC that you want your model to connect to. VpcConfig is used in hosting services and in batch transform.
- Execution
Role stringArn A role that SageMaker can assume to access model artifacts and docker images for deployment.
- Containers
[]Model
Container Specifies containers in the inference pipeline. If not specified, the
primary_containerargument is required. Fields are documented below.- Enable
Network boolIsolation 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.
- Primary
Container ModelPrimary Container The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the
containerargument is required. Fields are documented below.- map[string]string
A map of tags to assign to the resource.
- Vpc
Config ModelVpc Config Specifies the VPC that you want your model to connect to. VpcConfig is used in hosting services and in batch transform.
- execution
Role stringArn A role that SageMaker can assume to access model artifacts and docker images for deployment.
- containers
Model
Container[] Specifies containers in the inference pipeline. If not specified, the
primary_containerargument is required. Fields are documented below.- enable
Network booleanIsolation 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.
- primary
Container ModelPrimary Container The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the
containerargument is required. Fields are documented below.- {[key: string]: string}
A map of tags to assign to the resource.
- vpc
Config ModelVpc Config Specifies the VPC that you want your model to connect to. VpcConfig is used in hosting services and in batch transform.
- execution_
role_ strarn A role that SageMaker can assume to access model artifacts and docker images for deployment.
- containers
List[Model
Container] Specifies containers in the inference pipeline. If not specified, the
primary_containerargument is required. Fields are documented below.- enable_
network_ boolisolation 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[ModelPrimary Container] The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the
containerargument is required. Fields are documented below.- Dict[str, str]
A map of tags to assign to the resource.
- vpc_
config Dict[ModelVpc Config] 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:
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): Modelstatic 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<Model
Container Args> Specifies containers in the inference pipeline. If not specified, the
primary_containerargument is required. Fields are documented below.- Enable
Network boolIsolation Isolates the model container. No inbound or outbound network calls can be made to or from the model container.
- Execution
Role stringArn 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.
- Primary
Container ModelPrimary Container Args The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the
containerargument is required. Fields are documented below.- Dictionary<string, string>
A map of tags to assign to the resource.
- Vpc
Config ModelVpc Config Args 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
[]Model
Container Specifies containers in the inference pipeline. If not specified, the
primary_containerargument is required. Fields are documented below.- Enable
Network boolIsolation Isolates the model container. No inbound or outbound network calls can be made to or from the model container.
- Execution
Role stringArn 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.
- Primary
Container ModelPrimary Container The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the
containerargument is required. Fields are documented below.- map[string]string
A map of tags to assign to the resource.
- Vpc
Config ModelVpc Config 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
Model
Container[] Specifies containers in the inference pipeline. If not specified, the
primary_containerargument is required. Fields are documented below.- enable
Network booleanIsolation Isolates the model container. No inbound or outbound network calls can be made to or from the model container.
- execution
Role stringArn 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.
- primary
Container ModelPrimary Container The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the
containerargument is required. Fields are documented below.- {[key: string]: string}
A map of tags to assign to the resource.
- vpc
Config ModelVpc Config 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[Model
Container] Specifies containers in the inference pipeline. If not specified, the
primary_containerargument is required. Fields are documented below.- enable_
network_ boolisolation Isolates the model container. No inbound or outbound network calls can be made to or from the model container.
- execution_
role_ strarn 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[ModelPrimary Container] The primary docker image containing inference code that is used when the model is deployed for predictions. If not specified, the
containerargument is required. Fields are documented below.- Dict[str, str]
A map of tags to assign to the resource.
- vpc_
config Dict[ModelVpc Config] Specifies the VPC that you want your model to connect to. VpcConfig is used in hosting services and in batch transform.
Supporting Types
ModelContainer
- Image string
The registry path where the inference code image is stored in Amazon ECR.
- Container
Hostname string The DNS host name for the container.
- Environment Dictionary<string, string>
Environment variables for the Docker container. A list of key value pairs.
- Model
Data stringUrl 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.
- Container
Hostname string The DNS host name for the container.
- Environment map[string]string
Environment variables for the Docker container. A list of key value pairs.
- Model
Data stringUrl 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.
- container
Hostname string The DNS host name for the container.
- environment {[key: string]: string}
Environment variables for the Docker container. A list of key value pairs.
- model
Data stringUrl 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.
- container
Hostname str The DNS host name for the container.
- environment Dict[str, str]
Environment variables for the Docker container. A list of key value pairs.
- model
Data strUrl The URL for the S3 location where model artifacts are stored.
ModelPrimaryContainer
- Image string
The registry path where the inference code image is stored in Amazon ECR.
- Container
Hostname string The DNS host name for the container.
- Environment Dictionary<string, string>
Environment variables for the Docker container. A list of key value pairs.
- Model
Data stringUrl 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.
- Container
Hostname string The DNS host name for the container.
- Environment map[string]string
Environment variables for the Docker container. A list of key value pairs.
- Model
Data stringUrl 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.
- container
Hostname string The DNS host name for the container.
- environment {[key: string]: string}
Environment variables for the Docker container. A list of key value pairs.
- model
Data stringUrl 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.
- container
Hostname str The DNS host name for the container.
- environment Dict[str, str]
Environment variables for the Docker container. A list of key value pairs.
- model
Data strUrl The URL for the S3 location where model artifacts are stored.
ModelVpcConfig
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.