How-To

Upgrading Windows Server 2012 EC2 Instances, Part 2: In-Place Upgrade

After earlier detailing needed planning, Brien goes to the next step: an in-place upgrade of the Windows Server OS as it relates to AWS EC2.

In my previous blog post in this series, I talked about some of the important considerations that you need to take into account when planning for an OS upgrade on an EC2 instance that is running Windows Server 2012 or Windows Server 2012 R2. Now, I want to change my focus a bit and show you how to perform an in-place upgrade of the Windows Server OS, specifically as the process relates to AWS EC2.

The first step in the upgrade process is to open the AWS EC2 console and locate the instance that is to be upgraded. You will need to make note of the instance ID and the instance's availability zone. This information is presented on the main EC2 console screen. You can see an example of this in Figure 1.

Be sure to document your instance's ID and its availability zone.
[Click on image for larger view.] Figure 1: Be sure to document your instance's ID and its availability zone.

The EC2Config Service
The next thing that you will need to do is to remove the EC2Config service from the instance. The EC2Config service was used to run Sysprep on instances running Windows Server. However, it was only used prior to Windows Server 2016. As such, it will need to be removed prior to upgrading your OS.

To remove the EC2Config service, log into the EC2 instance and then open an elevated PowerShell instance. Enter the following commands into the PowerShell window:

Stop-Service EC2Config
SC delete ec2config

Once the service has been stopped, the next thing that you will need to do is to open the Windows Control Panel and then click on Uninstall a Program. Select the EC2ConfigService, and then click on the Uninstall link, as shown in Figure 2.

You will need to use PowerShell to stop the EC2Config service before you can uninstall it.
[Click on image for larger view.] Figure 2: You will need to use PowerShell to stop the EC2Config service before you can uninstall it.

The next step in the process is to download and install the latest version of EC2Launch. It's important to make sure that you have a backup of the virtual machine (VM) instance before you perform this step since any existing EC2Launch configurations will be overwritten. You are going to need to enter the following commands into PowerShell:

mkdir $env:USERPROFILE\Desktop\EC2Launch
$Url = "https://s3.amazonaws.com/ec2-downloads-windows/EC2Launch/latest/EC2-Windows-Launch.zip"
$DownloadZipFile = "$env:USERPROFILE\Desktop\EC2Launch\" + $(Split-Path -Path $Url -Leaf)
Invoke-WebRequest -Uri $Url -OutFile $DownloadZipFile
$Url = "https://s3.amazonaws.com/ec2-downloads-windows/EC2Launch/latest/install.ps1"
$DownloadZipFile = "$env:USERPROFILE\Desktop\EC2Launch\" + $(Split-Path -Path $Url -Leaf)
Invoke-WebRequest -Uri $Url -OutFile $DownloadZipFile
C:\Users\Administrator\Desktop\EC2Launch\install.ps1
This is how you install EC2Launch.
[Click on image for larger view.] Figure 3: This is how you install EC2Launch.

The next thing that you will need to do is to download and install an SSM agent. In order to do so, you will need to enter these commands into the VM instance's PowerShell window:

Invoke-WebRequest 'https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/windows_amd64/AmazonSSMAgentSetup.exe' -OutFile $env:USERPROFILE\Desktop\SSMAgent_latest.exe
Cd desktop
Start-Process 'SSMAgent_latest.exe' -ArgumentList "/S"
rm -Force SSMAgent_latest.exe
Restart-Service AmazonSSMAgent
This is the process used to download, install, and launch the SSM agent.
[Click on image for larger view.] Figure 4: This is the process used to download, install, and launch the SSM agent.

Now that you have gotten the SSM agent installed, the next thing that you have to do is to create a new volume containing the installation media for the version of Windows that you plan to install.

From within the EC2 console, locate the Elastic Block Store section and then click on Snapshots. At the top of the Snapshots window, you will see a filter bar. By default this filter bar contains the text "owned by me." Click on the drop down arrow and choose Public Snapshots from the list.

Now, click on the search box and then select the Owner Alias option and set the Owner Alias to Amazon. Click on the search box once again, but this time choose the Description option. Enter Windows as the description. This will cause the snapshot list to display all of the publicly available Windows snapshots offered by Amazon, as shown in Figure 5. You will need to locate the version of Windows that you want to upgrade to. Keep in mind that the results are spread across multiple pages, so if you don't find what it is that you are looking for, be sure to move on to the next page.

This is the filtered list of results.
[Click on image for larger view.] Figure 5: This is the filtered list of results.

Once you locate the snapshot containing the Windows version that you want to upgrade to, select the snapshot and then select the Create Volume From Snapshot option from the Actions menu. This will cause AWS to display the Create Volume dialog box. Be sure to select the availability zone that matches the one used by the instance that you are upgrading. Upon doing so, click Create Volume.

At this point, you should see a message that says Successfully Created Volume. This message contains a link to the new volume. Click on the link to go to the volume's details. Next, choose the Attach Volume command from the Actions menu. Select your instance from the Instance drop-down and then click Attach Volume.

You will need to attach the new volume to the instance.
[Click on image for larger view.] Figure 6: You will need to attach the new volume to the instance.

Now that you have attached the new volume to your EC2 instance, you are nearly ready to begin the upgrade process. I will show you the remaining procedures in Part 3 of this series.

About the Author

Brien Posey is a 22-time Microsoft MVP with decades of IT experience. As a freelance writer, Posey has written thousands of articles and contributed to several dozen books on a wide variety of IT topics. Prior to going freelance, Posey was a CIO for a national chain of hospitals and health care facilities. He has also served as a network administrator for some of the country's largest insurance companies and for the Department of Defense at Fort Knox. In addition to his continued work in IT, Posey has spent the last several years actively training as a commercial scientist-astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space. You can follow his spaceflight training on his Web site.

Featured

Subscribe on YouTube