AWS::DataSync::LocationS3
The AWS::DataSync::LocationS3
resource specifies an endpoint for an Amazon
S3 bucket.
For more information, see Create an Amazon S3 location in the Amazon DataSync User Guide.
Syntax
To declare this entity in your Amazon 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
Maximum:
156
Pattern:
^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b):(s3|s3-outposts):[a-z\-0-9]*:[0-9]*:.*$
Update requires: Replacement
S3Config
-
The Amazon Resource Name (ARN) of the Amazon 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 Amazon 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 Amazon Web Services 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:
DEEP_ARCHIVE | GLACIER | GLACIER_INSTANT_RETRIEVAL | INTELLIGENT_TIERING | ONEZONE_IA | OUTPOSTS | STANDARD | STANDARD_IA
Update requires: Replacement
Subdirectory
-
A subdirectory in the Amazon S3 bucket. This subdirectory in Amazon S3 is used to read data from the S3 source location or write data to the S3 destination.
Required: No
Type: String
Maximum:
4096
Pattern:
^[a-zA-Z0-9_\-\+\./\(\)\p{Zs}]*$
Update requires: Replacement
Tags
-
The key-value pair that represents the tag that you want to add to the location. The value can be an empty string. We recommend using tags to name your resources.
Required: No
Type: List 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.
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:::MyBucket
. The access role is specified by the ARN
arn:aws:iam::111222333444:role/MyBucketAccessRole
. The example uses
the S3 Standard storage class and refers to the subdirectory /MyFolder
.
Amazon Security Token Service (Amazon 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:::MyBucket", "S3Config": { "BucketAccessRoleArn": "arn:aws:iam::111222333444:role/MyBucketAccessRole" }, "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:::MyBucket S3Config: BucketAccessRoleArn: arn:aws:iam::111222333444:role/MyBucketAccessRole S3StorageClass: STANDARD Subdirectory: /MyFolder