Skip to content

Resource: awsSagemakerFlowDefinition

Provides a SageMaker Flow Definition resource.

Example Usage

Basic Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.sagemakerFlowDefinition.SagemakerFlowDefinition(this, "example", {
  flowDefinitionName: "example",
  humanLoopConfig: {
    humanTaskUiArn: "${aws_sagemaker_human_task_ui.example.arn}",
    taskAvailabilityLifetimeInSeconds: 1,
    taskCount: 1,
    taskDescription: "example",
    taskTitle: "example",
    workteamArn: "${aws_sagemaker_workteam.example.arn}",
  },
  outputConfig: {
    s3OutputPath: "s3://${aws_s3_bucket.example.bucket}/",
  },
  roleArn: "${aws_iam_role.example.arn}",
});

Public Workteam Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.sagemakerFlowDefinition.SagemakerFlowDefinition(this, "example", {
  flowDefinitionName: "example",
  humanLoopConfig: {
    humanTaskUiArn: "${aws_sagemaker_human_task_ui.example.arn}",
    publicWorkforceTaskPrice: {
      amountInUsd: {
        cents: 1,
        tenthFractionsOfACent: 2,
      },
    },
    taskAvailabilityLifetimeInSeconds: 1,
    taskCount: 1,
    taskDescription: "example",
    taskTitle: "example",
    workteamArn:
      "arn:aws:sagemaker:${data.aws_region.current.name}:394669845002:workteam/public-crowd/default",
  },
  outputConfig: {
    s3OutputPath: "s3://${aws_s3_bucket.example.bucket}/",
  },
  roleArn: "${aws_iam_role.example.arn}",
});

Human Loop Activation Config Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.sagemakerFlowDefinition.SagemakerFlowDefinition(this, "example", {
  flowDefinitionName: "example",
  humanLoopActivationConfig: {
    humanLoopActivationConditionsConfig: {
      humanLoopActivationConditions:
        '        {\n\t\t\t"Conditions": [\n\t\t\t  {\n\t\t\t\t"ConditionType": "Sampling",\n\t\t\t\t"ConditionParameters": {\n\t\t\t\t  "RandomSamplingPercentage": 5\n\t\t\t\t}\n\t\t\t  }\n\t\t\t]\n\t\t}\n',
    },
  },
  humanLoopConfig: {
    humanTaskUiArn: "${aws_sagemaker_human_task_ui.example.arn}",
    taskAvailabilityLifetimeInSeconds: 1,
    taskCount: 1,
    taskDescription: "example",
    taskTitle: "example",
    workteamArn: "${aws_sagemaker_workteam.example.arn}",
  },
  humanLoopRequestSource: {
    awsManagedHumanLoopRequestSource: "AWS/Textract/AnalyzeDocument/Forms/V1",
  },
  outputConfig: {
    s3OutputPath: "s3://${aws_s3_bucket.example.bucket}/",
  },
  roleArn: "${aws_iam_role.example.arn}",
});

Argument Reference

The following arguments are supported:

  • flowDefinitionName - (Required) The name of your flow definition.
  • humanLoopConfig - (Required) An object containing information about the tasks the human reviewers will perform. See Human Loop Config details below.
  • roleArn - (Required) The Amazon Resource Name (ARN) of the role needed to call other services on your behalf.
  • outputConfig - (Required) An object containing information about where the human review results will be uploaded. See Output Config details below.
  • humanLoopActivationConfig - (Optional) An object containing information about the events that trigger a human workflow. See Human Loop Activation Config details below.
  • humanLoopRequestSource - (Optional) Container for configuring the source of human task requests. Use to specify if Amazon Rekognition or Amazon Textract is used as an integration source. See Human Loop Request Source details below.
  • tags - (Optional) A 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.

Human Loop Config

  • humanTaskUiArn - (Required) The Amazon Resource Name (ARN) of the human task user interface.
  • publicWorkforceTaskPrice - (Optional) Defines the amount of money paid to an Amazon Mechanical Turk worker for each task performed. See Public Workforce Task Price details below.
  • taskAvailabilityLifetimeInSeconds - (Required) The length of time that a task remains available for review by human workers. Valid value range between 1 and 864000.
  • taskCount - (Required) The number of distinct workers who will perform the same task on each object. Valid value range between 1 and 3.
  • taskDescription - (Required) A description for the human worker task.
  • taskKeywords - (Optional) An array of keywords used to describe the task so that workers can discover the task.
  • taskTimeLimitInSeconds - (Optional) The amount of time that a worker has to complete a task. The default value is 3600 seconds.
  • taskTitle - (Required) A title for the human worker task.
  • workteamArn - (Required) The Amazon Resource Name (ARN) of the human task user interface. Amazon Resource Name (ARN) of a team of workers. For Public workforces see AWS Docs.

Public Workforce Task Price

  • amountInUsd - (Optional) Defines the amount of money paid to an Amazon Mechanical Turk worker in United States dollars. See Amount In Usd details below.
Amount In Usd
  • cents - (Optional) The fractional portion, in cents, of the amount. Valid value range between 0 and 99.
  • dollars - (Optional) The whole number of dollars in the amount. Valid value range between 0 and 2.
  • tenthFractionsOfACent - (Optional) Fractions of a cent, in tenths. Valid value range between 0 and 9.

Human Loop Activation Config

Human Loop Activation Conditions Config

Human Loop Request Source

  • awsManagedHumanLoopRequestSource - (Required) Specifies whether Amazon Rekognition or Amazon Textract are used as the integration source. Valid values are: aws/rekognition/detectModerationLabels/image/v3 and aws/textract/analyzeDocument/forms/v1.

Output Config

  • s3OutputPath - (Required) The Amazon S3 path where the object containing human output will be made available.
  • kmsKeyId - (Optional) The Amazon Key Management Service (KMS) key ARN for server-side encryption.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - The Amazon Resource Name (ARN) assigned by AWS to this Flow Definition.
  • id - The name of the Flow Definition.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

SageMaker Flow Definitions can be imported using the flowDefinitionName, e.g.,

$ terraform import aws_sagemaker_flow_definition.example example