CreateLocationS3Command

Creates a transfer location for an Amazon S3 bucket. DataSync can use this location as a source or destination for transferring data.

For more information, see Configuring transfers with Amazon S3 .

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { DataSyncClient, CreateLocationS3Command } from "@aws-sdk/client-datasync"; // ES Modules import
// const { DataSyncClient, CreateLocationS3Command } = require("@aws-sdk/client-datasync"); // CommonJS import
const client = new DataSyncClient(config);
const input = { // CreateLocationS3Request
  Subdirectory: "STRING_VALUE",
  S3BucketArn: "STRING_VALUE", // required
  S3StorageClass: "STANDARD" || "STANDARD_IA" || "ONEZONE_IA" || "INTELLIGENT_TIERING" || "GLACIER" || "DEEP_ARCHIVE" || "OUTPOSTS" || "GLACIER_INSTANT_RETRIEVAL",
  S3Config: { // S3Config
    BucketAccessRoleArn: "STRING_VALUE", // required
  },
  AgentArns: [ // AgentArnList
    "STRING_VALUE",
  ],
  Tags: [ // InputTagList
    { // TagListEntry
      Key: "STRING_VALUE", // required
      Value: "STRING_VALUE",
    },
  ],
};
const command = new CreateLocationS3Command(input);
const response = await client.send(command);
// { // CreateLocationS3Response
//   LocationArn: "STRING_VALUE",
// };

CreateLocationS3Command Input

See CreateLocationS3CommandInput for more details

Parameter
Type
Description
S3BucketArn
Required
string | undefined

Specifies the ARN of the S3 bucket that you want to use as a location. (When creating your DataSync task later, you specify whether this location is a transfer source or destination.)

If your S3 bucket is located on an Outposts resource, you must specify an Amazon S3 access point. For more information, see Managing data access with Amazon S3 access points  in the Amazon S3 User Guide.

S3Config
Required
S3Config | undefined

Specifies the Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role that DataSync uses to access your S3 bucket.

AgentArns
string[] | undefined

(Amazon S3 on Outposts only) Specifies the Amazon Resource Name (ARN) of the DataSync agent on your Outpost.

For more information, see Deploy your DataSync agent on Outposts .

S3StorageClass
S3StorageClass | undefined

Specifies the storage class that you want your objects to use when Amazon S3 is a transfer destination.

For buckets in Amazon Web Services Regions, the storage class defaults to STANDARD. For buckets on Outposts, the storage class defaults to OUTPOSTS.

Subdirectory
string | undefined

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).

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

Tags
TagListEntry[] | undefined

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

CreateLocationS3Command Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
LocationArn
string | undefined

The ARN of the S3 location that you created.

Throws

Name
Fault
Details
InternalException
server

This exception is thrown when an error occurs in the DataSync service.

InvalidRequestException
client

This exception is thrown when the client submits a malformed request.

DataSyncServiceException
Base exception class for all service exceptions from DataSync service.