Interface ResourceConfig

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
ResourceConfig.Jsii$Proxy

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-25T14:21:24.594Z") @Stability(Stable) public interface ResourceConfig extends software.amazon.jsii.JsiiSerializable
Specifies the resources, ML compute instances, and ML storage volumes to deploy for model training.

Example:

 SageMakerCreateTrainingJob.Builder.create(this, "TrainSagemaker")
         .trainingJobName(JsonPath.stringAt("$.JobName"))
         .algorithmSpecification(AlgorithmSpecification.builder()
                 .algorithmName("BlazingText")
                 .trainingInputMode(InputMode.FILE)
                 .build())
         .inputDataConfig(List.of(Channel.builder()
                 .channelName("train")
                 .dataSource(DataSource.builder()
                         .s3DataSource(S3DataSource.builder()
                                 .s3DataType(S3DataType.S3_PREFIX)
                                 .s3Location(S3Location.fromJsonExpression("$.S3Bucket"))
                                 .build())
                         .build())
                 .build()))
         .outputDataConfig(OutputDataConfig.builder()
                 .s3OutputLocation(S3Location.fromBucket(Bucket.fromBucketName(this, "Bucket", "amzn-s3-demo-bucket"), "myoutputpath"))
                 .build())
         .resourceConfig(ResourceConfig.builder()
                 .instanceCount(1)
                 .instanceType(new InstanceType(JsonPath.stringAt("$.InstanceType")))
                 .volumeSize(Size.gibibytes(50))
                 .build()) // optional: default is 1 instance of EC2 `M4.XLarge` with `10GB` volume
         .stoppingCondition(StoppingCondition.builder()
                 .maxRuntime(Duration.hours(2))
                 .build())
         .build();
 
  • Method Details

    • getInstanceCount

      @Stability(Stable) @NotNull Number getInstanceCount()
      The number of ML compute instances to use.

      Default: 1 instance.

    • getInstanceType

      @Stability(Stable) @NotNull InstanceType getInstanceType()
      ML compute instance type.

      To provide an instance type from the task input, supply an instance type in the following way where the value in the task input is an EC2 instance type prepended with "ml.":

       new InstanceType(JsonPath.stringAt("$.path.to.instanceType"));
       

      Default: ec2.InstanceType(ec2.InstanceClass.M4, ec2.InstanceType.XLARGE)

      See Also:
    • getVolumeSize

      @Stability(Stable) @NotNull Size getVolumeSize()
      Size of the ML storage volume that you want to provision.

      Default: 10 GB EBS volume.

    • getVolumeEncryptionKey

      @Stability(Stable) @Nullable default IKey getVolumeEncryptionKey()
      KMS key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance(s) that run the training job.

      Default: - Amazon SageMaker uses the default KMS key for Amazon S3 for your role's account

    • builder

      @Stability(Stable) static ResourceConfig.Builder builder()
      Returns:
      a ResourceConfig.Builder of ResourceConfig