After AWS starts Windows Server2008, the Ec2configservice is installed by default.
Here's an introduction to using the Ec2configservice service to create Cloudwatch custom monitoring disk usage.
Ec2configservicesettings
Modify Ec2configservicesettings Configuration
Modify JSON file
Restart Ec2configservice
1. Modify Ec2configservicesettings Configuration
After starting C:\Program files\amazon\ec2configservice\ec2configservicesettings.exe, tick "enable cloudwatch Logs integratin.".
2. Modify JSON file
Then modify the AWS.EC2.Windows.CloudWatch.json file under the C:\Program files\amazon\ec2configservice\settings folder.
Only the disk usage of Windows Server is monitored here.
{
"Engineconfiguration": {
"PollInterval": "00:05:00",
"Components": [
{
"Id": "PerformanceCounter",
"FullName": "AWS." EC2. Windows.cloudwatch.performancecountercomponent.performancecounterinputcomponent,aws. EC2. Windows.cloudwatch ",
"Parameters": {
"CategoryName": "LogicalDisk",
"CounterName": "% free spaces",
"InstanceName": "C:",
"Metricname": "Diskfree",
"Unit": "Percent",
"DimensionName": "Instanceid",
' Dimensionvalue ': ' {instance_id} '
}
},
{
"Id": "Cloudwatch",
"FullName": "AWS." EC2. Windows.cloudwatch.cloudwatch.cloudwatchoutputcomponent,aws. EC2. Windows.cloudwatch ",
"Parameters":
{
"AccessKey": "[Fill AccessKey]",
"Secretkey": "[Fill Secretkey]",
"Region": "[Fill Region]",
"NameSpace": "Windows/default"
}
}
],
"Flows": {
"Flows":
[
"Performancecounter,cloudwatch"
]
}
}
}
3. Restart Ec2configservice
>net Stop Ec2config
The Ec2config service is stopping.
The Ec2config service was stopped successfully.
>net Start Ec2config
The Ec2config service is starting.
The Ec2config service was started successfully.
In Cloudwatch, confirm whether to obtain the monitoring value
Click on the "windows/default" below "metrics".
Confirm the value of the diskfree.
Conclusion
There is no mention of IAM users and roles (at least to the user additional cloudwatchfullaccess policy), give EC2 the method of granting permissions generally have 2 kinds.
Create a role before starting the EC2 and assign the created role to the EC2 when you start the EC2
Create a user with the specified policy and use the accesskey and secretkey of that user to access the various resources in AWS.