I'm running into an odd issue when launching EC2 instances via boto and the Python API. Everything is fine so long as I don't attempt to launch provisioned iops instances, even if I set other volume mapping options like disk size.

However, if I set an iops count by setting volume_type to 'io1' and iops to a value other than None, the run_instances API call appears to succeed without error and the new instances appear in the 'pending' state, but they quickly change to the 'terminated' state without ever entering 'running'.

In the following code, which uses boto (2.6.0 on Python 2.7) to establish a connection conn to us-east-1 before proceeding:

launch_params = {
        'min_count': n_instances, 'max_count': n_instances,
        'instance_type': 'm1.large',
        'ebs_optimized': True
# Launch with provisioned iops or a larger disk if requested (EBS only)
if provisioned_iops is not None or disk_size_gb is not None:
        dev_sda = boto.ec2.blockdevicemapping.EBSBlockDeviceType(connection=conn, size=disk_size_gb, delete_on_termination=True)
        if provisioned_iops is not None:
                dev_sda.volume_type = 'io1'
        bdm = boto.ec2.blockdevicemapping.BlockDeviceMapping()
        bdm['/dev/sda'] = dev_sda
        launch_params['block_device_map'] = bdm

res = conn.run_instances(ami_id, **launch_params)

... if I attempt to launch an m1.large AMI with ebs_optimized=True and privisioned_iops=500 the run_instances call succeeds and the instance appears as pending but then goes back to terminated with nothing in the system logs.

Launching without provisioned iops works fine.


Argh. As soon as I posted I found the problem. I'll leave this here for anyone else who has the same issue:

run_instances doesn't validate all parameters fully before creating the instance (and charging you for the first hour, incidentally). In particular, it does not check and enforce the "Maximum ratio of 10:1 is permitted between IOPS and volume size" limit or "Volume size must be at least 10GiB" limit on PIOPS volumes. If you violate these constraints your instance will appear to launch but then promptly terminate, costing you a good few dollars if you launched a bunch of them.

Launching with a 50GB EBS volume would allow 500 IOPs.

  • Report this to Amazon and ask for a refund. :) – Michael Hampton May 24 '13 at 3:19
  • @MichaelHampton Isn't that like reporting a bug to Google? Throwing messages into a black hole? – Craig Ringer May 24 '13 at 3:24
  • (Actually, that's unfairly hash; I've had spotty but useful results from reporting bugs to both Google and Amazon. Finding the right person to contact directly can make all the difference, though.) – Craig Ringer May 24 '13 at 3:33
  • Heh. After saying that I got an email from an AWS team member wanting follow-up info. Unfortunately they sent it via their ticketing system from a no-reply email address and with a supportid case URL that redirects to the "IAM for AWS support" info page. So it looks like I have to do some setup to reply :S but I'm still very impressed to have been contacted. – Craig Ringer May 29 '13 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.