Class CfnInferenceComponent

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggableV2, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.101.0 (build b95fe5d)", date="2024-07-12T19:34:09.341Z") @Stability(Stable) public class CfnInferenceComponent extends CfnResource implements IInspectable, ITaggableV2
Creates an inference component, which is a SageMaker hosting object that you can use to deploy a model to an endpoint.

In the inference component settings, you specify the model, the endpoint, and how the model utilizes the resources that the endpoint hosts. 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. After you deploy an inference component, you can directly invoke the associated model when you use the InvokeEndpoint API action.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.sagemaker.*;
 CfnInferenceComponent cfnInferenceComponent = CfnInferenceComponent.Builder.create(this, "MyCfnInferenceComponent")
         .endpointName("endpointName")
         .runtimeConfig(InferenceComponentRuntimeConfigProperty.builder()
                 .copyCount(123)
                 .currentCopyCount(123)
                 .desiredCopyCount(123)
                 .build())
         .specification(InferenceComponentSpecificationProperty.builder()
                 .computeResourceRequirements(InferenceComponentComputeResourceRequirementsProperty.builder()
                         .maxMemoryRequiredInMb(123)
                         .minMemoryRequiredInMb(123)
                         .numberOfAcceleratorDevicesRequired(123)
                         .numberOfCpuCoresRequired(123)
                         .build())
                 // the properties below are optional
                 .container(InferenceComponentContainerSpecificationProperty.builder()
                         .artifactUrl("artifactUrl")
                         .deployedImage(DeployedImageProperty.builder()
                                 .resolutionTime("resolutionTime")
                                 .resolvedImage("resolvedImage")
                                 .specifiedImage("specifiedImage")
                                 .build())
                         .environment(Map.of(
                                 "environmentKey", "environment"))
                         .image("image")
                         .build())
                 .modelName("modelName")
                 .startupParameters(InferenceComponentStartupParametersProperty.builder()
                         .containerStartupHealthCheckTimeoutInSeconds(123)
                         .modelDataDownloadTimeoutInSeconds(123)
                         .build())
                 .build())
         .variantName("variantName")
         // the properties below are optional
         .endpointArn("endpointArn")
         .inferenceComponentName("inferenceComponentName")
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnInferenceComponent

      protected CfnInferenceComponent(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnInferenceComponent

      protected CfnInferenceComponent(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnInferenceComponent

      @Stability(Stable) public CfnInferenceComponent(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnInferenceComponentProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrCreationTime

      @Stability(Stable) @NotNull public String getAttrCreationTime()
      The time when the inference component was created.
    • getAttrFailureReason

      @Stability(Stable) @NotNull public String getAttrFailureReason()
      The failure reason if the inference component is in a failed state.
    • getAttrInferenceComponentArn

      @Stability(Stable) @NotNull public String getAttrInferenceComponentArn()
      The Amazon Resource Name (ARN) of the inference component.
    • getAttrInferenceComponentStatus

      @Stability(Stable) @NotNull public String getAttrInferenceComponentStatus()
      The status of the inference component.
    • getAttrLastModifiedTime

      @Stability(Stable) @NotNull public String getAttrLastModifiedTime()
      The time when the inference component was last updated.
    • getAttrRuntimeConfigCurrentCopyCount

      @Stability(Stable) @NotNull public Number getAttrRuntimeConfigCurrentCopyCount()
      The number of runtime copies of the model container that are currently deployed.
    • getAttrRuntimeConfigDesiredCopyCount

      @Stability(Stable) @NotNull public Number getAttrRuntimeConfigDesiredCopyCount()
      The number of runtime copies of the model container that you requested to deploy with the inference component.
    • getAttrSpecificationContainerDeployedImage

      @Stability(Stable) @NotNull public IResolvable getAttrSpecificationContainerDeployedImage()
    • getCdkTagManager

      @Stability(Stable) @NotNull public TagManager getCdkTagManager()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getCdkTagManager in interface ITaggableV2
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getEndpointName

      @Stability(Stable) @NotNull public String getEndpointName()
      The name of the endpoint that hosts the inference component.
    • setEndpointName

      @Stability(Stable) public void setEndpointName(@NotNull String value)
      The name of the endpoint that hosts the inference component.
    • getRuntimeConfig

      @Stability(Stable) @NotNull public Object getRuntimeConfig()
      The runtime config for the inference component.
    • setRuntimeConfig

      @Stability(Stable) public void setRuntimeConfig(@NotNull IResolvable value)
      The runtime config for the inference component.
    • setRuntimeConfig

      @Stability(Stable) public void setRuntimeConfig(@NotNull CfnInferenceComponent.InferenceComponentRuntimeConfigProperty value)
      The runtime config for the inference component.
    • getSpecification

      @Stability(Stable) @NotNull public Object getSpecification()
      The specification for the inference component.
    • setSpecification

      @Stability(Stable) public void setSpecification(@NotNull IResolvable value)
      The specification for the inference component.
    • setSpecification

      @Stability(Stable) public void setSpecification(@NotNull CfnInferenceComponent.InferenceComponentSpecificationProperty value)
      The specification for the inference component.
    • getVariantName

      @Stability(Stable) @NotNull public String getVariantName()
      The name of the production variant that hosts the inference component.
    • setVariantName

      @Stability(Stable) public void setVariantName(@NotNull String value)
      The name of the production variant that hosts the inference component.
    • getEndpointArn

      @Stability(Stable) @Nullable public String getEndpointArn()
      The Amazon Resource Name (ARN) of the endpoint that hosts the inference component.
    • setEndpointArn

      @Stability(Stable) public void setEndpointArn(@Nullable String value)
      The Amazon Resource Name (ARN) of the endpoint that hosts the inference component.
    • getInferenceComponentName

      @Stability(Stable) @Nullable public String getInferenceComponentName()
      The name of the inference component.
    • setInferenceComponentName

      @Stability(Stable) public void setInferenceComponentName(@Nullable String value)
      The name of the inference component.
    • getTags

      @Stability(Stable) @Nullable public List<CfnTag> getTags()
      An array of tags to apply to the resource.
    • setTags

      @Stability(Stable) public void setTags(@Nullable List<CfnTag> value)
      An array of tags to apply to the resource.