AWS::Transfer::Workflow - Amazon CloudFormation
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

AWS::Transfer::Workflow

Allows you to create a workflow with specified steps and step details the workflow invokes after file transfer completes. After creating a workflow, you can associate the workflow created with any transfer servers by specifying the workflow-details field in CreateServer and UpdateServer operations.

Syntax

To declare this entity in your Amazon CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::Transfer::Workflow", "Properties" : { "Description" : String, "OnExceptionSteps" : [ WorkflowStep, ... ], "Steps" : [ WorkflowStep, ... ], "Tags" : [ Tag, ... ] } }

YAML

Type: AWS::Transfer::Workflow Properties: Description: String OnExceptionSteps: - WorkflowStep Steps: - WorkflowStep Tags: - Tag

Properties

Description

Specifies the text description for the workflow.

Required: No

Type: String

Pattern: ^[\w\- ]*$

Minimum: 0

Maximum: 256

Update requires: Replacement

OnExceptionSteps

Specifies the steps (actions) to take if errors are encountered during execution of the workflow.

Required: No

Type: Array of WorkflowStep

Maximum: 8

Update requires: Replacement

Steps

Specifies the details for the steps that are in the specified workflow.

Required: Yes

Type: Array of WorkflowStep

Maximum: 8

Update requires: Replacement

Tags

Key-value pairs that can be used to group and search for workflows. Tags are metadata attached to workflows for any purpose.

Required: No

Type: Array of Tag

Maximum: 50

Update requires: No interruption

Return values

Ref

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

WorkflowId

A unique identifier for a workflow.

Examples

Create workflow from a file

You can save workflow step information into a text file, and then use that file to create a workflow, as in the following example. The following example assumes you have saved your workflow steps into example-file.json (in the same folder from where you run the command), and that you wish to create the workflow in the N. Virginia (us-east-1) region.

aws transfer create-workflow --description "example workflow from a file" --steps file://example-file.json --region us-east-1

Create workflow from a template

You can create a workflow from a template. First, open the CloudFormation console. Next, follow the instructions for deploying Amazon CloudFormation stack from an existing template in Selecting a stack template in the Amazon CloudFormation User Guide.

Save the following code to a file, and upload it to CloudFormation when prompted, making sure to replace items as follows:

  • Replace your-workflow-execution-role-arn with the ARN for an actual workflow execution role.

  • replace arn:${Amazon::Partition}:lambda:${Amazon::Region}:${Amazon::AccountId}:function:my-function-name with the ARN for your Lambda function. For example, arn:aws:lambda:us-east-2:123456789012:function:example-lambda-idp.

JSON

{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "SFTPServer": { "Type": "AWS::Transfer::Server", "Properties": { "WorkflowDetails": { "OnUpload": [ { "ExecutionRole": "your-workflow-execution-role-arn", "WorkflowId": { "Fn::GetAtt": [ "TransferWorkflow", "WorkflowId" ] } } ] } } }, "TransferWorkflow": { "Type": "AWS::Transfer::Workflow", "Properties": { "Description": "Transfer Family Workflows Blog", "Steps": [ { "Type": "COPY", "CopyStepDetails": { "Name": "copyToUserKey", "DestinationFileLocation": { "S3FileLocation": { "Bucket": "archived-records", "Key": "${transfer:UserName}/" } }, "OverwriteExisting": "TRUE" } }, { "Type": "TAG", "TagStepDetails": { "Name": "tagFileForArchive", "Tags": [ { "Key": "Archive", "Value": "yes" } ] } }, { "Type": "CUSTOM", "CustomStepDetails": { "Name": "transferExtract", "Target": "arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:my-function-name", "TimeoutSeconds": 60 } }, { "Type": "DELETE", "DeleteStepDetails": { "Name": "DeleteInputFile", "SourceFileLocation": "${original.file}" } } ], "Tags": [ { "Key": "Name", "Value": "TransferFamilyWorkflows" } ] } } } }

YAML

AWSTemplateFormatVersion: 2010-09-09 Resources: SFTPServer: Type: 'AWS::Transfer::Server' Properties: WorkflowDetails: OnUpload: - ExecutionRole: your-workflow-execution-role-arn WorkflowId: !GetAtt - TransferWorkflow - WorkflowId TransferWorkflow: Type: AWS::Transfer::Workflow Properties: Description: Transfer Family Workflows Blog Steps: - Type: COPY CopyStepDetails: Name: copyToUserKey DestinationFileLocation: S3FileLocation: Bucket: archived-records Key: ${transfer:UserName}/ OverwriteExisting: 'TRUE' - Type: TAG TagStepDetails: Name: tagFileForArchive Tags: - Key: Archive Value: yes - Type: CUSTOM CustomStepDetails: Name: transferExtract Target: arn:${Amazon::Partition}:lambda:${Amazon::Region}:${Amazon::AccountId}:function:my-function-name TimeoutSeconds: 60 - Type: DELETE DeleteStepDetails: Name: DeleteInputFile SourceFileLocation: '${original.file}' Tags: - Key: Name Value: TransferFamilyWorkflows