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 & log files. We removed those & restarted the server it is working well.
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.
They suggest having cloud watch agent to be installed on actual instance.
In RDS there is memory alarm type which gets triggered on if memory remains less than some predefined criterion.
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?
Note: S3 provides object count alarms but couldn't find any specific to low memory.
Update:
Comment by Michael 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."
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 ]