CreateLocationSmb - AWS DataSync

On December 7, 2023, we discontinued version 1 DataSync agents. Check the Agents page on the DataSync console to see if you have affected agents. If you do, replace those agents or delete them if they aren't in use. If you need more help, contact AWS Support.

CreateLocationSmb

Creates a transfer location for a Server Message Block (SMB) file server. AWS DataSync can use this location as a source or destination for transferring data.

Before you begin, make sure that you understand how DataSync accesses SMB file servers.

Request Syntax

{ "AgentArns": [ "string" ], "Domain": "string", "MountOptions": { "Version": "string" }, "Password": "string", "ServerHostname": "string", "Subdirectory": "string", "Tags": [ { "Key": "string", "Value": "string" } ], "User": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

AgentArns

Specifies the DataSync agent (or agents) which you want to connect to your SMB file server. You specify an agent by using its Amazon Resource Name (ARN).

Type: Array of strings

Array Members: Minimum number of 1 item. Maximum number of 4 items.

Length Constraints: Maximum length of 128.

Pattern: ^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b):datasync:[a-z\-0-9]+:[0-9]{12}:agent/agent-[0-9a-z]{17}$

Required: Yes

Domain

Specifies the name of the Active Directory domain that your SMB file server belongs to.

If you have multiple Active Directory domains in your environment, configuring this parameter makes sure that DataSync connects to the right file server.

Type: String

Length Constraints: Maximum length of 253.

Pattern: ^[A-Za-z0-9]((\.|-+)?[A-Za-z0-9]){0,252}$

Required: No

MountOptions

Specifies the version of the SMB protocol that DataSync uses to access your SMB file server.

Type: SmbMountOptions object

Required: No

Password

Specifies the password of the user who can mount your SMB file server and has permission to access the files and folders involved in your transfer.

For more information, see required permissions for SMB locations.

Type: String

Length Constraints: Maximum length of 104.

Pattern: ^.{0,104}$

Required: Yes

ServerHostname

Specifies the Domain Name Service (DNS) name or IP address of the SMB file server that your DataSync agent will mount.

Note

You can't specify an IP version 6 (IPv6) address.

Type: String

Length Constraints: Maximum length of 255.

Pattern: ^(([a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9\-]*[A-Za-z0-9])$

Required: Yes

Subdirectory

Specifies the name of the share exported by your SMB file server where DataSync will read or write data. You can include a subdirectory in the share path (for example, /path/to/subdirectory). Make sure that other SMB clients in your network can also mount this path.

To copy all data in the subdirectory, DataSync must be able to mount the SMB share and access all of its data. For more information, see required permissions for SMB locations.

Type: String

Length Constraints: Maximum length of 4096.

Pattern: ^[a-zA-Z0-9_\-\+\./\(\)\$\p{Zs}]+$

Required: Yes

Tags

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

Type: Array of TagListEntry objects

Array Members: Minimum number of 0 items. Maximum number of 50 items.

Required: No

User

Specifies the user that can mount and access the files, folders, and file metadata in your SMB file server.

For information about choosing a user with the right level of access for your transfer, see required permissions for SMB locations.

Type: String

Length Constraints: Maximum length of 104.

Pattern: ^[^\x5B\x5D\\/:;|=,+*?]{1,104}$

Required: Yes

Response Syntax

{ "LocationArn": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

LocationArn

The ARN of the SMB location that you created.

Type: String

Length Constraints: Maximum length of 128.

Pattern: ^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b):datasync:[a-z\-0-9]+:[0-9]{12}:location/loc-[0-9a-z]{17}$

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalException

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

HTTP Status Code: 500

InvalidRequestException

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

HTTP Status Code: 400

Examples

Sample Request

The following example creates a location for an SMB file server.

{ "AgentArns":[ "arn:aws:datasync:us-east-2:111222333444:agent/agent-0b0addbeef44b3nfs", "arn:aws:datasync:us-east-2:111222333444:agent/agent-2345noo35nnee1123ovo3" ], "Domain":"AMAZON", "MountOptions":{ "Version":"SMB3" }, "Password":"string", "ServerHostname":"MyServer.amazon.com", "Subdirectory":"share", "Tags":[ { "Key":"department", "Value":"finance" } ], "User":"user-1" }

Sample Response

A response returns the location ARN of your SMB file server.

{ "LocationArn": "arn:aws:datasync:us-east-1:111222333444:location/loc-0f01451b140b2af49" }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: