CancelTaskExecutionCommand

Stops an DataSync task execution that's in progress. The transfer of some files are abruptly interrupted. File contents that're transferred to the destination might be incomplete or inconsistent with the source files.

However, if you start a new task execution using the same task and allow it to finish, file content on the destination will be complete and consistent. This applies to other unexpected failures that interrupt a task execution. In all of these cases, DataSync successfully completes the transfer when you start the next task execution.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { DataSyncClient, CancelTaskExecutionCommand } from "@aws-sdk/client-datasync"; // ES Modules import
// const { DataSyncClient, CancelTaskExecutionCommand } = require("@aws-sdk/client-datasync"); // CommonJS import
const client = new DataSyncClient(config);
const input = { // CancelTaskExecutionRequest
  TaskExecutionArn: "STRING_VALUE", // required
};
const command = new CancelTaskExecutionCommand(input);
const response = await client.send(command);
// {};

CancelTaskExecutionCommand Input

See CancelTaskExecutionCommandInput for more details

Parameter
Type
Description
TaskExecutionArn
Required
string | undefined

The Amazon Resource Name (ARN) of the task execution to stop.

CancelTaskExecutionCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
InternalException
server

This exception is thrown when an error occurs in the DataSync service.

InvalidRequestException
client

This exception is thrown when the client submits a malformed request.

DataSyncServiceException
Base exception class for all service exceptions from DataSync service.