Drive mappings in windows ami

0

Hi, we have a Windows ami with a number of pre-defined EBS volumes, on ec2Launch v1 there was a powershell script to ensure the drive letters for those volumes where kept the same.

The most recent base ami uses EC2launch V2 which doesn't have this facility (it has a GUI which doesn't seem to work). Has anyone any links to how to get volume to drive mappings working consistently? TIA

1 Answer
0

Hi :)

Greetings from AWS! Hope you're safe and doing well.

Thank you for posting your query on AWS re:Post. My name is Aakash and it is my pleasure to assist you today.

From your query, I understand that you would like to know how we initialize the disks and map them with drive letters using EC2launchV2.

  1. EC2launchV1 or simply EC2launch allows to map drive letters to volumes on your EC2 instance. The script initializes drives that are not already initialized and partitioned. To achieve this, you need to specify the settings in 'DriveLetterMappingConfig.json' as mentioned at[1]

-- Note: You can test this setting in EC2launchV1 by running the script named 'InitializeDisks.ps1' at 'C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts'

  1. EC2launchV2 service supports all EC2Config and EC2Launch features[2]. As you are already aware, one of it's tasks is: Set drive letters for any additional volumes and extend them to use available space[3].

It provides a GUI access via EC2launch.exe. It has a volumes tab[4] which allows you to initialize the volumes that are attached to the instance. Enabling sets drive letters for any additional volumes and extends them to use available space. If you select All, all of the storage volumes are initialized. If you select Devices, only devices that are specified in the list are initialized. You must enter the device for each device to be initialized.

You can find the device name of the volume on AWS console or you can use the ebsnvme-id.exe tool at 'C:\ProgramData\Amazon\tools' (works only on Nitro Instance type[5]).

In simple words, you have to open the EC2launch.exe-->Volumes-->Select Initialize if you want to initialize a volume-->devices-->Enter the device name as seen on console and drive letter-->Save. The agent-config.yml file at 'C:\ProgramData\Amazon\EC2Launch\config' will be configured accordingly. To test, please run the 'Amazon EC2launch' service from 'services.msc'.

I have tested the same and it is working in my environment. The 'agent-config.yml' file looks like:

  • task: initializeVolume inputs: initialize: devices devices: - device: xvdi letter: K

The 'agent.txt' log file output was:

2023-04-05 13:41:32 Warning: Device is not empty, skipping initialization: xvdi 2023-04-05 13:41:32 Info: Drive letter 'K' is specified for device 'xvdi' 2023-04-05 13:41:32 Info: Successfully changed drive letter for device 'xvdi' to 'K'

-Note: Initialization of disk happens only if it is empty as mentioned at [6]. But the device name was changed according to what was defined in the 'yml' file

If this is not working as expected or there is some confusion regarding this, please reach back to us via a technical support case[7] with the log files present at the following location:

'agent.txt' and 'err.txt' at 'C:\ProgramData\Amazon\EC2Launch\log'

You can also post the error here.

I hope that the given information is helpful to you. If you feel we can provide any additional assistance with regard to this matter, please do not hesitate to let us know and we would be glad to continue working on this issue with you.

Thank you and Have a great day ahead!

References:

[1]Initialize drives and map drive letters: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2launch.html#ec2launch-mapping

[2]Configure a Windows instance using EC2Launch v2: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2launch-v2.html

[3]EC2launchV2 task: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2launch-v2-overview.html#ec2launch-v2-tasks

[4]How to use Volume Tab to configure EC2launchV2 task: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2launch-v2-settings.html#ec2launch-v2-ui (Step 6)

[5] Nitro System: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances

[6]Disk not empty: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2launchv2-troubleshooting.html#ec2launchv2-troubleshooting-ebs-initialize

[7]Technical Support case: https://support.console.aws.amazon.com/support/home#/case/create

AWS
SUPPORT ENGINEER
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions