How do I configure volume mapping or find the volume mapping for my EC2 Windows Server 2016 or later instance?

Last updated: 2021-08-03

I have an Amazon Elastic Compute Cloud (Amazon EC2) Windows Server 2016 or later instance. I want to view the current volume mapping on my instance. Or, I want to configure volume mapping so that I can have a fixed drive letter in the operating system?

Resolution

View existing volume mappings

For information on viewing the existing volume mapping on the instance, see Map disks to volumes on your Windows instance.

Configure volume mappings

1.    Connect to the instance.

2.    Open File Explorer, and then select This PC. Make sure that the disk is online and that it has the label on it.

3.    Note the volume name that you want to assign the drive letter to.

Note: Your configuration might require a unique name for each drive. If the drive letter is already in use, the mapping fails. Also, be aware that EC2Launch initializes drives that aren't already initialized and partitioned.

The following steps are tested for Windows Server 2016 and later:

4.    Open C:\ProgramData\Amazon\EC2-Windows\Launch\Config\. Edit the DriveLetterMappingConfig.json file with any text editor application, such as Notepad.

The following example assigns the letter D to Backup volume and the letter E to Logs volume:

{
    "driveLetterMapping": [
        {
            "volumeName": "Backup",
            "driveLetter": "D"
        },
        {
            "volumeName": "Logs",
            "driveLetter": "F"
        }
    ]
}

5.    Run the following command in Windows PowerShell to launch the EC2Launch script to initialize the disks:

C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeDisks.ps1

Add the -Schedule flag to initialize the disks each time the instance boots, as shown in the following example:

C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeDisks.ps1 -Schedule

Your new mappings are now set.


Did this article help?


Do you need billing or technical support?