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 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:
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
Download and install the collectd daemon:
sudo apt-get update && sudo apt-get install collectd
Create the Amazon CloudWatch configuration file by running the Amazon CloudWatch configuration wizard:
Log in to the AWS IAM console and select the “Roles” menu item. Click the “Create role” button.
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.
On the “Attach permissions policies” page, select the “CloudWatchAgentServerPolicy”. Click “Next: Tags” to proceed.
On the “Add tags” page, add tags if required (optional). Click “Next: Review” to proceed.
On the “Review” page, enter a name for the new role. Click “Create role” to proceed and create the new role.
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.
On the “My security credentials” page, click the “Create access key” button.
Note the new AWS access key ID and corresponding secret access key. You may want to save this to a file.
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
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"
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
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
Log into the nOps application.
From a User Dashboard click on the Reports menu and select Cloud Inventory from the drop-down.
On the Cloud Inventory page, filter the results from the left pane by selecting AWS and search for EC2 instances using the Filters options.
Click on an instance to see details.
The Resource Details page contains 3 tabs including Resource Details, Cost History, and Config History.
The Resource Details tab displays an EC2 Usage Graph that shows usage over 1 week, 2 weeks and 3 months.
You can change the CPU Utilization drop-down to see other options including Memory Used.
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.