The Amazon Elastic Compute Cloud is intended to run instances within Amazon Web Services (AWS), but the EC2 console can also manage instances running in your own datacenter. These instances can be listed in the console alongside cloud-based instances. On-premises instances are marked with a mi prefix.
Depending on whether the instance runs Windows or Linux, the exact method you will need to use to manage an instance on-premises will vary. I will be using a Microsoft Hyper-V virtual computer that runs Windows Server 2016 for this column. AWS supports Windows Server 2003 or higher.
Log in to the AWS console to manage this instance. Next, go to the EC2 dashboard. Scroll down to the bottom of a list of EC2 features located on the left-hand side of the interface. Click on Managed Instances, which is located in the Systems Manager Shared Resource section as shown in Figure 1.
[Click on the image to see a larger version.] Figure 1: Click the Managed Instances button. Next, click the Create an Activation link, as shown in the figure. This will display the Create activation screen as shown in Figure 2.
[Click on the image to see a larger view.] Figure 2: You can generate a code that can be used to register an agent for an instance. To create an activation, you need to generate a code which you can use with an agent to bring an instance to your management. Figure 2 shows you the information you will need. The activation description is the first. This is a friendly name to help you identify the activation.
Next, you’ll need to specify the instance limit. This limit is the maximum number of virtual machines (VMs), that you wish to manage with activation. AWS defaults to one, but you can increase it up to 1,000.
The IAM Role Name is the third thing you need to specify. This role determines the permissions that will apply to managing your VMs. While the default role should be sufficient for most situations, AWS offers the option to create a custom IAM role.
Next, you’ll need to set the expiry date for activation. This is the expiry date of the activation. You must specify a date less than 30 days in the future.
You will also need to enter a default name for your instance. This name is used to identify your managed instance in the EC2 console.
AWS will create an activation once you have provided the necessary information. AWS will then provide you with an activation number and a code. This information will be needed later.
Next, log in to your VM on-premises and download and execute the following PowerShell commands.
$dir = $env:TEMP + “\ssm”New-Item -ItemType directory -Path $dircd $dir(New-Object System.Net.WebClient).DownloadFile(“https://amazon-ssm-region.s3.amazonaws.com/latest/windows_amd64/AmazonSSMAgentSetup.exe”, $dir + “\AmazonSSMAgentSetup.exe”)Start-Process .\AmazonSSMAgentSetup.exe -ArgumentList @(“/q”, “/log”, “install.log”, “CODE=code”, “ID=id”, “REGION=region”) -WaitGet-Content ($env:ProgramData + “\Amazon\SSM\InstanceData\registration”)Get-Service -Name “AmazonSSMAgent” Note that you will have to replace the word region with the name of the region that you want to use. In the URL portion of your code and in the Start -Process line, you will need to specify the region in US-West-2 format. In the Start-Process command, you will need to replace the word code by your code and the word ID by your activation ID.
If you have any questions