EBS Boot Instance Stop+Start Begins a New Hour of Charges on EC2

| 2 Comments

Scott Moser and I were wondering if stopping and starting an EBS boot instance on EC2 would begin a new hour’s worth of charges or if AWS would not increase your costs if the stop/start were done a few minutes apart in the same hour.

For some reason, I had assumed that it would start a new hour of fees, possibly because of my experience with the somewhat unrelated terminating old instances and starting new instances. However, we decided it would be easy to test, so here are the results.

I tested with an Ubuntu 10.10 Maverick 32-bit server EBS boot AMI on the m1.small instance type in the ap-southeast-1 (Singapore) region. The AMI should have no effect on charges, so these results should apply to any OS you run on EC2.

I used an AWS account that did not have any EC2 instance fees in the Singapore region that month (Scott’s idea) so that this activity would be easy to see as the only charges on that account.

$ ec2-run-instances --region ap-southeast-1 --key KEYPAIR ami-6a136d38
RESERVATION r-48370d1a  063491364108    default
INSTANCE    i-908782c2  ami-6a136d38            pending KEYPAIR 0   m1.small    2010-10-14T16:38:17+0000    ap-southeast-1a aki-13d5aa41    monitoring-disabled                 ebs         paravirtual 
$ ec2-stop-instances --region ap-southeast-1 i-908782c2
INSTANCE    i-908782c2  running stopping

$ ec2-start-instances --region ap-southeast-1 i-908782c2
INSTANCE    i-908782c2  stopped pending
$ ec2-stop-instances --region ap-southeast-1 i-908782c2
INSTANCE    i-908782c2  running stopping

$ ec2-start-instances --region ap-southeast-1 i-908782c2
INSTANCE    i-908782c2  stopped pending
$ ec2-stop-instances --region ap-southeast-1 i-908782c2
INSTANCE    i-908782c2  running stopping

$ ec2-start-instances --region ap-southeast-1 i-908782c2
INSTANCE    i-908782c2  stopped pending
$ ec2-terminate-instances --region ap-southeast-1 i-908782c2
INSTANCE    i-908782c2  running shutting-down

You can see that I had four begin/end sessions where the instance was running; all of these took place in a single real time hour. Before stopping, I waited each time for the instance to move to running, and I waited each time for the instance to move to stopped before starting it again.

I then waited for a while (hours) for the results of this activity to show up on the AWS account activity page.

activity snapshot

If Amazon considered all of this activity to be taking place by a single instance in a single hour real time hour then the charge would have been $0.095 (m1.small in the ap-east-1 region). However, Amazon considers each of these run sessions to be starting a new hour of charges, so I was charged for 4 hours of instance time at $0.38.

In general, this additional charge is not a big deal. After all, for the smaller instance types we are only talking pennies or dimes for an hour of instance time. However, if you set up some sort of system where you are constantly stopping and starting instances within a single hour of wall clock time, then the effects of this policy could multiply your costs. You might want to investigate ways to keep your instances running more continuously and only stopping them if the anticipated down time is more than an hour.

Update: After I ran this test I found that Shlomo Swidler answered this question on the EC2 forum, but it’s still fun to prove it.

2 Comments

I do think this is entirely in the 'spirit of the cloud' of minimizing waste by maximizing utilization, just as paying for unused elastic IPs.

start/stop changes underlying hardware, i suspect, so there is an energy penalty involved. makes perfect sense we are charged for that.

but a reboot...

In the case of automated scripts bringing instances up and down, I would then say set them up to leave them running for just short of an hour.

Since you are going to get charged for the full hour, if you keep the instance up and during that hour the need for the instance comes around again, then you already have it running and can use it.

If this was being done for example in a load balancing situation where additional instances will be brought up when a certain threshold is reached then shut back down after you go below a certain level. It would be worth leaving the instance up for 45-50 minutes as that load could go up and down below those thresholds multiple times in that span of time.

Leave a comment

Ubuntu AMIs

Ubuntu AMIs for EC2:


More Entries

