Articles → AWS → Install Cloudwatch Agent In The AWS Windows EC2 Instance
Install Cloudwatch Agent In The AWS Windows EC2 Instance
Steps
- Create a role
- Launch an EC2 instance
- Install and configure SSM agent on EC2 instance
- Assign role to EC2 instance
- Run AWS-ConfigurePackage command in system manager
- Execute amazon-cloudwatch-agent-config-wizard in command prompt
- Run AmazonCloudWatch-ManageAgent command in system manager
- Output
Create A Role
Click to Enlarge
Launch An EC2 Instance
Install And Configure SSM Agent On EC2 Instance
https://amazon-ssm-us-east-2.s3.us-east-2.amazonaws.com/latest/windows_amd64/AmazonSSMAgentSetup.exe
$serviceKey = "HKLM:\SYSTEM\CurrentControlSet\Services\AmazonSSMAgent"$keyInfo = (Get-Item -Path $serviceKey).GetValue("Environment")$proxyVariables = @("http_proxy=<EC2 hostname>:<Port_number>", "https_proxy=<EC2 hostname>:<Port_number>", "no_proxy=169.254.169.254")if ($keyInfo -eq $null) { New-ItemProperty -Path $serviceKey -Name Environment -Value $proxyVariables -PropertyType MultiString -Force} else { Set-ItemProperty -Path $serviceKey -Name Environment -Value $proxyVariables}Restart-Service AmazonSSMAgent
- Replace EC2 hostname with the EC2 instance hostname
- Replace Port_number with 9999
Assign Role To EC2 Instance
Click to Enlarge
Run AWS-Configurepackage Command In System Manager
Click to Enlarge
Click to Enlarge
Click to Enlarge
Click to Enlarge
Execute Amazon-Cloudwatch-Agent-Config-Wizard In Command Prompt
Click to Enlarge
amazon-cloudwatch-agent-config-wizard.exe
Click to Enlarge
Click to Enlarge
Click to Enlarge
Click to Enlarge
Click to Enlarge
Click to Enlarge
Run Amazoncloudwatch-Manageagent Command In System Manager
Click to Enlarge
Click to Enlarge
Output
Click to Enlarge