Skip to content

Task

Source: src/AWS/DataSync/Task.ts

A DataSync task — the transfer definition binding a source location to a destination location, together with the filters, schedule, and transfer options that govern each run.

Creating the task does not move any data; it defines the transfer. Start a run with StartTaskExecution (or attach a schedule). Source and destination locations and the task mode are immutable; everything else (name, options, filters, schedule, log group, tags) is updated in place.

S3 → S3 transfer

import * as AWS from "alchemy/AWS";
const task = yield* AWS.DataSync.Task("Backup", {
sourceLocationArn: source.locationArn,
destinationLocationArn: dest.locationArn,
});

With verification and a schedule

const task = yield* AWS.DataSync.Task("Nightly", {
sourceLocationArn: source.locationArn,
destinationLocationArn: dest.locationArn,
options: { VerifyMode: "ONLY_FILES_TRANSFERRED" },
schedule: { ScheduleExpression: "cron(0 2 * * ? *)" },
});