Reputation: 149
I created a windows 2016 instance type on AWS (free tier). I created a "Cold HDD" volume and attached it to the windows 2016 instance thru Managment console. So far so good.
I am able to RDP into the instance after getting Administrator password. But I can't see the attached "Cold HDD" volume when I log into the windows 2016 instance.
So I launched "Disk Management" on the instance and enabled the new volume.
I googled and came to know that we need to run a powershell script to enable all attached volumes at the start of the instance.
Script is:
<powershell>
C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeDisks.ps1
</powershell>
But I can't find C:\ProgramData\Amazon folder at all on C drive of the windows 2016 instance. I don't know what to do.
https://aws.amazon.com/premiumsupport/knowledge-center/secondary-volumes-windows-server-2016/
Upvotes: 2
Views: 3185
Reputation: 23385
The InitializeDisks.ps1
script is part of EC2Launch.
To accommodate the change from .NET Framework to .NET Core, the EC2Config service has been deprecated on Windows Server 2016 AMIs and replaced by EC2Launch. EC2Launch is a bundle of Windows PowerShell scripts that perform many of the tasks performed by the EC2Config service.
This should be installed by default on the Windows 2016 AMI, but note that the C:\ProgramData\Amazon directory is hidden.
If for some reason it is not installed, you should be able to install it manually as follows:
To download and install the latest version of EC2Launch
If you have already installed and configured EC2Launch on an instance, make a backup of the EC2Launch configuration file. The installation process does not preserve changes in this file. By default, the file is located in the following directory: C:\ProgramData\Amazon\EC2-Windows\Launch\Config.
Download EC2Launch.zip from the following location to a directory on the instance:
https://s3.amazonaws.com/ec2-downloads-windows/EC2Launch/latest/EC2-Windows-Launch.zip
- Download the Install.ps1 PowerShell script from the following location to the same directory where you downloaded EC2Launch.zip:
https://s3.amazonaws.com/ec2-downloads-windows/EC2Launch/latest/install.ps1
Run Install.ps1
Replace your backup of the EC2Launch configuration file in the C:\ProgramData\Amazon\EC2-Windows\Launch\Config directory.
Source: http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2launch.html
As a test, I just deployed the Windows 2016 Base AMI template and can confirm that C:\ProgramData\Amazon does exist (ProgramData is a hidden directory, so go to View > Show Hidden Files to see it).
I also added a Cold Storage HDD and (as you noted) the following User Data (under the "Advanced Details" section of the "Configure Instance Details" page) to my instance on launch:
<powershell>
C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeDisks.ps1
</powershell>
And can confirm that on boot of the VM the Cold HDD was correctly/automatically initialized and available as the D:\ drive.
If you didn't add the required User Data when you were first launching your instance, you can add it later by selecting your instance and go to Actions > Instance Settings > View/Change User Data.
Upvotes: 2