This topic describes how to install Amazon CloudWatch for your AWS EC2 instances and then how to view the Memory Metrics through the nOps application.

Install Amazon CloudWatch

How to view Memory and Usage Metrics

Install Amazon CloudWatch on EC2 Instances

To utilize the Resource Rightsizing tool to collect metrics for memory instances, install the Amazon CloudWatch agent.

nOps checks the average memory utilization for an Amazon EC2 instance over a two-week period and recommends an instance size that has at least the average memory utilization available. For example: If the current instance type has 8GB of memory available, and the average memory utilization is 700MB over a two-week period, the rightsizing recommendation will suggest an instance type that has 1GB of available memory.

How to install Amazon CloudWatch:

  1. Log in to the instance using SSH.

  2. Run the following commands at the console to download and install the Amazon CloudWatch agent:

    wget https://s3.amazonaws.com/amazoncloudwatch-agent/debian/amd64/latest/amazon-cloudwatch-agent.deb sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
  3. Download and install the collectd daemon:

    sudo apt-get update && sudo apt-get install collectd
  4. Create the Amazon CloudWatch configuration file by running the Amazon CloudWatch configuration wizard:

    sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard

  5. Log in to the AWS IAM console and select the “Roles” menu item. Click the “Create role” button.

  6. On the “Select type of trusted entity” page, select “EC2” as the service to be associated with the new role. Click the “Next: Permissions” button to proceed.

  7. On the “Attach permissions policies” page, select the “CloudWatchAgentServerPolicy”. Click “Next: Tags” to proceed.

  8. On the “Add tags” page, add tags if required (optional). Click “Next: Review” to proceed.

  9. On the “Review” page, enter a name for the new role. Click “Create role” to proceed and create the new role.

  10. Once the role is created, click your username in the top right corner of the navigation bar and select “My Security Credentials” from the drop-down menu.

  11. On the “My security credentials” page, click the “Create access key” button.

  12. Note the new AWS access key ID and corresponding secret access key. You may want to save this to a file.

  13. Create an AWS credentials file with the AWS access key ID and shared access key at /home/bitnami/.aws/credentials with the following content. Replace the AWS-ACCESS-KEY-ID and AWS-SECRET-ACCESS-KEY placeholders with the keys obtained in the previous step:

    [default] aws_access_key_id=AWS-ACCESS-KEY-ID aws_secret_access_key=AWS-SECRET-ACCESS-KEY

  14. Edit the common configuration file for the Amazon CloudWatch agent at /opt/aws/amazon-cloudwatch-agent/etc/common-config.toml and specify the path to the credentials file created in the previous step.

    sudo vi /opt/aws/amazon-cloudwatch-agent/etc/common-config.toml


    Update the following content:

    [credentials] shared_credential_file = "/home/bitnami/.aws/credentials"

  15. Start the Amazon CloudWatch agent with the following command:

    sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json -s

  16. Check that the agent is running with the following command:

    sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a status

The steps described above will also configure the Amazon CloudWatch agent to automatically start on server reboot.

Learn more through the AWS Help Article: Installing the CloudWatch Agent.

How to view Memory and Usage Metrics

Once cloudWatch is installed and the nOps app begins to receive the data you will be able to view resource details including memory and usage metrics.

To view metrics and usage

  1. Log into the nOps application.

  2. From a User Dashboard click on the Reports menu and select Cloud Inventory from the drop-down.

  3. On the Cloud Inventory page, filter the results from the left pane by selecting AWS and search for EC2 instances using the Filters options.

  4. Click on an instance to see details.

  5. The Resource Details page contains 3 tabs including Resource Details, Cost History, and Config History.

  6. The Resource Details tab displays an EC2 Usage Graph that shows usage over 1 week, 2 weeks and 3 months.

  7. You can change the CPU Utilization drop-down to see other options including Memory Used.

  8. To see information about this resource on AWS, click the View Resource on AWS Console button. You will be required to log into the AWS console to do this.

Did this answer your question?