I want to view or configure the current volume mapping for my Amazon Elastic Compute Cloud (Amazon EC2) Windows Server 2016 or later instance. Or, I want to configure volume mapping so that I can have a fixed drive letter in the operating system (OS).
Resolution
View existing volume mappings
For information about how to view the existing volume mapping on the instance, see How volumes are attached and mapped for Amazon EC2 Windows instances.
Configure volume mappings
Note: The following resolution is for Windows Server 2016 and later and uses the EC2Launch v2 agent. With EC2Launch v2, volume mapping is managed as a Windows service. You can find the configurations in a YAML file in the C:\ProgramData\Amazon\EC2Launch\config\agent-config.yml file location. For information about EC2Launch v1, see Configure the EC2Launch v1 agent on your Windows instance.
Initialize all volumes
To initialize all volumes, complete the following steps:
- From the Start menu, open Amazon EC2Launch settings.
- Choose the Volumes tab, and then select Initialize.
- Select All.
- Choose Save.
Or, use the YAML file. Open the C:\ProgramData\Amazon\EC2Launch\config\agent-config.yml YAML file, and then add the following configuration:
- task: initializeVolume
inputs:
initialize: all
When you use the preceding configuration, EC2Launch v2 automatically detects and initializes all attached storage volumes.
Initialize specific disks with drive mappings
To initialize specific disks and assign specific letters to volumes, complete the following steps:
- From the Start menu, open Amazon EC2Launch settings.
- Choose the Volumes tab, and then select Initialize.
- Select Devices.
- From the Devices dropdown list, select your devices, for example /dev/nvme0n1 and /dev/nvme1n1.
- For each device, under Letter, press a letter key, for example Z and Y.
- Choose Save.
Or, use the YAML file. Open the C:\ProgramData\Amazon\EC2Launch\config\agent-config.yml YAML file, and then add the following configuration:
- task: initializeVolume
inputs:
initialize: devices
devices:
- device: /dev/nvme0n1
name: Temporary Storage 0
letter: Z
- device: /dev/nvme1n1
name: Temporary Storage 1
letter: Y
Note: Replace /dev/nvme0n1 and /dev/nvme1n1 with your store volumes, and Y and Z with your letter mappings.
On EC2 Windows instances, instance store volumes are available as device paths:
- /dev/nvme0n1 - Temporary Storage 0
- /dev/nvme1n1 - Temporary Storage 1
- /dev/nvme1n2 - Temporary Storage 2
Note: The number of instance store volumes varies by EC2 instance type. Verify the volume count for your instance type to make sure that the configuration is correct.
Related information
Task definitions for EC2Launch v2 startup tasks