title: How to set the low memory alarm for AWS EC2 instance, S3 bucket?
body: <p>I am using AWS EC2 for deployment of the dropwizard server code. We recently came across a case where the instance was stopped automatically. On investigation we found that it's whole memory was consumed we saw what consumed the memory mostly were backup files &amp; log files. We removed those &amp; restarted the server it is working well.</p>
  
  <p>To avoid such behavior in future we thought of making use of ClaudWatch alarms provided by the AWS, but the parameters for alarm for EC2 are more of disk throughput, Network related not the diskspace related.</p>
  
  <p><a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring_ec2.html" rel="nofollow noreferrer">EC2 monitoring.</a></p>
  
  <p>They suggest having <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html" rel="nofollow noreferrer">cloud watch agent</a> to be installed on actual instance.</p>
  
  <p>In RDS there is <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.OS.html" rel="nofollow noreferrer">memory alarm type</a> which gets triggered on if memory remains less than some predefined criterion.</p>
  
  <p>For EC2 instance, S3 bucket, Do we have any cloud watch alarm type or any other tool which will trigger a notification on emails when instance is low on memory?</p>
  
  <p><strong>Note:</strong> S3 provides object count alarms but couldn't find any specific to low memory.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Comment by <a href="https://stackoverflow.com/users/1695906/michael-sqlbot">Michael</a> suggests that "There are two problems, here. EC2 instances do not stop when they run out of "memory" (nor storage, which is what you are actually describing). This does not happen. Also, bucket storage is unlimited."</p>
  
  <p>There could be two possibilities instance may have stopped due to other reasons, but when we investigated the added storage to an instance which was 8GB got full. For S3 as he suggested there no limit how much can be stored [ Hence the couldwatch dashboard may be showing object count, not actual memory consume but is there any way that when S3 consumes a certain amount of files ( In MBs or GBs ) on the AWS we may get notifications ]</p>