This article explains how to use CloudWatch agents to collect memory usage (%GB consumed) and analyze data points, helping with EC2 sizing with the AWS Resource Optimization tool
This exercise will cover the main steps