Amazon FSx for Windows File Server
Windows User Guide

Migrating Existing File Storage to Amazon FSx

You can migrate files and file share configurations from your on premises file systems to your Amazon FSx for Windows File Server file systems. The following sections provide the procedures to do so.

Migrate Existing Files to Amazon FSx for Windows File Server

Built on Microsoft Windows Server, Amazon FSx for Windows File Server enables you to migrate your existing datasets fully into your Amazon FSx file systems. You can migrate the data for each file. You can also migrate all the relevant file metadata including attributes, time stamps, access control lists (ACLs), owner information, and auditing information. With this total migration support, Amazon FSx enables moving your Windows-based workloads and applications relying on these file datasets to the AWS Cloud.

Use the following topics as a guide through the process for copying existing file data. As you perform this copy, you preserve all file metadata from your on-premises data centers or from your self-managed file servers on Amazon EC2.

Prerequisites

Before you begin, make sure that you do the following:

  • Establish network connectivity (via AWS Direct Connect or VPN) between your on-premises Active Directory and the Amazon VPC in which you wish to create the Amazon FSx file system.

  • Create a service account on your Active Directory with delegated permissions to join computers to the domain. For more information, see Delegate Privileges to Your Service Account in the AWS Directory Service Administration Guide.

  • Create an Amazon FSx file system, joined to your self-managed (on-premises) Microsoft AD directory.

  • Note the location (for example, \\Source\Share) of the file share (either on-premises or in AWS) that contains the existing files you want to transfer over to Amazon FSx.

  • Note the location (for example, \\Target\Share) of the file share on your Amazon FSx file system to which you want to transfer over your existing files.

How to Migrate Existing Files to Amazon FSx

You can migrate existing files to Amazon FSx by using the following procedure.

To migrate existing files to Amazon FSx

  1. Launch a Windows Server 2016 Amazon EC2 instance in the same Amazon VPC as that of your Amazon FSx file system.

  2. Connect to your Amazon EC2 instance. For more information, see Connecting to Your Windows Instance in the Amazon EC2 User Guide for Windows Instances.

  3. Open the Command Prompt and map the source file share on your existing file server (on-premises or in AWS) to a drive letter (for example, Y:) as follows. As part of this, you provide credentials for a member of your on-premises AD's Domain Administrators group.

    C:\>net use Y: \\fileserver1.mydata.com\localdata /user:mydata.com\Administrator Enter the password for ‘fileserver1.mydata.com’: _ Drive Y: is now connected to \\fileserver1.mydata.com\localdata. The command completed successfully.
  4. Map the target file share on your Amazon FSx file system to a different drive letter (for example, Z:) on your Amazon EC2 instance as follows. As part of this, you provide credentials for a member of your on-premises AD's Domain Administrators group.

    C:\>net use Z: \\amznfsxabcdef1.mydata.com\share /user:mydata.com\Administrator Enter the password for 'amznfsxabcdef1.mydata.com': _ Drive Z: is now connected to \\amznfsxabcdef1.mydata.com\share. The command completed successfully.
  5. From the Command Prompt or Windows PowerShell as Administrator (using the Run as Administrator option from the context menu), execute the following RoboCopy command to copy the files from the source share to the target share.

    The ROBOCOPY command is a flexible file transfer utility with multiple options to control the data transfer process. Because of this ROBOCOPY command execution, all the files and directories from the source share are copied to the Amazon FSx target share. The copy preserves file and folder NTFS ACLs, attributes, time stamps, owner information, and auditing information.

    robocopy Y:\ Z:\ /copy:DATSOU /secfix /e /z /MT:8

    The example command preceding uses the following elements and options:

    • Y – Refers to the source share located in the on-premises Active Directory forest mydata.com.

    • Z – Refers to the target share \\amznfsxabcdef1.mydata.com\share on Amazon FSx.

    • /copy – Specifies the following file properties to be copied:

      • D – data

      • A – attributes

      • T – time stamps

      • S – NTFS ACLs

      • O – owner information

      • U – auditing information.

    • /secfix – Fixes file security on all files, even skipped ones.

    • /e – Copies subdirectories, including empty ones.

    • /z – Copies files in restartable mode.

    • /MT:8 – Specifies how many threads to use for performing multithreaded copies.

Migrate an Existing File Share Configuration to Amazon FSx

You can migrate an existing file share configuration to Amazon FSx by using the following procedure. In this procedure, the source file server is the file server whose file share configuration you wish to migrate to Amazon FSx.

To migrate existing file shares to Amazon FSx for Windows File Server

  1. Open a Windows PowerShell as Administrator (using the Run as Administrator option from the context menu) on the source file server.

  2. Export the source file server's file shares to a file named SmbShares.xml by running the following commands in the PowerShell. Replace F: in this example with the drive letter on your file server from which you are exporting file shares.

    $shareFolder = Get-SmbShare -Special $false | ? { $_.Path -like “F:\*” } $shareFolder | Export-Clixml -Path F:\SmbShares.xml
  3. Edit the SmbShares.xml file, replacing all references to F: (your drive letter) to D: as Amazon FSx file systems reside on D:.

  4. Import the existing file share configuration to Amazon FSx for Windows File Server. On a client that has access to your destination Amazon FSx file system and the source file server, copy the saved file share configuration, and then import it into a variable by using the following command.

    $shares = Import-Clixml -Path F:\SmbShares.xml
  5. Prepare the credential object required to create the file shares on your Amazon FSx for Windows File Server file server using one of the following options.

    To generate the credential object interactively, use the following command:

    $credential = Get-Credential

    To generate the credential object using an AWS Secrets Manager resource, use the following command:

    $credential = ConvertFrom-Json -InputObject (Get-SECSecretValue -SecretId $AdminSecret).SecretString $FSxAdminUserCredential = (New-Object PSCredential($credential.UserName,(ConvertTo-SecureString $credential.Password -AsPlainText -Force)))
  6. Migrate the file share configuration to your Amazon FSx file server using the following script.

    $params = @{} $FSxAcceptedParameters = ("ContinuouslyAvailable", "Description", "ConcurrentUserLimit", "CATimeout", "FolderEnumerationMode", "CachingMode", "FullAccess", "ChangeAccess", "ReadAccess", "NoAccess", "SecurityDescriptor", "Path", "Name", "EncryptData") ForEach ($item in $shares) { $i = $shares.IndexOf($item); $params[$i] = @{}; Foreach ($property in $item.psObject.properties) { if ($property.Name -In $FSxAcceptedParameters) { $params[$i][$property.Name] = $property.Value } } $param=$params[$i]; Invoke-Command -ConfigurationName FSxRemoteAdmin -ComputerName amznfsxxxxxxxxx.corp.com -ErrorVariable errmsg -ScriptBlock { New-FSxSmbShare -Credential $Using:credential @Using:param } }