Using Amazon $NAME with Boto

Today, Amazon announced it's new $NAME service available in all five AWS regions. This new service automatically integrates with your existing systems with no configuration required. As requested, we've integrated it into boto. You don't even have to upgrade your installation, it's there for all versions by default.

Usage of $NAME is simple, you first have to sign up for the service, and then you'll notice a new connect_ method is available to you, connect_me().


>>> import boto
>>> me = boto.connect_me()
>>> me.hardware()
[u'sofa', u'closet', u'barn', u'dishwasher', u'pillow']
>>> me.services()
[u'ec2', u'sqs', u'input', u'output']

You can interact with hardware by name:

>>> lr_sofa = me.get_sofa("livingroom")
>>> lr_sofa.is_clean
False
>>> lr_sofa.vacuum()
u'Pending'

Most actions, like vacuum() take some time, so we can queue up a bunch of commands at once:

>>> lr_sofa.shampoo()
u'Queued'
>>> lr_sofa.dry()
u'Queued'
>>> lr_sofa.add(me.get_pillow())
u'Queued'

You'll also note here that we can call get_pillow with no arguments to just grab a random pillow available, instead of a specific one.


Next, we can see all the actions that are pending, as well as an estimated time to completion (ttc):

>>> lr_sofa.get_tasks()
[(u'clean', u'Running'), (u'vacuum', u'Queued'), (u'shampoo', u'Queued'), (u'dry', u'Queued'), (u'add(pl-012573)', 'Queued')]
>>> lr_sofa.get_ttc()
1789

Note that the ttc is returned as a number of seconds from now, in this case it's just under 30 minutes before we can expect all these tasks to be completed.

That's it! Have fun using the new $NAME service from Amazon!
2