Automatically Start and Stop Amazon VMs

Last week I came across this post Scheduling Start and Stop Times for Azure VMs. So I was thinking, this should be possible with Amazon as well.

You know, running labs in the cloud is really awesome, but every minute costs money. My last two post Ultimate Guide to Citrix Lifecycle Management and Citrix Lifecycle Management Deep Dive did leverage Amazon AWS for testing.

Let me introduce you to AWS Tools for Windows PowerShell and show you how to Automatically Start and Stop Amazon VMs.

Automatically Start and Stop Amazon VMs 01

Download and install AWS Tools for Windows Powershell and run it as Administrator. The first time you run it, it will create an encrypted profile which contains your AWS Access Key, Secret Key and Default Location.

Automatically Start and Stop Amazon VMs 02

To make this all work I use the fantastic Devolutions Remote Desktop Manager. At the moment it doesn’t support Powershell as an event, so I leverage command line instead.

You’ll need to create a Start and Stop Powershell script for each Amazon VM with the correct Instance ID. It’s also possible to override the default location from the script.

Automatically Start and Stop Amazon VMs 03

I’ve set the Post Execution Pause to 90 seconds which seems to be enough for the VM to start. Make sure to Run as Administrator.

Automatically Start and Stop Amazon VMs 04

This is working really well. The money you’ll save will pay for the Devolutions Remote Desktop Manager license itself.

A great tip for Amazon VMs is to assign elastic IPs, if not the external IP will change every time the VM is shut down.

Automatically Start and Stop Amazon VMs 05

 

One Response to Automatically Start and Stop Amazon VMs

Leave a reply