Step 5: Use the CLI to Monitor Your Task Execution - AWS DataSync

Step 5: Use the CLI to Monitor Your Task Execution

Use the CLI to monitor the status of your task execution by using the describe-task-execution command.

$ aws datasync describe-task-execution --task-execution-arn 'arn:aws:datasync:region:account-id:task/task-id/execution/task-execution-id'

This command returns information about a task execution similar to that shown following.

{ "TaskExecutionArn": "arn:aws:datasync:us-east-1:112233445566:task/task-08de6e6697796f026/execution/exec-04ce9d516d69bd52f", "Status": "VERIFYING", "Options": { "VerifyMode": "POINT_IN_TIME_CONSISTENT", "Atime": "BEST_EFFORT", "Mtime": "PRESERVE", "Uid": "INT_VALUE", "Gid": "INT_VALUE", "PreserveDevices": "NONE", "PosixPermissions": "PRESERVE", "PreserveDeletedFiles": "PRESERVE" "OverwriteMode": "NEVER", "TaskQueueing": "ENABLED" }, "StartTime": 1532658526.949, "EstimatedFilesToTransfer": 0, "EstimatedBytesToTransfer": 0, "FilesTransferred": 0, "BytesWritten": 0, "BytesTransferred": 0, "Result": { "PrepareDuration": 4355, "PrepareStatus": "Ok", "TransferDuration": 5889, "TransferStatus": "Ok", "VerifyDuration": 4538, "VerifyStatus": "Pending" } }

If the task execution succeeds, the value of Status changes to SUCCESS. If the describe-task-execution command fails, the result sends error codes that can help you troubleshoot issues. For information about the error codes, see TaskExecutionResultDetail in the DataSync API Reference.

Monitor Your Task Execution in Real Time

To monitor the progress of your task execution in real time from the command line, you can use the standard Unix watch utility. The watch utility doesn't recognize the DataSync alias, so invoke the CLI directly as shown in the example following.

# pass '-n 1' to update every second and '-d' to highlight differences $ watch -n 1 -d \ "aws datasync describe-task-execution --task-execution-arn 'arn:aws:datasync:region:account-id:task/task-id/execution/task execution-id'"