Trying to create an Amazon Cloudwatch alert to monitor an Elastic Beanstalk deployment of a public facing website. The alert options for Elastic Beanstalk don't seem to allow for monitoring specific instances that fail Beanstalk's health check URL query. I need to identify the specific unhealthy INSTANCE and terminate it. From there, my autoscaling policy will automatically replace the terminated instance.
Some background
Setup: Elastic Beanstalk deployment running LAMP for a public facing site.
Purpose: For additional failsafe security, I've added a daemon to monitor the state of the file system at /var/www. If the timestamp or size of the filesystem changes (i.e., unwanted file introduction or change), the monitor fires a script that deletes the php file located at elasticbeanstlak's health check URL (random url in the /var/www dir) and forces an "unhealthy" state at the ELB monitoring level.
All is working fine except I can't seem to find a way to get Amazon to identify the specific instance which has caused the health check to fail and let me terminate only that instance.
The AWS docs for creating alarms to handle this specific functionality and initiating instance termination is unclear. I've tried setting up health monitoring at the Beanstalk level, which works to identify an unhealthy state, but not the specific instance. Not new to AWS, but relatively new to Cloudwatch metrics.
Thanks for suggestions.