Disk utilization monitoring
For SFTP Gateway, you want to keep an eye on your local disk space. If you are running low, you can dynamically increase your EC2 volume using our Resizing an EC2 Instance Volume wiki page.
By default, CloudWatch does not monitor disk utilization for EC2 instances. To report this information, you can install the Amazon CloudWatch Monitoring Scripts for Linux, and then send disk utilization metrics to CloudWatch.
The instructions in that AWS user guide are pretty long. So here are some condensed instructions you can follow:
First, attach the CloudWatchFullAccess
managed policy to your EC2 instances' IAM Role. This will allow your EC2
instance to send CloudWatch events.
Second, paste the following commands into your terminal:
sudo su
rm -rf /var/tmp/aws-mon/
yum -y install perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https
mkdir -p /home/ec2-user/cloudwatch/ && cd $_
curl http://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.1.zip -O
unzip CloudWatchMonitoringScripts-1.2.1.zip && rm -f $_
echo "*/5 * * * * ~/cloudwatch/aws-scripts-mon/mon-put-instance-data.pl --swap-util --mem-util --disk-space-util --disk-path=/ --from-cron" >> /var/spool/cron/ec2-user
service crond reload
exit
~/cloudwatch/aws-scripts-mon/mon-put-instance-data.pl --swap-util --mem-util --disk-space-util --disk-path=/
If all goes well, you should see this message:
Successfully reported metrics to CloudWatch.
Finally, go to CloudWatch > Metrics > Linux System > Filesystem, InstanceId, MountPath. You should see
the DiskSpaceUtilization
metric for your instance.
From here, you can create a Dashboard to track your storage patterns. Or you can create a CloudWatch alarm to send an SNS text message if you start running out of space (e.g. 80% utilization).