Step 3: Create a Task - AWS DataSync

Step 3: Create a Task

After you have created an agent and configured your source and destination, you create a task, as described following.

To create a task using the CLI

  1. Create a CloudWatch Logs group using the following command.

    $ aws logs create-log-group --log-group-name your-log-group
  2. Attach an IAM resource policy to your CloudWatch Logs group. For instructions on how to attach the policy, see Allowing DataSync to Upload Logs to Amazon CloudWatch Log Groups.

  3. Create a task by using the following command.

    $ aws datasync create-task --source-location-arn 'arn:aws:datasync:region:account-id:location/location-id' --destination-location-arn 'arn:aws:datasync:region:account-id:location/location-id' --cloud-watch-log-group-arn 'arn:aws:logs:region:account-id:log-group:log-group' --name task-name

    This command returns the Amazon Resource Name (ARN) for a task, similar to the one shown following.

    { "TaskArn": "arn:aws:datasync:us-east-1:111222333444:task/task-08de6e6697796f026" }

Your task is created with the default configuration options. If you want to configure different options as part of your task creation, add the --options parameter to your create-task command. The following example shows how to specify different options. For a description of these options, see Options.

$ aws datasync create-task --source-location-arn 'arn:aws:datasync:region:account-id:location/location-id' --destination-location-arn 'arn:aws:datasync:region:account-id:location/location-id' --cloud-watch-log-group-arn 'arn:aws:logs:region:account-id:log-group:log-group' --name task-name --options VerifyMode=NONE,OverwriteMode=NEVER,Atime=BEST_EFFORT,Mtime=PRESERVE,Uid=INT_VALUE,Gid=INT_VALUE,PreserveDevices=PRESERVE,PosixPermissions=PRESERVE,PreserveDeletedFiles=PRESERVE,TaskQueueing=ENABLED,LogLevel=TRANSFER

When you create a task, you can optionally configure the task to exclude specific files, folders, and objects from the transfer. For more information, see Filtering the Data Transferred by AWS DataSync. You can also configure your task to run a schedule you specify, with a minimum interval of 1 hour. For more information, see Scheduling Your Task.


If a task remains in the CREATING status for more than a few minutes, your agent might be having trouble mounting the NFS file system. Check the task's ErrorCode and ErrorDetail values. Mount issues are often caused by either misconfigured firewalls or a mistyped NFS server host name.