AWS::DataSync::LocationS3 - AWS CloudFormation

AWS::DataSync::LocationS3

The AWS::DataSync::LocationS3 resource specifies an endpoint for an Amazon S3 bucket.

For more information, see the AWS DataSync User Guide.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::DataSync::LocationS3", "Properties" : { "S3BucketArn" : String, "S3Config" : S3Config, "S3StorageClass" : String, "Subdirectory" : String, "Tags" : [ Tag, ... ] } }

YAML

Type: AWS::DataSync::LocationS3 Properties: S3BucketArn: String S3Config: S3Config S3StorageClass: String Subdirectory: String Tags: - Tag

Properties

S3BucketArn

The ARN of the Amazon S3 bucket.

Required: No

Type: String

Pattern: ^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b):s3:[a-z\-0-9]*:[0-9]*:.*$

Maximum: 156

Update requires: Replacement

S3Config

The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that is used to access an Amazon S3 bucket.

For detailed information about using such a role, see Creating a Location for Amazon S3 in the AWS DataSync User Guide.

Required: Yes

Type: S3Config

Update requires: Replacement

S3StorageClass

The Amazon S3 storage class that you want to store your files in when this location is used as a task destination. For buckets in AWS Regions, the storage class defaults to S3 Standard.

For more information about S3 storage classes, see Amazon S3 Storage Classes. Some storage classes have behaviors that can affect your S3 storage costs. For detailed information, see Considerations When Working with Amazon S3 Storage Classes in DataSync.

Required: No

Type: String

Allowed values: STANDARD | STANDARD_IA | ONEZONE_IA | INTELLIGENT_TIERING | GLACIER | GLACIER_INSTANT_RETRIEVAL | DEEP_ARCHIVE

Update requires: Replacement

Subdirectory

Specifies a prefix in the S3 bucket that DataSync reads from or writes to (depending on whether the bucket is a source or destination location).

Note

DataSync can't transfer objects with a prefix that begins with a slash (/) or includes //, /./, or /../ patterns. For example:

  • /photos

  • photos//2006/January

  • photos/./2006/February

  • photos/../2006/March

Required: No

Type: String

Pattern: ^[\p{L}\p{M}\p{Z}\p{S}\p{N}\p{P}\p{C}]*$

Maximum: 1024

Update requires: Replacement

Tags

Specifies labels that help you categorize, filter, and search for your AWS resources. We recommend creating at least a name tag for your transfer location.

Required: No

Type: Array of Tag

Maximum: 50

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the location resource Amazon Resource Name (ARN). For example:

arn:aws:datasync:us-east-2:111222333444:location/loc-07db7abfc326c50s3

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

LocationArn

The Amazon Resource Name (ARN) of the specified Amazon S3 location.

LocationUri

The URI of the specified Amazon S3 location.

Examples

Create an Amazon S3 location for DataSync

The following example specifies an S3 location for DataSync. In this example, the S3 location uses the bucket specified by the Amazon Resource Name (ARN) arn:aws:s3:::amzn-s3-demo-bucket . The access role is specified by the ARN arn:aws:iam::111222333444:role/amzn-s3-demo-bucket-access-role. The example uses the S3 Standard storage class and refers to the subdirectory /MyFolder.

AWS Security Token Service (AWS STS) must be activated in your account and Region for DataSync to assume the IAM role. For more information about temporary security credentials, see Temporary security credentials in IAM in the IAM User Guide .

JSON

{ "AWSTemplateFormatVersion": "2010-09-09", "Description": "Specifies an S3 location for DataSync", "Resources": { "LocationS3": { "Type": "AWS::DataSync::LocationS3", "Properties": { "S3BucketArn": "arn:aws:s3:::amzn-s3-demo-bucket", "S3Config": { "BucketAccessRoleArn": "arn:aws:iam::111222333444:role/amzn-s3-demo-bucket-access-role" }, "S3StorageClass": "STANDARD", "Subdirectory": "/MyFolder" } } } }

YAML

AWSTemplateFormatVersion: 2010-09-09 Description: Specifies an S3 location for DataSync Resources: LocationS3: Type: AWS::DataSync::LocationS3 Properties: S3BucketArn: arn:aws:s3:::amzn-s3-demo-bucket S3Config: BucketAccessRoleArn: arn:aws:iam::111222333444:role/amzn-s3-demo-bucket-access-role S3StorageClass: STANDARD Subdirectory: /MyFolder