Use AWS CloudWatch to start/stop EC2 instances. How to implement it?

0 votes

I am trying to figure out ways to start/stop a AWS EC2 instance in case of CPU utilization increase or decrease on another EC2 instance.

I am familiar with service available Auto Scaling in AWS but I dont want to use these services.

So just looking if it is possible.

Just detailing the concern like suppose I have 2 EC2 instance on AWS account by name EC21 and EC22. By default, EC22 instance is stopped.

Now I need to setup CloudWatch to check if load/CPU utilization increase on EC21 instance by 70% then need to start EC22 server and similarly if load decrease on EC21 instance by 30% then stop EC22 server.

Please help!

Oct 26, 2018 in AWS by findingbugs
• 3,140 points
136 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

What you can do is set a CloudWatch alarm and check if it is triggered, it will notify an SNS topic. 

You can have that SNS topic then invoke a Lambda function, which can then start your EC2 instance.

All you need to do is follow the following steps and you are good to go.

  1. Create an AWS Lambda function that starts your EC2 instance.
  2. Configure your SNS topic to invoke your Lambda function when it receives messages. You can read about that here: Invoking Lambda functions using Amazon SNS notifications
  3. Finally, ensure your CloudWatch alert sends messages to the SNS topic.
Hope this helps.
answered Oct 26, 2018 by Priyaj
• 56,140 points

Related Questions In AWS

+2 votes
2 answers

Is it possible to ping AWS EC2 instance

Start by adding a new EC2 security group inbound ...READ MORE

answered Apr 9, 2018 in AWS by hemant
• 5,750 points
275 views
0 votes
1 answer

Is it possible to stop nodes in AWS ElastiCache cluster

At this time there is not a ...READ MORE

answered Jun 20, 2018 in AWS by Flying geek
• 3,130 points
115 views
0 votes
1 answer

How to link AWS Lambda function to Amazon CloudWatch ?

In order to create Log Group and ...READ MORE

answered Jul 20, 2018 in AWS by datageek
• 2,430 points
97 views
0 votes
1 answer

How to add SSL certificate to AWS EC2 with the help of new AWS Certificate Manager service

refer this link  https://aws.amazon.com/certificate-manager/faqs/ You can't install the certificates ...READ MORE

answered Jul 19, 2018 in AWS by Priyaj
• 56,140 points
34 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

AWS EC2 Free Tier- how many instances can i run?

Amazon has a handy page that details ...READ MORE

answered Jul 6, 2018 in AWS by Priyaj
• 56,140 points
207 views
0 votes
1 answer

How to get AWS account/service cost using CloudWatch API?

You can check this link for a ...READ MORE

answered Jul 13, 2018 in AWS by Priyaj
• 56,140 points
135 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.