Wanna know whether your ELB has at least one instance in service or not?
Just add a CloudWatch Alarm to your ELB and have it send status changes to SNS (from where you can route it to whatever notification system you’re using).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
{ "Parameters": { "AlarmSnsAccountId": { "Description": "Account ID of SNS topic to send Alarms to", "Type": "String" }, "AlarmSnsRegion": { "Description": "Region SNS topic to send Alarms to", "Type": "String" }, "AlarmSnsTopicName": { "Description": "Name of SNS topic to send Alarms to", "Type": "String" } }, "Resources": { "WebELB": { ... } "WebAutoScalingGroup": { ... }, "WebLaunchConfiguration": { ... }, "ELBHealthyHostCountAlarm": { "Properties": { "AlarmActions": [ { "Fn::Join": [ ":", [ "arn:aws:sns", { "Ref": "AlarmSnsRegion" }, { "Ref": "AlarmSnsAccountId" }, { "Ref": "AlarmSnsTopicName" } ] ] } ], "ComparisonOperator": "LessThanOrEqualToThreshold", "Dimensions": [ { "Name": "LoadBalancerName", "Value": { "Ref": "WebELB" } } ], "EvaluationPeriods": "3", "InsufficientDataActions": [ { "Fn::Join": [ ":", [ "arn:aws:sns", { "Ref": "AlarmSnsRegion" }, { "Ref": "AlarmSnsAccountId" }, { "Ref": "AlarmSnsTopicName" } ] ] } ], "MetricName": "HealthyHostCount", "Namespace": "AWS/ELB", "OKActions": [ { "Fn::Join": [ ":", [ "arn:aws:sns", { "Ref": "AlarmSnsRegion" }, { "Ref": "AlarmSnsAccountId" }, { "Ref": "AlarmSnsTopicName" } ] ] } ], "Period": "60", "Statistic": "Average", "Threshold": 0 }, "Type": "AWS::CloudWatch::Alarm" } } } |