When Are Your SSL Certificates Expiring on AWS?
If you uploaded SSL certificates to Amazon Web Services for ELB (Elastic Load Balancing) or CloudFront (CDN), then you will want to keep an eye on the expiration dates and…
Throw Away The Password To Your AWS Account
reduce the risk of losing control of your AWS account by not knowing the root account password As Amazon states, one of the best practices for using AWS is Don’t…
AWS Community Heroes Program
Amazon Web Services recently announced an AWS Community Heroes Program where they are starting to recognize publicly some of the many individuals around the world who contribute in so many…
EBS-SSD Boot AMIs For Ubuntu On Amazon EC2
With Amazon’s announcement that SSD is now available for EBS volumes, they have also declared this the recommended EBS volume type. The good folks at Canonical are now building Ubuntu…
EC2 create-image Does Not Fully "Stop" The Instance
The EC2 create-image API/command/console action is a convenient trigger to create an AMI from a running (or stopped) EBS boot instance. It takes a snapshot of the instance’s EBS volume(s)…
Finding the Region for an AWS Resource ID
use concurrent AWS command line requests to search the world for your instance, image, volume, snapshot, … Background Amazon EC2 and many other AWS services are divided up into various…
Changing The Default "ubuntu" Username On New EC2 Instances
configure your own ssh username in user-data The official Ubuntu AMIs create a default user with the username ubuntu which is used for the initial ssh access, i.e.: ssh ubuntu@<HOST>…
Default ssh Usernames For Connecting To EC2 Instances
Each AMI publisher on EC2 decides what user (or users) should have ssh access enabled by default and what ssh credentials should allow you to gain access as that user.…
New c3.* Instance Types on Amazon EC2 - Nice!
Worth switching. Amazon shared that the new c3.* instance types have been in high demand on EC2 since they were released. I finally had a minute to take a look…
Query EC2 Account Limits with AWS API
Here’s a useful tip mentioned in one of the sessions at AWS re:Invent this year. There is a little known API call that lets you query some of the EC2…
Using aws-cli --query Option To Simplify Output
My favorite session at AWS re:Invent was James Saryerwinnie’s clear, concise, and informative tour of the aws-cli (command line interface), which according to GitHub logs he is enhancing like crazy.…
Reset S3 Object Timestamp for Bucket Lifecycle Expiration
use aws-cli to extend expiration and restart the delete or archive countdown on objects in an S3 bucket Background S3 buckets allow you to specify lifecycle rules that tell AWS…
Installing aws-cli, the New AWS Command Line Tool
consistent control over more AWS services with aws-cli, a single, powerful command line tool from Amazon Readers of this tech blog know that I am a fan of the power…
Using An AWS CloudFormation Stack To Allow "-" Instead Of "+" In Gmail Email Addresses
Launch a CloudFormation template to set up a stack of AWS resources to fill a simple need: Supporting Gmail addresses with “-” instead of “+” separating the user name from…
New Options In ec2-expire-snapshots v0.11
The ec2-expire-snapshots program can be used to expire EBS snapshots in Amazon EC2 on a regular schedule that you define. It can be used as a companion to ec2-consistent-snapshot or…
Replacing a CloudFront Distribution to "Invalidate" All Objects
I was chatting with Kevin Boyd (aka Beryllium) on the ##aws Freenode IRC channel about the challenge of invalidating a large number of CloudFront objects (35,000) due to a problem…
Email Alerts for AWS Billing Alarms
using CloudWatch and SNS to send yourself email messages when AWS costs accrue past limits you define The Amazon documentation describes how to use the AWS console to monitor your…
Cost of Transitioning S3 Objects to Glacier
how I was surprised by a large AWS charge and how to calculate the break-even point Glacier Archival of S3 Objects Amazon recently introduced a fantastic new feature where S3…
Running Ubuntu on Amazon EC2 in Sydney, Australia
Amazon has announced a new AWS region in Sydney, Australia with the name ap-southeast-2. The official Ubuntu AMI lookup pages (1, 2) don’t seem to be showing the new location…
Save Money by Giving Away Unused Heavy Utilization Reserved Instances
You may be able to save on future EC2 expenses by selling an unused Reserved Instance for less than its true value or even $0.01, provided it is in the…
Installing AWS Command Line Tools from Amazon Downloads
This article describes how to install the old generation of AWS command line tools. For the most part, these have been replaced with the new AWS cli that is…
Convert Running EC2 Instance to EBS-Optimized Instance with Provisioned IOPS EBS Volumes
Amazon just announced two related features for getting super-fast, consistent performance with EBS volumes: (1) Provisioned IOPS EBS volumes, and (2) EBS-Optimized Instances. Starting new instances and EBS volumes with…
Which EC2 Availability Zone is Affected by an Outage?
Did you know that Amazon includes status messages about the health of availability zones in the output of the ec2-describe-availability-zones command, the associated API call, and the AWS console? Right…
Installing AWS Command Line Tools Using Ubuntu Packages
See also: Installing AWS Command Line Tools from Amazon Downloads Here are the steps for installing the AWS command line tools that are currently available as Ubuntu packages. These include:…
Ubuntu Developer Summit, May 2012 (Oakland)
I will be attending the Ubuntu Developer Summit (UDS) next week in Oakland, CA. ┬áThis event brings people from around the world together in one place every six months to…
Uploading Known ssh Host Key in EC2 user-data Script
The ssh protocol uses two different keys to keep you secure: The user ssh key is the one we normally think of. This authenticates us to the remote host, proving…
Seeding Torrents with Amazon S3 and s3cmd on Ubuntu
Amazon Web Services is such a huge, complex service with so many products and features that sometimes very simple but powerful features fall through the cracks when you’re reading the…
CloudCamp
There are a number of CloudCamp events coming up in cities around the world. These are free events, organized around the various concepts, technologies, and services that fall under the…
Use the Same Architecture (64-bit) on All EC2 Instance Types
A few hours ago, Amazon AWS announced that all EC2 instance types can now run 64-bit AMIs. Though t1.micro, m1.small, and c1.medium will continue to also support 32-bit AMIs, it…
ec2-consistent-snapshot on GitHub and v0.43 Released
The source for ec2-conssitent-snapshot has historically been available here: ec2-consistent-snapshot on Launchpad.net using Bazaar For your convenience, it is now also available here: ec2-consistent-snapshot on GitHub using Git You are…