S3Location

class aws_cdk.aws_stepfunctions_tasks.S3Location

Bases: object

Constructs IS3Location objects.

ExampleMetadata:

infused

Example:

tasks.SageMakerCreateTrainingJob(self, "TrainSagemaker",
    training_job_name=sfn.JsonPath.string_at("$.JobName"),
    algorithm_specification=tasks.AlgorithmSpecification(
        algorithm_name="BlazingText",
        training_input_mode=tasks.InputMode.FILE
    ),
    input_data_config=[tasks.Channel(
        channel_name="train",
        data_source=tasks.DataSource(
            s3_data_source=tasks.S3DataSource(
                s3_data_type=tasks.S3DataType.S3_PREFIX,
                s3_location=tasks.S3Location.from_json_expression("$.S3Bucket")
            )
        )
    )],
    output_data_config=tasks.OutputDataConfig(
        s3_output_location=tasks.S3Location.from_bucket(s3.Bucket.from_bucket_name(self, "Bucket", "mybucket"), "myoutputpath")
    ),
    resource_config=tasks.ResourceConfig(
        instance_count=1,
        instance_type=ec2.InstanceType(sfn.JsonPath.string_at("$.InstanceType")),
        volume_size=Size.gibibytes(50)
    ),  # optional: default is 1 instance of EC2 `M4.XLarge` with `10GB` volume
    stopping_condition=tasks.StoppingCondition(
        max_runtime=Duration.hours(2)
    )
)

Methods

abstract bind(task, *, for_reading=None, for_writing=None)

Called when the S3Location is bound to a StepFunctions task.

Parameters:
  • task (ISageMakerTask) –

  • for_reading (Optional[bool]) – Allow reading from the S3 Location. Default: false

  • for_writing (Optional[bool]) – Allow writing to the S3 Location. Default: false

Return type:

S3LocationConfig

Static Methods

classmethod from_bucket(bucket, key_prefix)

An IS3Location built with a determined bucket and key prefix.

Parameters:
  • bucket (IBucket) – is the bucket where the objects are to be stored.

  • key_prefix (str) – is the key prefix used by the location.

Return type:

S3Location

classmethod from_json_expression(expression)

An IS3Location determined fully by a JSON Path from the task input.

Due to the dynamic nature of those locations, the IAM grants that will be set by grantRead and grantWrite apply to the * resource.

Parameters:

expression (str) – the JSON expression resolving to an S3 location URI.

Return type:

S3Location