Tag Archives: python

LittleChef to use SSH keypair

I found out littlechef from Grig’s post. Thanks to both Grig and to Miguel for the tool and good writeup.

I added some lines to work with the new feature of littlechef about the SSH keypair. Now I can login to my Ubuntu Amazon EC2 instances by specifying the keypair-path on the auth.conf:

[userinfo]
user = ubuntu
password = 
keypair-file =  /home/cocoy/.ssh/id-rsa.pub

Hope that works well for others. The gist is shown below:

Python 2.4.4 and boto-2.0b3 import hashlib error

Python 2.4.4 and boto-2.0b3 import hashlib error has a fix found here

Running an older Debian AMI with RAID0 XFS EBS volumes, I patch boto-2.0b3. Hopefully, have this instance migrated using a newer Ubuntu EBS AMI and use ec2-consistent-snapshot instead.

1. Copy a patch file to a temporary file:

# vi /tmp/c_14.patch
--- boto-2.0b3/boto/ec2/connection.py   Fri Nov 12 14:16:07 2010
+++ boto/ec2/connection.py      Fri Nov 12 15:19:21 2010
@@ -28,7 +28,6 @@
 import base64
 import hmac
 import boto
-from hashlib import sha1 as sha
 from boto.connection import AWSQueryConnection
 from boto.resultset import ResultSet
 from boto.ec2.image import Image, ImageAttribute
@@ -51,6 +50,11 @@
 from boto.ec2.tag import Tag
 from boto.exception import EC2ResponseError
 
+try:
+    from hashlib import sha1 as sha
+except ImportError:
+    import sha
+
 #boto.set_stream_logger('ec2')
 
 class EC2Connection(AWSQueryConnection):

2. Now we can get the source of boto:

# cd /usr/lib/python2.4/
# mv boto-2.0b3-py2.4.eggboto-2.0b3-py2.4.egg boto-2.0b3-py2.4.egg.old
# easy_install -Z boto 
# cd boto-2.0b3-py2.4.egg/boto/ec2
# patch < /tmp/c_14.patch

Continue reading