Notification in AWS when a new target becomes healthy ECS

+1 vote

I'm looking to do something that seems like a common use case, however I have not been able to find any information anywhere that leads to a solution for what I want.

I'm using ECS in AWS for various services. When a new build occurs in my CI a new Docker image is pushed up to ECR and a lambda triggered to cause ECS to deploy the new image. This all works great. What I am struggling with is that I want to be notified somehow when the new code becomes 'live', this basically equates to when the newly registered target becomes healthy.

Does anybody have any suggestions as to how I can trigger a notification when a new target on an ELB becomes healthy?

Aug 23, 2018 in AWS by bug_seeker
• 15,350 points
38 views

1 answer to this question.

+1 vote

I'm fairly confident you should be able to use the HealthyHostCount metric for your alarm, if you adjust it correctly. This assumes you're actually deploying a new EC2 host before draining off the old one. You can verify this by looking at your metrics and confirming your HealthyHostCount exceeds your DesiredHostCount for any period of time. If this isn't the case, update your question with the details, as that answer (detecting new service deployments vs new hosts) is a bit different.

Once you've verified your HealthyHostCount does in fact exceed your DesiredHostCount, you can setup a CloudWatch Alarm to just detect any maximum > [DesiredCount] for 1 out of 1 data points for any 1 minute period. The period you set here should be small enough so as to not overlap with successive deployments (since the max won't change within a given period if you've deployed multiple times).


example

answered Aug 23, 2018 by Priyaj
• 56,900 points

Related Questions In AWS

0 votes
2 answers

How to skip headers when reading a CSV file in S3 and creating a table in AWS Athena?

Thanks for the answer. This should be clear ...READ MORE

answered Aug 14 in AWS by athenauserz
1,425 views
0 votes
1 answer

if instance is a part of some AutoScaling Group in AWS or not ?

You can run this command below on ...READ MORE

answered Jun 1, 2018 in AWS by Cloud gunner
• 4,280 points
65 views
0 votes
1 answer

Do you get charged for a security group in AWS EC2?

There is no charge applicable to Security ...READ MORE

answered Jul 18, 2018 in AWS by Priyaj
• 56,900 points
56 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Creating A New MySQL User In Amazon RDS Environment

AWS RDS security groups documentation (a common ...READ MORE

answered Jul 18, 2018 in AWS by Priyaj
• 56,900 points
206 views