Monitoring Memory Usage on a Windows EC2 Instance with CloudWatch

In a previous post, I discussed how to setup a Windows EC2 instance to monitor disk space usage with CloudWatch.  Another key attribute to monitor is memory usage.

Memory usage, just like disk space, is a performance monitor in Windows.

When examining the available performance counters available within Windows, the best counter for our objective is Available MBytes.


Here’s the JSON for this performance counter:

    "IsEnabled": true,
    "EngineConfiguration": {
    "PollInterval": "00:00:15",
        "Components": [
                "Id": "PerformanceCounter",
                "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "CategoryName": "Memory",
                    "CounterName": "Available MBytes",
                    "InstanceName": "",
                    "MetricName": "Memory Available",
                    "Unit": "Megabytes",
                    "DimensionName": "Instance",
                    "DimensionValue": "{instance_id}"
          "Id": "CloudWatch",
          "FullName": "AWS.EC2.Windows.CloudWatch.CloudWatch.CloudWatchOutputComponent,AWS.EC2.Windows.CloudWatch",
          "Parameters":  {
              "AccessKey": "",
              "SecretKey": "",
              "Region": "us-east-1",
              "NameSpace": "Windows/Default"
    "Flows": {
        "Flows":  [

When the values start popping in CloudWatch, you’ll see a chart of the average available memory in megabytes.


As you can see, I’m beating up my t2.micro with 1GB RAM pretty bad, as it has less than 512MB RAM free.

From here, I could set an alarm for sustained low available memory if desired.



As a supplement to the discussion above and referenced post also pertaining to sending performance counters to CloudWatch, I’d like to elaborate a bit more on what Run Command is doing when we apply the JSON…

It’s actually just pushing the JSON script to run locally on the instances.

You can see the JSON we pushed above in C:\Program Files\Amazon\SSM\Plugins\awsCloudWatch\AWS.EC2.Windows.CloudWatch.json


I should note that logs can be sent to CloudWatchLogs as well…more can be found on that topic here. The sample file is super useful in getting the desired parameters configured.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s