More and more of us are moving our infrastructure into the cloud. Practically speaking this is just the way of things. What do you do when you have several Amazon Web Servers (instances) that simply don't need to be on all of the time? Ideally, by now Amazon should have come up with some kind of scheduler but they probably would charge for it. Or maybe they've intentionally left that up to third party products like this and this. The point is to DE-crease your monthly bill and with about an hour of work, you can do this yourself. To see how much you could save use the AWS Simple Monthly calculator.
First there are a few AWS setups you need:
- AWS windows instance on the free tier. (Ok, Ok i know it's technically $14/year)
- Windows logon for that instance.
- IAM new user with specific limited credentials.
- Access Key & Secret Key for that new user.
- The Amazon API code downloaded and installed on that Free Server
The blogs I mention above also with these help documents from Amazon help will take you to a point then it's just a matter of scheduling a Windows Task to run the 1-line BAT files. One to stop the instances, One to start and One to Associate the Elastic IP Addresses. I gave a the instances about 5-minutes to wind up before I run the Associate BAT.
Below are my notes on where I diverted from the instructions because I chose a Windows install:
On Mr Kulesza's blog:
**About 1/2 way down he refers to 'Applying an IAM Policy' be sure to put that code exactly in the way he has it in the blog. Don't be neurotic and change the date (like i did) it won't work.
**Refer to the syntax here for command line & your BAT files, it's cleaner and more efficient.
**I decided to create a Windows Environment Variable according to the Amazon Help Docs rather than embedding them into the command.
Amazon Help Documentation:
**I went through these Tasks/Steps (1-4) rather closely and carefully.
**Including having to install Java because it's doesn't come installed on the Micro Instance.
**Final step asks you to test by typing the command C:\> ec2-describe-regions This broke for me because the IAM user I set up doesn't have the credential to do this. However, using CMD to start/Stop the instance worked wonderfully.
**I did reset the system clock to be in the Eastern timezone (same as the Amazon data center where it lives.
The Final Step was to set up three simple Windows Scheduled Tasks. And Boom. You've got you cost saving measure on the books. No go ask for a big raise.