Skip to content

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

3 minute read
0

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:

  1. From the Start menu, open Amazon EC2Launch settings.
  2. Choose the Volumes tab, and then select Initialize.
  3. Select All.
  4. 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:

  1. From the Start menu, open Amazon EC2Launch settings.
  2. Choose the Volumes tab, and then select Initialize.
  3. Select Devices.
  4. From the Devices dropdown list, select your devices, for example /dev/nvme0n1 and /dev/nvme1n1.
  5. For each device, under Letter, press a letter key, for example Z and Y.
  6. 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

AWS OFFICIALUpdated 6 months ago
2 Comments

This will only work if EC2Launch v1 is installed on the AWS Instance

replied a year ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

AWS
EXPERT
replied a year ago