aws-cdk-lib.aws_stepfunctions_tasks.ResourceConfig

interface ResourceConfig

LanguageType name
.NETAmazon.CDK.AWS.StepFunctions.Tasks.ResourceConfig
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsstepfunctionstasks#ResourceConfig
Javasoftware.amazon.awscdk.services.stepfunctions.tasks.ResourceConfig
Pythonaws_cdk.aws_stepfunctions_tasks.ResourceConfig
TypeScript (source)aws-cdk-lib » aws_stepfunctions_tasks » ResourceConfig

Specifies the resources, ML compute instances, and ML storage volumes to deploy for model training.

Example

new tasks.SageMakerCreateTrainingJob(this, 'TrainSagemaker', {
  trainingJobName: sfn.JsonPath.stringAt('$.JobName'),
  algorithmSpecification: {
    algorithmName: 'BlazingText',
    trainingInputMode: tasks.InputMode.FILE,
  },
  inputDataConfig: [{
    channelName: 'train',
    dataSource: {
      s3DataSource: {
        s3DataType: tasks.S3DataType.S3_PREFIX,
        s3Location: tasks.S3Location.fromJsonExpression('$.S3Bucket'),
      },
    },
  }],
  outputDataConfig: {
    s3OutputLocation: tasks.S3Location.fromBucket(s3.Bucket.fromBucketName(this, 'Bucket', 'mybucket'), 'myoutputpath'),
  },
  resourceConfig: {
    instanceCount: 1,
    instanceType: new ec2.InstanceType(sfn.JsonPath.stringAt('$.InstanceType')),
    volumeSize: Size.gibibytes(50),
  }, // optional: default is 1 instance of EC2 `M4.XLarge` with `10GB` volume
  stoppingCondition: {
    maxRuntime: Duration.hours(2),
  }, // optional: default is 1 hour
});

Properties

NameTypeDescription
instanceCountnumberThe number of ML compute instances to use.
instanceTypeInstanceTypeML compute instance type.
volumeSizeSizeSize of the ML storage volume that you want to provision.
volumeEncryptionKey?IKeyKMS key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance(s) that run the training job.

instanceCount

Type: number

The number of ML compute instances to use.


instanceType

Type: InstanceType

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 ec2.InstanceType(sfn.JsonPath.stringAt('$.path.to.instanceType'));

See also: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ResourceConfig.html#sagemaker-Type-ResourceConfig-InstanceType


volumeSize

Type: Size

Size of the ML storage volume that you want to provision.


volumeEncryptionKey?

Type: IKey (optional, default: Amazon SageMaker uses the default KMS key for Amazon S3 for your role's account)

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.