AWS DataSync Task

This page shows how to write Terraform and CloudFormation for DataSync Task and write them securely.

aws_datasync_task (Terraform)

The Task in DataSync can be configured in Terraform with the resource name aws_datasync_task. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

datasync.tf#L23
resource "aws_datasync_task" "backup-create" {
  destination_location_arn = aws_datasync_location_s3.backup.arn
  name                     = "backup-create"
  source_location_arn      = aws_datasync_location_efs.minecraft_ondemand_efs.arn

  schedule {
datasync_tasks.tf#L1
resource "aws_datasync_task" "example" {
  destination_location_arn = aws_datasync_location_s3.destination.arn
  name                     = "example"
  source_location_arn      = aws_datasync_location_nfs.source.arn

  options {
datasync.tf#L1
resource "aws_datasync_task" "efs_datasync_task" {
  destination_location_arn = aws_datasync_location_efs.efsdestination.arn
  name                     = "ReplicationEFS"
  source_location_arn      = aws_datasync_location_efs.efs_source.arn

  schedule {
datasync_task.tf#L1
resource "aws_datasync_task" "pracmig_datasync_task" {
  destination_location_arn = aws_datasync_location_s3.destination_location.arn
  name                     = "pracmig"
  source_location_arn      = aws_datasync_location_s3.source_location.arn
}

main.tf#L7
resource "aws_datasync_task" "this" {
  cloudwatch_log_group_arn = var.cloudwatch_log_group_arn
  destination_location_arn = var.destination_location_arn
  name                     = var.name
  source_location_arn      = var.source_location_arn
  tags                     = var.tags

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

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 Terraform resource.

AWS::DataSync::Task (CloudFormation)

The Task in DataSync can be configured in CloudFormation with the resource name AWS::DataSync::Task. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Explanation in CloudFormation Registry

The AWS::DataSync::Task resource specifies a task. A task is a set of two locations (source and destination) and a set of Options that you use to control the behavior of a task. If you don't specify Options when you create a task, AWS DataSync populates them with service defaults.

Frequently asked questions

What is AWS DataSync Task?

AWS DataSync Task is a resource for DataSync of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS DataSync Task?

For Terraform, the JKolios/minecraft-ondemand-terraform, shaikis/terraform-aws-datasync and fabiodsilva/terraform-efs-datasync-awsbackup source code examples are useful. See the Terraform Example section for further details.