Class InferenceComponent


  • public class InferenceComponent
    extends com.pulumi.resources.CustomResource
    Provides a SageMaker AI Inference Component resource. An inference component is a SageMaker AI hosting object that you can use to deploy a model to an endpoint. You can optimize resource utilization by tailoring how the required CPU cores, accelerators, and memory are allocated. You can deploy multiple inference components to an endpoint, where each inference component contains one model and the resource utilization needs for that individual model. ## Example Usage ### Basic Usage
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.sagemaker.InferenceComponent;
     import com.pulumi.aws.sagemaker.InferenceComponentArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentSpecificationArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentSpecificationComputeResourceRequirementsArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentRuntimeConfigArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new InferenceComponent("example", InferenceComponentArgs.builder()
                 .specification(InferenceComponentSpecificationArgs.builder()
                     .computeResourceRequirements(InferenceComponentSpecificationComputeResourceRequirementsArgs.builder()
                         .minMemoryRequiredInMb(1024)
                         .build())
                     .modelName(exampleAwsSagemakerModel.name())
                     .build())
                 .runtimeConfig(InferenceComponentRuntimeConfigArgs.builder()
                     .copyCount(1)
                     .build())
                 .name("my-inference-component")
                 .endpointName(exampleAwsSagemakerEndpoint.name())
                 .variantName("variant-1")
                 .build());
     
         }
     }
     
     
    ### With Container Specification
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.sagemaker.InferenceComponent;
     import com.pulumi.aws.sagemaker.InferenceComponentArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentSpecificationArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentSpecificationContainerArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentSpecificationComputeResourceRequirementsArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentSpecificationStartupParametersArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentRuntimeConfigArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new InferenceComponent("example", InferenceComponentArgs.builder()
                 .specification(InferenceComponentSpecificationArgs.builder()
                     .container(InferenceComponentSpecificationContainerArgs.builder()
                         .image("123456789012.dkr.ecr.us-east-1.amazonaws.com/my-model:latest")
                         .artifactUrl("s3://my-bucket/model.tar.gz")
                         .environment(Map.of("MODEL_NAME", "my-model"))
                         .build())
                     .computeResourceRequirements(InferenceComponentSpecificationComputeResourceRequirementsArgs.builder()
                         .minMemoryRequiredInMb(2048)
                         .maxMemoryRequiredInMb(4096)
                         .numberOfCpuCoresRequired(2.0)
                         .numberOfAcceleratorDevicesRequired(1.0)
                         .build())
                     .startupParameters(InferenceComponentSpecificationStartupParametersArgs.builder()
                         .containerStartupHealthCheckTimeoutInSeconds(300)
                         .modelDataDownloadTimeoutInSeconds(300)
                         .build())
                     .build())
                 .runtimeConfig(InferenceComponentRuntimeConfigArgs.builder()
                     .copyCount(2)
                     .build())
                 .name("my-inference-component")
                 .endpointName(exampleAwsSagemakerEndpoint.name())
                 .variantName("variant-1")
                 .build());
     
         }
     }
     
     
    ### With Deployment Config `deploymentConfig` controls how *updates* to an existing inference component are rolled out; it has no effect on the initial create. Add it (or change it) on a subsequent apply to govern the rollout of a `specification` or `runtimeConfig` change.
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.sagemaker.InferenceComponent;
     import com.pulumi.aws.sagemaker.InferenceComponentArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentSpecificationArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentSpecificationComputeResourceRequirementsArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentRuntimeConfigArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentDeploymentConfigArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentDeploymentConfigRollingUpdatePolicyArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentDeploymentConfigRollingUpdatePolicyMaximumBatchSizeArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentDeploymentConfigAutoRollbackConfigurationArgs;
     import com.pulumi.aws.sagemaker.inputs.InferenceComponentDeploymentConfigAutoRollbackConfigurationAlarmArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new InferenceComponent("example", InferenceComponentArgs.builder()
                 .specification(InferenceComponentSpecificationArgs.builder()
                     .computeResourceRequirements(InferenceComponentSpecificationComputeResourceRequirementsArgs.builder()
                         .minMemoryRequiredInMb(1024)
                         .build())
                     .modelName(exampleAwsSagemakerModel.name())
                     .build())
                 .runtimeConfig(InferenceComponentRuntimeConfigArgs.builder()
                     .copyCount(4)
                     .build())
                 .deploymentConfig(InferenceComponentDeploymentConfigArgs.builder()
                     .rollingUpdatePolicy(InferenceComponentDeploymentConfigRollingUpdatePolicyArgs.builder()
                         .maximumBatchSize(InferenceComponentDeploymentConfigRollingUpdatePolicyMaximumBatchSizeArgs.builder()
                             .type("COPY_COUNT")
                             .value(1)
                             .build())
                         .waitIntervalInSeconds(60)
                         .build())
                     .autoRollbackConfiguration(InferenceComponentDeploymentConfigAutoRollbackConfigurationArgs.builder()
                         .alarms(InferenceComponentDeploymentConfigAutoRollbackConfigurationAlarmArgs.builder()
                             .alarmName(exampleAwsCloudwatchMetricAlarm.alarmName())
                             .build())
                         .build())
                     .build())
                 .name("my-inference-component")
                 .endpointName(exampleAwsSagemakerEndpoint.name())
                 .variantName("variant-1")
                 .build());
     
         }
     }
     
     
    ## Import ### Identity Schema #### Required * `name` (String) Name of the inference component. #### Optional * `accountId` (String) AWS Account where this resource is managed. * `region` (String) Region where this resource is managed. Using `pulumi import`, import SageMaker AI Inference Components using the `name`. For example: ```sh $ pulumi import aws:sagemaker/inferenceComponent:InferenceComponent example my-inference-component ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> arn()  
      com.pulumi.core.Output<java.lang.String> creationTime()  
      com.pulumi.core.Output<java.util.Optional<InferenceComponentDeploymentConfig>> deploymentConfig()  
      com.pulumi.core.Output<java.lang.String> endpointArn()  
      com.pulumi.core.Output<java.lang.String> endpointName()  
      com.pulumi.core.Output<java.lang.String> failureReason()  
      static InferenceComponent get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, InferenceComponentState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.String> lastModifiedTime()  
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.lang.String> region()  
      com.pulumi.core.Output<java.util.Optional<InferenceComponentRuntimeConfig>> runtimeConfig()  
      com.pulumi.core.Output<java.util.Optional<InferenceComponentSpecification>> specification()  
      com.pulumi.core.Output<java.util.Optional<java.util.List<InferenceComponentSpecification>>> specifications()  
      com.pulumi.core.Output<java.lang.String> status()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()  
      com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()  
      com.pulumi.core.Output<java.util.Optional<InferenceComponentTimeouts>> timeouts()  
      com.pulumi.core.Output<java.lang.String> variantName()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • InferenceComponent

        public InferenceComponent​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • InferenceComponent

        public InferenceComponent​(java.lang.String name,
                                  InferenceComponentArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • InferenceComponent

        public InferenceComponent​(java.lang.String name,
                                  InferenceComponentArgs args,
                                  @Nullable
                                  com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        ARN of the inference component.
      • creationTime

        public com.pulumi.core.Output<java.lang.String> creationTime()
        Returns:
        Time when the inference component was created.
      • deploymentConfig

        public com.pulumi.core.Output<java.util.Optional<InferenceComponentDeploymentConfig>> deploymentConfig()
        Returns:
        Deployment configuration for the inference component, which controls the rollout strategy and rollback behavior. This directive applies only when the inference component is **updated** — the `CreateInferenceComponent` API does not accept it, so it has no effect on initial creation. It is not returned by the API and is therefore not refreshed into state or verified on import. See `deploymentConfig` Block.
      • endpointArn

        public com.pulumi.core.Output<java.lang.String> endpointArn()
        Returns:
        ARN of the endpoint that hosts the inference component.
      • endpointName

        public com.pulumi.core.Output<java.lang.String> endpointName()
        Returns:
        Name of an existing endpoint where you host the inference component.
      • failureReason

        public com.pulumi.core.Output<java.lang.String> failureReason()
        Returns:
        If the inference component status is `Failed`, the reason for the failure.
      • lastModifiedTime

        public com.pulumi.core.Output<java.lang.String> lastModifiedTime()
        Returns:
        Time when the inference component was last updated.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        Unique name to assign to the inference component.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
      • runtimeConfig

        public com.pulumi.core.Output<java.util.Optional<InferenceComponentRuntimeConfig>> runtimeConfig()
        Returns:
        Runtime settings for a model that is deployed with an inference component. See `runtimeConfig` Block.
      • specification

        public com.pulumi.core.Output<java.util.Optional<InferenceComponentSpecification>> specification()
        Returns:
        Details about the resources to deploy with this inference component. Exactly one of `specification` or `specifications` must be configured. See `specification` and `specifications` Block.
      • specifications

        public com.pulumi.core.Output<java.util.Optional<java.util.List<InferenceComponentSpecification>>> specifications()
        Returns:
        List of specification objects for the inference component, one per instance type. At least two blocks are required; configure `specification` instead to deploy to a single instance type. Exactly one of `specification` or `specifications` must be configured. See `specification` and `specifications` Block.
      • status

        public com.pulumi.core.Output<java.lang.String> status()
        Returns:
        Status of the inference component (e.g., `InService`, `Creating`, `Updating`, `Failed`, `Deleting`).
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
      • tagsAll

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()
        Returns:
        Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
      • variantName

        public com.pulumi.core.Output<java.lang.String> variantName()
        Returns:
        Name of an existing production variant where you host the inference component. Required for a standard inference component; must be omitted for an adapter inference component (one that sets `baseInferenceComponentName`).
      • get

        public static InferenceComponent get​(java.lang.String name,
                                             com.pulumi.core.Output<java.lang.String> id,
                                             @Nullable
                                             InferenceComponentState state,
                                             @Nullable
                                             com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.