AWS::DataSync::Task
The AWS::DataSync::Task
resource specifies a task. A task is a set of two
locations (source and destination) and a set of Options
that you use to
control the behavior of a task. If you don't specify Options
when you create a task, AWS DataSync populates them with service defaults.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::DataSync::Task", "Properties" : { "CloudWatchLogGroupArn" :
String
, "DestinationLocationArn" :String
, "Excludes" :[ FilterRule, ... ]
, "Includes" :[ FilterRule, ... ]
, "ManifestConfig" :ManifestConfig
, "Name" :String
, "Options" :Options
, "Schedule" :TaskSchedule
, "SourceLocationArn" :String
, "Tags" :[ Tag, ... ]
, "TaskMode" :String
, "TaskReportConfig" :TaskReportConfig
} }
YAML
Type: AWS::DataSync::Task Properties: CloudWatchLogGroupArn:
String
DestinationLocationArn:String
Excludes:- FilterRule
Includes:- FilterRule
ManifestConfig:ManifestConfig
Name:String
Options:Options
Schedule:TaskSchedule
SourceLocationArn:String
Tags:- Tag
TaskMode:String
TaskReportConfig:TaskReportConfig
Properties
CloudWatchLogGroupArn
-
Specifies the Amazon Resource Name (ARN) of an Amazon CloudWatch log group for monitoring your task.
For Enhanced mode tasks, you don't need to specify anything. DataSync automatically sends logs to a CloudWatch log group named
/aws/datasync
.For more information, see Monitoring data transfers with CloudWatch Logs.
Required: No
Type: String
Pattern:
^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b):logs:[a-z\-0-9]*:[0-9]{12}:log-group:([^:\*]*)(:\*)?$
Maximum:
562
Update requires: No interruption
DestinationLocationArn
-
The Amazon Resource Name (ARN) of an AWS storage resource's location.
Required: Yes
Type: String
Pattern:
^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b):datasync:[a-z\-0-9]+:[0-9]{12}:location/loc-[0-9a-z]{17}$
Maximum:
128
Update requires: Replacement
Excludes
-
Specifies exclude filters that define the files, objects, and folders in your source location that you don't want DataSync to transfer. For more information and examples, see Specifying what DataSync transfers by using filters.
Required: No
Type: Array of FilterRule
Minimum:
0
Maximum:
1
Update requires: No interruption
Includes
-
Specifies include filters that define the files, objects, and folders in your source location that you want DataSync to transfer. For more information and examples, see Specifying what DataSync transfers by using filters.
Required: No
Type: Array of FilterRule
Minimum:
0
Maximum:
1
Update requires: No interruption
ManifestConfig
-
The configuration of the manifest that lists the files or objects that you want DataSync to transfer. For more information, see Specifying what DataSync transfers by using a manifest.
Required: No
Type: ManifestConfig
Update requires: No interruption
Name
-
Specifies the name of your task.
Required: No
Type: String
Pattern:
^[a-zA-Z0-9\s+=._:@/-]+$
Minimum:
1
Maximum:
256
Update requires: No interruption
Options
-
Specifies your task's settings, such as preserving file metadata, verifying data integrity, among other options.
Required: No
Type: Options
Update requires: No interruption
Schedule
-
Specifies a schedule for when you want your task to run. For more information, see Scheduling your task.
Required: No
Type: TaskSchedule
Update requires: No interruption
SourceLocationArn
-
Specifies the ARN of your transfer's source location.
Required: Yes
Type: String
Pattern:
^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b):datasync:[a-z\-0-9]+:[0-9]{12}:location/loc-[0-9a-z]{17}$
Maximum:
128
Update requires: Replacement
-
Specifies the tags that you want to apply to your task.
Tags are key-value pairs that help you manage, filter, and search for your DataSync resources.
Required: No
Type: Array of Tag
Maximum:
50
Update requires: No interruption
TaskMode
-
Specifies one of the following task modes for your data transfer:
-
ENHANCED
- Transfer virtually unlimited numbers of objects with higher performance than Basic mode. Enhanced mode tasks optimize the data transfer process by listing, preparing, transferring, and verifying data in parallel. Enhanced mode is currently available for transfers between Amazon S3 locations.Note
To create an Enhanced mode task, the IAM role that you use to call the
CreateTask
operation must have theiam:CreateServiceLinkedRole
permission. -
BASIC
(default) - Transfer files or objects between AWS storage and all other supported DataSync locations. Basic mode tasks are subject to quotas on the number of files, objects, and directories in a dataset. Basic mode sequentially prepares, transfers, and verifies data, making it slower than Enhanced mode for most workloads.
For more information, see Understanding task mode differences.
Required: No
Type: String
Allowed values:
BASIC | ENHANCED
Update requires: Replacement
-
TaskReportConfig
-
Specifies how you want to configure a task report, which provides detailed information about your DataSync transfer. For more information, see Monitoring your DataSync transfers with task reports.
When using this parameter, your caller identity (the role that you're using DataSync with) must have the
iam:PassRole
permission. The AWSDataSyncFullAccess policy includes this permission.Required: No
Type: TaskReportConfig
Update requires: No interruption
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref
function, Ref
returns the location resource ARN. For example:
arn:aws:datasync:us-east-2:111222333444:task/task-07db7abfc326c50s3
For more information about using the Ref
function, see 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
.
DestinationNetworkInterfaceArns
-
The ARNs of the destination elastic network interfaces (ENIs) that were created for your subnet.
SourceNetworkInterfaceArns
-
The ARNs of the source ENIs that were created for your subnet.
Status
-
The status of the task that was described.
TaskArn
-
The ARN of the task.
Examples
Creating an Enhanced mode task
The following examples create an Enhanced mode task. For more information, see Choosing a task mode for your data transfer.
JSON
{ "AWSTemplateFormatVersion": "2010-09-09", "Description": "Creates a DataSync task that uses Enhanced mode", "Resources": { "Task": { "Type": "AWS::DataSync::Task", "Properties": { "SourceLocationArn": "arn:aws:datasync:us-east-2:111222333444:location/loc-1111aaaa2222bbbb3", "DestinationLocationArn": "arn:aws:datasync:us-east-2:111222333444:location/loc-0000zzzz1111yyyy2", "Name": "My-Enhanced-mode-task", "TaskMode": "ENHANCED", "Options": { "TransferMode": "CHANGED", "VerifyMode": "ONLY_FILES_TRANSFERRED", "ObjectTags": "PRESERVE", "LogLevel": "TRANSFER" } } } } }
YAML
AWSTemplateFormatVersion: 2010-09-09 Description: Creates a DataSync task that uses Enhanced mode Resources: Task: Type: AWS::DataSync::Task Properties: SourceLocationArn: arn:aws:datasync:us-east-2:111222333444:location/loc-1111aaaa2222bbbb3 DestinationLocationArn: arn:aws:datasync:us-east-2:111222333444:location/loc-0000zzzz1111yyyy2 Name: My-Enhanced-mode-task TaskMode: ENHANCED Options: TransferMode: CHANGED VerifyMode: ONLY_FILES_TRANSFERRED ObjectTags: PRESERVE LogLevel: TRANSFER
Creating a Basic mode task
The following examples create a Basic mode task. For more information, see Choosing a task mode for your data transfer.
JSON
{ "AWSTemplateFormatVersion": "2010-09-09", "Description": "Creates a DataSync task that uses Basic mode", "Resources": { "Task": { "Type": "AWS::DataSync::Task", "Properties": { "SourceLocationArn": "arn:aws:datasync:us-east-2:111222333444:location/loc-1111aaaa2222bbbb3", "DestinationLocationArn": "arn:aws:datasync:us-east-2:111222333444:location/loc-0000zzzz1111yyyy2", "Name": "My-Basic-mode-task", "TaskMode": "BASIC", "Options": { "TransferMode": "CHANGED", "VerifyMode": "POINT_IN_TIME_CONSISTENT", "LogLevel": "TRANSFER" }, "CloudWatchLogGroupArn": "arn:aws:logs:us-east-2:111222333444:log-group:/my-log-group-name:*" } } } }
YAML
AWSTemplateFormatVersion: 2010-09-09 Description: Creates a DataSync task that uses Basic mode Resources: Task: Type: AWS::DataSync::Task Properties: SourceLocationArn: arn:aws:datasync:us-east-2:111222333444:location/loc-1111aaaa2222bbbb3 DestinationLocationArn: arn:aws:datasync:us-east-2:111222333444:location/loc-0000zzzz1111yyyy2 Name: My-Basic-mode-task TaskMode: BASIC Options: TransferMode: CHANGED VerifyMode: POINT_IN_TIME_CONSISTENT LogLevel: TRANSFER CloudWatchLogGroupArn: arn:aws:logs:us-east-2:111222333444:log-group:/my-log-group-name:*