Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Setup:</p> <ul> <li>Make sure the EBS volume is formatted and labeled (in the example I used the label PDRIVE). </li> <li>Setup a drive mapping using Ec2ConfigServiceSettings.exe</li> <li>Install Java on the instance</li> <li>Install the EC2 API command line tools</li> <li>Install a copy of your cert and private key</li> <li>Install a copy of curl.exe (open source tool)</li> </ul> <p>You can use the group policy editor to set this script as your startup script. See <a href="http://technet.microsoft.com/en-us/library/cc739591(WS.10).aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/library/cc739591(WS.10).aspx</a> for more information.</p> <pre><code>REM @echo off REM setlocal ENABLEDELAYEDEXPANSION C:\WINDOWS\system32\eventcreate /l SYSTEM /t information /id 100 /so AttachEbsBoot /d "Starting attach-ebs-boot.cmd" REM local variables REM Make sure you include the directory with curl.exe and the EC2 command line tools in the path set path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\Utils;C:\ebin\ec2\bin set JAVA_HOME=c:\java set EC2_HOME=c:\ebin\ec2 set EC2_CERT=&lt;your_cert&gt; set EC2_PRIVATE_KEY=&lt;your_private_key&gt; REM Please note: you should use the Ec2 Config Serive Settings application to ensure REM that your EBS volume is mapped to a particular drive letter. REM REM edit as needed set EBS_DRIVE=P: set EBS_DEVICE=xvdp REM Test to see if the drive is already attached. If it is then we're done. if exist %EBS_DRIVE%\nul (goto done) REM get the EBS volume ID from the user data and the instance ID from the meta-data for /f "delims=" %%a in ('curl http://169.254.169.254/latest/user-data') do (set EBS_VOLUME=%%a) for /f "delims=" %%b in ('curl http://169.254.169.254/latest/meta-data/instance-id') do (set INSTANCE_ID=%%b) C:\WINDOWS\system32\eventcreate /l SYSTEM /t information /id 102 /so AttachEbsBoot /d "Volume == %EBS_VOLUME%" C:\WINDOWS\system32\eventcreate /l SYSTEM /t information /id 103 /so AttachEbsBoot /d "Instance == %INSTANCE_ID%" REM attach the volume REM REM Use a series of set command to build the command line SET COMMAND_LINE=%EBS_VOLUME% SET COMMAND_LINE=%COMMAND_LINE% -i SET COMMAND_LINE=%COMMAND_LINE% %INSTANCE_ID% SET COMMAND_LINE=%COMMAND_LINE% -d SET COMMAND_LINE=%COMMAND_LINE% %EBS_DEVICE% C:\WINDOWS\system32\eventcreate /l SYSTEM /t information /id 104 /so AttachEbsBoot /d "calling ec2attvole %COMMAND_LINE%" call ec2attvol.cmd %COMMAND_LINE% :DONE C:\WINDOWS\system32\eventcreate /l SYSTEM /t information /id 101 /so AttachEbsBoot /d "Exiting attach-ebs-boot.cmd" REM Events logged in the System event log REM source === AttachEbsBoot REM REM Event 100 - Script start REM Event 101 - Script end REM Event 102 - Volume ID REM Event 103 - Instance ID REM Event 104 - Command line for ec2attvol </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload