Task class

Manages an AWS DataSync Task, which represents a configuration for synchronization. Starting an execution of these DataSync Tasks (actually synchronizing files) is performed outside of this resource.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.datasync.Task("example", {
    options: {
        bytesPerSecond: -1,
    },
    destinationLocationArn: destination.arn,
    name: "example",
    sourceLocationArn: source.arn,
});
import pulumi
import pulumi_aws as aws

example = aws.datasync.Task("example",
    options={
        "bytes_per_second": -1,
    },
    destination_location_arn=destination["arn"],
    name="example",
    source_location_arn=source["arn"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.DataSync.Task("example", new()
    {
        Options = new Aws.DataSync.Inputs.TaskOptionsArgs
        {
            BytesPerSecond = -1,
        },
        DestinationLocationArn = destination.Arn,
        Name = "example",
        SourceLocationArn = source.Arn,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/datasync"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := datasync.NewTask(ctx, "example", &datasync.TaskArgs{
			Options: &datasync.TaskOptionsArgs{
				BytesPerSecond: pulumi.Int(-1),
			},
			DestinationLocationArn: pulumi.Any(destination.Arn),
			Name:                   pulumi.String("example"),
			SourceLocationArn:      pulumi.Any(source.Arn),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_datasync_task" "example" {
  options = {
    bytes_per_second = -1
  }
  destination_location_arn = destination.arn
  name                     = "example"
  source_location_arn      = source.arn
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.datasync.Task;
import com.pulumi.aws.datasync.TaskArgs;
import com.pulumi.aws.datasync.inputs.TaskOptionsArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new Task("example", TaskArgs.builder()
            .options(TaskOptionsArgs.builder()
                .bytesPerSecond(-1)
                .build())
            .destinationLocationArn(destination.arn())
            .name("example")
            .sourceLocationArn(source.arn())
            .build());

    }
}
resources:
  example:
    type: aws:datasync:Task
    properties:
      options:
        bytesPerSecond: -1
      destinationLocationArn: ${destination.arn}
      name: example
      sourceLocationArn: ${source.arn}

Example Usage with Scheduling

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.datasync.Task("example", {
    schedule: {
        scheduleExpression: "cron(0 12 ? * SUN,WED *)",
    },
    destinationLocationArn: destination.arn,
    name: "example",
    sourceLocationArn: source.arn,
});
import pulumi
import pulumi_aws as aws

example = aws.datasync.Task("example",
    schedule={
        "schedule_expression": "cron(0 12 ? * SUN,WED *)",
    },
    destination_location_arn=destination["arn"],
    name="example",
    source_location_arn=source["arn"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.DataSync.Task("example", new()
    {
        Schedule = new Aws.DataSync.Inputs.TaskScheduleArgs
        {
            ScheduleExpression = "cron(0 12 ? * SUN,WED *)",
        },
        DestinationLocationArn = destination.Arn,
        Name = "example",
        SourceLocationArn = source.Arn,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/datasync"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := datasync.NewTask(ctx, "example", &datasync.TaskArgs{
			Schedule: &datasync.TaskScheduleArgs{
				ScheduleExpression: pulumi.String("cron(0 12 ? * SUN,WED *)"),
			},
			DestinationLocationArn: pulumi.Any(destination.Arn),
			Name:                   pulumi.String("example"),
			SourceLocationArn:      pulumi.Any(source.Arn),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_datasync_task" "example" {
  schedule = {
    schedule_expression = "cron(0 12 ? * SUN,WED *)"
  }
  destination_location_arn = destination.arn
  name                     = "example"
  source_location_arn      = source.arn
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.datasync.Task;
import com.pulumi.aws.datasync.TaskArgs;
import com.pulumi.aws.datasync.inputs.TaskScheduleArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new Task("example", TaskArgs.builder()
            .schedule(TaskScheduleArgs.builder()
                .scheduleExpression("cron(0 12 ? * SUN,WED *)")
                .build())
            .destinationLocationArn(destination.arn())
            .name("example")
            .sourceLocationArn(source.arn())
            .build());

    }
}
resources:
  example:
    type: aws:datasync:Task
    properties:
      schedule:
        scheduleExpression: cron(0 12 ? * SUN,WED *)
      destinationLocationArn: ${destination.arn}
      name: example
      sourceLocationArn: ${source.arn}

Example Usage with Filtering

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.datasync.Task("example", {
    excludes: {
        filterType: "SIMPLE_PATTERN",
        value: "/folder1|/folder2",
    },
    includes: {
        filterType: "SIMPLE_PATTERN",
        value: "/folder1|/folder2",
    },
    destinationLocationArn: destination.arn,
    name: "example",
    sourceLocationArn: source.arn,
});
import pulumi
import pulumi_aws as aws

example = aws.datasync.Task("example",
    excludes={
        "filter_type": "SIMPLE_PATTERN",
        "value": "/folder1|/folder2",
    },
    includes={
        "filter_type": "SIMPLE_PATTERN",
        "value": "/folder1|/folder2",
    },
    destination_location_arn=destination["arn"],
    name="example",
    source_location_arn=source["arn"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.DataSync.Task("example", new()
    {
        Excludes = new Aws.DataSync.Inputs.TaskExcludesArgs
        {
            FilterType = "SIMPLE_PATTERN",
            Value = "/folder1|/folder2",
        },
        Includes = new Aws.DataSync.Inputs.TaskIncludesArgs
        {
            FilterType = "SIMPLE_PATTERN",
            Value = "/folder1|/folder2",
        },
        DestinationLocationArn = destination.Arn,
        Name = "example",
        SourceLocationArn = source.Arn,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/datasync"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := datasync.NewTask(ctx, "example", &datasync.TaskArgs{
			Excludes: &datasync.TaskExcludesArgs{
				FilterType: pulumi.String("SIMPLE_PATTERN"),
				Value:      pulumi.String("/folder1|/folder2"),
			},
			Includes: &datasync.TaskIncludesArgs{
				FilterType: pulumi.String("SIMPLE_PATTERN"),
				Value:      pulumi.String("/folder1|/folder2"),
			},
			DestinationLocationArn: pulumi.Any(destination.Arn),
			Name:                   pulumi.String("example"),
			SourceLocationArn:      pulumi.Any(source.Arn),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_datasync_task" "example" {
  excludes = {
    filter_type = "SIMPLE_PATTERN"
    value       = "/folder1|/folder2"
  }
  includes = {
    filter_type = "SIMPLE_PATTERN"
    value       = "/folder1|/folder2"
  }
  destination_location_arn = destination.arn
  name                     = "example"
  source_location_arn      = source.arn
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.datasync.Task;
import com.pulumi.aws.datasync.TaskArgs;
import com.pulumi.aws.datasync.inputs.TaskExcludesArgs;
import com.pulumi.aws.datasync.inputs.TaskIncludesArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new Task("example", TaskArgs.builder()
            .excludes(TaskExcludesArgs.builder()
                .filterType("SIMPLE_PATTERN")
                .value("/folder1|/folder2")
                .build())
            .includes(TaskIncludesArgs.builder()
                .filterType("SIMPLE_PATTERN")
                .value("/folder1|/folder2")
                .build())
            .destinationLocationArn(destination.arn())
            .name("example")
            .sourceLocationArn(source.arn())
            .build());

    }
}
resources:
  example:
    type: aws:datasync:Task
    properties:
      excludes:
        filterType: SIMPLE_PATTERN
        value: /folder1|/folder2
      includes:
        filterType: SIMPLE_PATTERN
        value: /folder1|/folder2
      destinationLocationArn: ${destination.arn}
      name: example
      sourceLocationArn: ${source.arn}

Example Usage with Enhanced Task Mode

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.datasync.Task("example", {
    options: {
        gid: "NONE",
        posixPermissions: "NONE",
        uid: "NONE",
        verifyMode: "ONLY_FILES_TRANSFERRED",
    },
    destinationLocationArn: destination.arn,
    name: "example",
    sourceLocationArn: source.arn,
    taskMode: "ENHANCED",
});
import pulumi
import pulumi_aws as aws

example = aws.datasync.Task("example",
    options={
        "gid": "NONE",
        "posix_permissions": "NONE",
        "uid": "NONE",
        "verify_mode": "ONLY_FILES_TRANSFERRED",
    },
    destination_location_arn=destination["arn"],
    name="example",
    source_location_arn=source["arn"],
    task_mode="ENHANCED")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.DataSync.Task("example", new()
    {
        Options = new Aws.DataSync.Inputs.TaskOptionsArgs
        {
            Gid = "NONE",
            PosixPermissions = "NONE",
            Uid = "NONE",
            VerifyMode = "ONLY_FILES_TRANSFERRED",
        },
        DestinationLocationArn = destination.Arn,
        Name = "example",
        SourceLocationArn = source.Arn,
        TaskMode = "ENHANCED",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/datasync"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := datasync.NewTask(ctx, "example", &datasync.TaskArgs{
			Options: &datasync.TaskOptionsArgs{
				Gid:              pulumi.String("NONE"),
				PosixPermissions: pulumi.String("NONE"),
				Uid:              pulumi.String("NONE"),
				VerifyMode:       pulumi.String("ONLY_FILES_TRANSFERRED"),
			},
			DestinationLocationArn: pulumi.Any(destination.Arn),
			Name:                   pulumi.String("example"),
			SourceLocationArn:      pulumi.Any(source.Arn),
			TaskMode:               pulumi.String("ENHANCED"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_datasync_task" "example" {
  options = {
    gid               = "NONE"
    posix_permissions = "NONE"
    uid               = "NONE"
    verify_mode       = "ONLY_FILES_TRANSFERRED"
  }
  destination_location_arn = destination.arn
  name                     = "example"
  source_location_arn      = source.arn
  task_mode                = "ENHANCED"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.datasync.Task;
import com.pulumi.aws.datasync.TaskArgs;
import com.pulumi.aws.datasync.inputs.TaskOptionsArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new Task("example", TaskArgs.builder()
            .options(TaskOptionsArgs.builder()
                .gid("NONE")
                .posixPermissions("NONE")
                .uid("NONE")
                .verifyMode("ONLY_FILES_TRANSFERRED")
                .build())
            .destinationLocationArn(destination.arn())
            .name("example")
            .sourceLocationArn(source.arn())
            .taskMode("ENHANCED")
            .build());

    }
}
resources:
  example:
    type: aws:datasync:Task
    properties:
      options:
        gid: NONE
        posixPermissions: NONE
        uid: NONE
        verifyMode: ONLY_FILES_TRANSFERRED
      destinationLocationArn: ${destination.arn}
      name: example
      sourceLocationArn: ${source.arn}
      taskMode: ENHANCED

Import

Identity Schema

Required

  • arn (String) ARN of the DataSync task.

Using pulumi import, import aws.datasync.Task using the DataSync Task ARN. For example:

$ pulumi import aws:datasync/task:Task example arn:aws:datasync:us-east-1:123456789012:task/task-12345678901234567

Constructors

Task(String name, {TaskArgs? args, CustomResourceOptions? options})
Creates a new Task. name The Pulumi resource name. args Arguments used to configure this Task. The set of arguments for Task. options Resource options controlling this resource's behavior.
Task.reference(String urn)
Creates a typed reference to an existing Task resource.

Properties

arn ↔ Output<String>
ARN of the DataSync Task.
latefinal
childResources Set<Resource>
finalinherited
cloudwatchLogGroupArn ↔ Output<String?>
ARN of the CloudWatch Log Group that is used to monitor and log events in the sync task.
latefinal
completionSources Map<String, IOutputCompletionSource>
latefinalinherited
destinationLocationArn ↔ Output<String>
ARN of destination DataSync Location.
latefinal
excludes ↔ Output<TaskExcludes?>
Filter rules that determines which files to exclude from a task.
latefinal
hashCode int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
includes ↔ Output<TaskIncludes?>
Filter rules that determines which files to include in a task.
latefinal
isCustom bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference bool
Whether this instance represents a resource value returned over RPC.
finalinherited
name ↔ Output<String>
Name of the DataSync Task.
latefinal
options ↔ Output<TaskOptions?>
Configuration block containing option that controls the default behavior when you start an execution of this DataSync Task. For each individual task execution, you can override these options by specifying an overriding configuration in those executions.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
schedule ↔ Output<TaskSchedule?>
Specifies a schedule used to periodically transfer files from a source to a destination location.
latefinal
sourceLocationArn ↔ Output<String>
ARN of source DataSync Location.
latefinal
tags ↔ Output<Map<String, String>?>
Key-value pairs of resource tags to assign to the DataSync Task. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
taskMode ↔ Output<String>
One of the following task modes for your data transfer:
latefinal
taskReportConfig ↔ Output<TaskTaskReportConfig?>
Configuration block containing the configuration of a DataSync Task Report. See taskReportConfig below.
latefinal
transformations List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() String
Returns this resource's logical name.
inherited
getResourceType() String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {TaskState? state, CustomResourceOptions? options}) Task
Gets an existing Task resource's state with the given name and id.