How to stop AWS EC2 instance automatically when it is idle?

AWS is use and pay model (if it is reserved instance it is pay and use model). During usage of AWS organization needs to control the cost.  Set up automated mechanism whenever EC2 instance  does not running.

Here is the steps how to implement this.

1. EC2 Machine is running

2. CloudWatch – Creating Alarm

3. Select per instance metrics

4. Select any metrics (example CPU Utilization)

5. Set If CPU Utilization below 10% for continuous period of 10 minutes Alarm will send.

6. In Action – Set the required Action.