I am unable to send custom metrics to Amazon CloudWatch from an Amazon EC2 Windows instance using the EC2Config service. How do I resolve this issue?

Errors received when sending custom metrics to CloudWatch are often caused by an incorrect EC2Config configuration, user permissions, or custom AMIs.

To resolve issues related to custom CloudWatch metrics check the following:

Verify that the instance has access to the CloudWatch endpoints by using the telnet tool for windows.

CloudWatch endpoints:

Note: Some CloudWatch endpoints do not respond to pings.

If there is no connectivity, check the following:

  • If the instance is in a public subnet, add a default route to the Internet gateway in the routing table.
  • If the instance is in a private subnet, add a default route to the NAT instance gateway.

Verify that the security groups and ACLs have the appropriate rules for outbound access.

Enable CloudWatch Logs integration in the EC2ConfigService settings and ensure that you have the latest version of the EC2Config service.

If the traffic is passing through a proxy, verify that you have the correct proxy settings; see Configure Proxy Settings for the EC2Config Service.

The access and secret keys of the IAM user or role being used in the AWS.EC2.Windows.CloudWatch.json file must have access to the following actions in the policy:

  • For CloudWatch metrics: "cloudwatch:PutMetricData"
  • For CloudWatch Logs: "logs:CreateLogGroup", "logs:CreateLogStream", "logs:DescribeLogGroups", "logs:DescribeLogStreams", "logs:PutLogEvents"

In the CloudWatch and CloudWatchLogs section of the JSON file, verify that the region entered is the region in which the instance is launched.

Cross-check the CategoryName, CounterName, and InstanceName by adding the metric in Windows Performance Monitor and ensure that the appropriate unit is being used.

The following example shows how the parameters in the performance monitor should be matched with the JSON file:

For percentage free space, the following would be the parameters in the JSON file:

{

    "Id": "PerformanceCounterDisk",

    "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch",

    "Parameters": {

        "CategoryName": "LogicalDisk",

        "CounterName": "% Free Space",

        "InstanceName": "C:",

        "MetricName": "C.FreeDiskPercent",

        "Unit": "Percent",

        "DimensionName": "Instance",

        "DimensionValue": "Hostname: {hostname} IP Address: {ip_address} InstanceId: {instance_id}"

    }

},

In the Unit parameter, enter the appropriate unit of measure for the metric.

For fetching the hostname, ip address, or instance ID using the metadata service, use the predefined variables {instance_id}, {hostname}, and {ip_address}.

For pushing custom logs, verify that the timestamp format is the correct format; see Custom Date and Time Format Strings.

For troubleshooting errors in the service and the JSON file, check the EC2Config log file located at C:\Program Files\Amazon\Ec2ConfigService\Logs and review errors messages for the following:

  • JSON format errors
  • Flow, PerformanceCounter, and CustomLog errors
  • Skipped events due to possible incorrect date formatting
  • Incorrect values on JSON configuration parameters
  • Credential or permission errors

Note: Your source log file must have a timestamp at the beginning of each log line, and there must be a space following the timestamp.

The format of the flows section in the AWS.EC2.Windows.CloudWatch file should be "(Input1, Input2),Output".

After you're finished updating the JSON file, restart EC2Config; see Stopping, Restarting, Deleting, or Uninstalling EC2Config.

CloudWatch, EC2Config service, custom metrics, custom logs, Windows logs to CloudWatch


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2016-11-28