alphaspirit - Fotolia

Can I turn off unused AWS EC2 instances?

I've heard our company could save money if we turn off our AWS EC2 instances when they're not in use. How can I manually do that?

Elasticity, or the ability to match compute demand to supply, is one of the fundamental properties of the cloud. AWS Auto Scaling seamlessly adds or removes compute capacity over a bank of AWS EC2s. However, if your company doesn't use Auto Scaling and runs EC2 instances that aren't needed 24/7, you can be throwing money away.

Amazon Web Services (AWS) Elastic Compute Cloud (EC2) instances that aren't continuously performing some type of compute function, such as hosting a website, should be shut down to save costs. And there are a few ways to do this.

Subscribing to one of many third-party SaaS vendors, such as Skeddly or Rocket Peak, is the most hands-off method for turning instances on or off. But that means admins must give away identity and access management credentials and pay for the SaaS subscription. To avoid this security problem, standalone applications, such as the Free EC2 Scheduler, can perform these tasks from your local Windows or Mac desktop.

If you have access to a continuously running Linux EC2, use the cron utility to run AWS EC2 stop/start CLI commands over designated times to automatically turn specified EC2s on or off. For Windows instances, use the AT command or schtasks utility in a similar way.

AWS OpsWorks, an application management service from Amazon, can also automatically turn off EC2 instances. To use OpsWorks, admins need to set up an OpsWorks cookbook and recipe, install it onto the stack and then have OpsWorks run the recipe on the application layer's instance. The OpsWorks recipe describes the cron task, which the service automatically deploys into the layer. Keep in mind that OpsWorks requires a lot of setup, so if you're not already using it to deploy software and configuration components in your cloud, using it just to turn instances on or off might be excessive.

About the author:
Russ Vanderpool, MSCS and MBA, is a technologist interested in using cloud technology to deliver solutions, help companies better serve customers and to identify new businesses. He has hands-on experience as an architect/developer and a business adviser across the finance, energy, education, technology and nonprofit sectors. Russ has architected and built a cloud infrastructure for a green tech company, and while working for Japan's largest system's integration firm, he developed proprietary object-oriented database visualization software for that market.

Dig Deeper on Amazon EC2 (Elastic Compute Cloud) management