how find instance types supported by a particular image

880 views
Skip to first unread message

sajuptpm

unread,
Jan 11, 2011, 2:21:50 AM1/11/11
to boto-users

Hi,
suppose i have an image 'ami-123456'.
We can't create all types of instances ('m1.small', 'm1.large',
'm1.xlarge, 'm2.4xlarge', 'cc1.4xlarge' etc--) using this image.
How we can find, which are the instance types supported by a
particular image ?????
Have any API method ????

Victor Trac

unread,
Jan 11, 2011, 2:41:55 AM1/11/11
to boto-...@googlegroups.com
Based on this and your previous questions, consider reading this section of the developer docs:

http://docs.amazonwebservices.com/AWSEC2/latest/DeveloperGuide/instance-types.html

The "platform" is exposed in boto via an Image object's architecture attribute:

import boto
conn = boto.connect_ec2()
my_64bit_AMIs = conn.get_all_images(owner='self', filter={ 'architecture' : 'x86_64' })

--
Victor Trac | victortrac.com | twitter.com/victortrac

> --
> You received this message because you are subscribed to the Google Groups "boto-users" group.
> To post to this group, send email to boto-...@googlegroups.com.
> To unsubscribe from this group, send email to boto-users+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/boto-users?hl=en.
>

sajuptpm

unread,
Jan 11, 2011, 5:44:05 AM1/11/11
to boto-users

Can i take like this ?

architecture = {'i386':['m1.small','t1.micro','c1.medium'],
x86_64':
['m1.large','m1.xlarge','t1.micro','c1.xlarge','m2.xlarge','m2.2xlarge','m2.4xlarge']}

if template architecture is 'i386', then instance types are
['m1.small','t1.micro','c1.medium']

if template architecture is 'x86_64', then instance types are
['m1.large','m1.xlarge','t1.micro','c1.xlarge','m2.xlarge','m2.2xlarge','m2.4xlarge']


Ten what about instance types 'cc1.4xlarge' and 'cg1.4xlarge'.



sajuptpm

unread,
Jan 11, 2011, 7:11:24 AM1/11/11
to boto-users
suppose we have an image 'ami-123456'.
How we can find that, this image supporting the instance types
'cc1.4xlarge' and 'cg1.4xlarge'. ?????

Mitchell Garnaat

unread,
Jan 11, 2011, 7:41:43 AM1/11/11
to boto-...@googlegroups.com
Hi -

Since all of the information you want isn't available from a single API call in EC2, we need to pull information from a few places to answer this question.  First, check out:


for the current, definitive description of the available instance types.

To determine whether a particular AMI is compatible with a particular instance type, you need two pieces of information:
  1. The architecture of the AMI which is either i386 or x86_64.  An architecture of i386 is compatible only with 32-bit instance types (e.g. t1.micro, m1.small, c1.medium).  So, if the architecture is i386, those are the only possible choices for compatible instance types today.
  2. The virtualization_type of the AMI which is either paravirtual or hvm.  The paravirtual type applies to all non-cluster instance types while the hvm applies to the cluster instance types.  So, if the architecture is x86_64 and the virtualization_type is paravirtual, the possible instance types are t1.micro, m1.large, m1.xlarge, c1.xlarge, m2.xlarge, m2.2xlarge, or m2.4xlarge.  If the virtualization_type is hvm, the possible instance types are cc1.4xlarge or cg1.4xlarge.
The architecture and virtualization_type are both attributes of the Image object in boto and are easily determined for any given AMI.  Since the mapping above is not available from EC2, you will have to maintain this within your own application and, over time, you will inevitably have to modify it when new instance types become available.

Mitch

sajuptpm

unread,
Jan 11, 2011, 8:14:24 AM1/11/11
to boto-users
First thanks for the infos.

* Attribute 'architecture' is there in Image object.
* Attribute 'virtualization_type' is not in Image object.

All the attributes of an image object
-------------------------------------
{'description': u'EC2 CentOS 5.5 GPU HVM AMI (Driver 260.19.29)',
'root_device_name': u'/dev/sda1', 'root_device_type': u'ebs', 'name':
u'EC2 CentOS 5.5 GPU HVM AMI (Driver 260.19.29)',
'block_device_mapping': {u'/dev/sda1':
<boto.ec2.blockdevicemapping.EBSBlockDeviceType object at
0x65508543c>}, 'owner_alias': u'amazon', 'kernel_id': None, 'region':
RegionInfo:us-east-1, 'ramdisk_id': None, 'connection':
EC2Connection:ec2.amazonaws.com, 'platform': None, 'state':
u'available', 'location': u'amazon/EC2 CentOS 5.5 GPU HVM AMI (Driver
260.19.29)', 'item': u'\n ', 'is_public': True, 'ownerId':
u'76746332', 'product_codes': [], 'type': u'machine', 'id':
u'ami-42a2532b', 'architecture': u'x86_64'}

Mitchell Garnaat

unread,
Jan 11, 2011, 8:27:58 AM1/11/11
to boto-...@googlegroups.com
It does now 8^)

It would be nice if AWS announced these changes in some way but unfortunately they don't (except for major new releases).  They don't even bump the API version or anything.  However, even if the attribute doesn't show up as a pythonized attribute name, you can always find the value you are looking for by using the EC2-specific attribute name.  So, if the code doesn't anticipate an attribute called "virtualization_type", you will find it as "virtualizationType" on the Image object.

Mitch


--
Reply all
Reply to author
Forward
0 new messages