Skip to content

Instantly share code, notes, and snippets.

@apetresc
Created May 11, 2012 01:45
Show Gist options
  • Select an option

  • Save apetresc/2656986 to your computer and use it in GitHub Desktop.

Select an option

Save apetresc/2656986 to your computer and use it in GitHub Desktop.
Trying to connect Boto to Openstack
DEBUG:boto:Method: POST
DEBUG:boto:Path: /services/Cloud/
DEBUG:boto:Data:
DEBUG:boto:Headers: {}
DEBUG:boto:Host: http://192.168.1.135:8773
DEBUG:boto:establishing HTTP connection: kwargs={}
DEBUG:boto:Token: None
DEBUG:boto:using _calc_signature_2
DEBUG:boto:query string: AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A38%3A56Z&Version=2011-12-15
DEBUG:boto:string_to_sign: POST
http://192.168.1.135:8773
/services/Cloud/
AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A38%3A56Z&Version=2011-12-15
DEBUG:boto:len(b64)=44
DEBUG:boto:base64 encoded digest: cDiVnEYUBmPIg/HSQGaATT1zrv515BiJ432NDcffEfU=
DEBUG:boto:query_string: AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A38%3A56Z&Version=2011-12-15 Signature: cDiVnEYUBmPIg/HSQGaATT1zrv515BiJ432NDcffEfU=
DEBUG:boto:encountered gaierror exception, reconnecting
DEBUG:boto:establishing HTTP connection: kwargs={}
DEBUG:boto:Token: None
DEBUG:boto:using _calc_signature_2
DEBUG:boto:query string: AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A38%3A57Z&Version=2011-12-15
DEBUG:boto:string_to_sign: POST
http://192.168.1.135:8773
/services/Cloud/
AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A38%3A57Z&Version=2011-12-15
DEBUG:boto:len(b64)=44
DEBUG:boto:base64 encoded digest: awPou824Bw+E6kxJ+io/e9g/EyaWJfIw7l4zGNdnaio=
DEBUG:boto:query_string: AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A38%3A57Z&Version=2011-12-15 Signature: awPou824Bw+E6kxJ+io/e9g/EyaWJfIw7l4zGNdnaio=
DEBUG:boto:encountered gaierror exception, reconnecting
DEBUG:boto:establishing HTTP connection: kwargs={}
DEBUG:boto:Token: None
DEBUG:boto:using _calc_signature_2
DEBUG:boto:query string: AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A38%3A58Z&Version=2011-12-15
DEBUG:boto:string_to_sign: POST
http://192.168.1.135:8773
/services/Cloud/
AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A38%3A58Z&Version=2011-12-15
DEBUG:boto:len(b64)=44
DEBUG:boto:base64 encoded digest: D241rQEID6qIPiynxE011MBaQ/ewFy/YEUGv+kQTlac=
DEBUG:boto:query_string: AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A38%3A58Z&Version=2011-12-15 Signature: D241rQEID6qIPiynxE011MBaQ/ewFy/YEUGv+kQTlac=
DEBUG:boto:encountered gaierror exception, reconnecting
DEBUG:boto:establishing HTTP connection: kwargs={}
DEBUG:boto:Token: None
DEBUG:boto:using _calc_signature_2
DEBUG:boto:query string: AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A38%3A58Z&Version=2011-12-15
DEBUG:boto:string_to_sign: POST
http://192.168.1.135:8773
/services/Cloud/
AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A38%3A58Z&Version=2011-12-15
DEBUG:boto:len(b64)=44
DEBUG:boto:base64 encoded digest: D241rQEID6qIPiynxE011MBaQ/ewFy/YEUGv+kQTlac=
DEBUG:boto:query_string: AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A38%3A58Z&Version=2011-12-15 Signature: D241rQEID6qIPiynxE011MBaQ/ewFy/YEUGv+kQTlac=
DEBUG:boto:encountered gaierror exception, reconnecting
DEBUG:boto:establishing HTTP connection: kwargs={}
DEBUG:boto:Token: None
DEBUG:boto:using _calc_signature_2
DEBUG:boto:query string: AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A39%3A00Z&Version=2011-12-15
DEBUG:boto:string_to_sign: POST
http://192.168.1.135:8773
/services/Cloud/
AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A39%3A00Z&Version=2011-12-15
DEBUG:boto:len(b64)=44
DEBUG:boto:base64 encoded digest: cjDP3et6wOWAWUKbq8oribS/t2X/1BwBXZgnefNTF0I=
DEBUG:boto:query_string: AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A39%3A00Z&Version=2011-12-15 Signature: cjDP3et6wOWAWUKbq8oribS/t2X/1BwBXZgnefNTF0I=
DEBUG:boto:encountered gaierror exception, reconnecting
DEBUG:boto:establishing HTTP connection: kwargs={}
DEBUG:boto:Token: None
DEBUG:boto:using _calc_signature_2
DEBUG:boto:query string: AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A39%3A06Z&Version=2011-12-15
DEBUG:boto:string_to_sign: POST
http://192.168.1.135:8773
/services/Cloud/
AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A39%3A06Z&Version=2011-12-15
DEBUG:boto:len(b64)=44
DEBUG:boto:base64 encoded digest: r4bW1ZRoARA+phNyqZVuCAxs/Kk3id7vefWuFJSj6PU=
DEBUG:boto:query_string: AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A39%3A06Z&Version=2011-12-15 Signature: r4bW1ZRoARA+phNyqZVuCAxs/Kk3id7vefWuFJSj6PU=
DEBUG:boto:encountered gaierror exception, reconnecting
DEBUG:boto:establishing HTTP connection: kwargs={}
DEBUG:boto:Token: None
DEBUG:boto:using _calc_signature_2
DEBUG:boto:query string: AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A39%3A09Z&Version=2011-12-15
DEBUG:boto:string_to_sign: POST
http://192.168.1.135:8773
/services/Cloud/
AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A39%3A09Z&Version=2011-12-15
DEBUG:boto:len(b64)=44
DEBUG:boto:base64 encoded digest: h+bfZn/bGLJEahdrjBFHhGqgK/xSu1c6KkBZ/kVSPMw=
DEBUG:boto:query_string: AWSAccessKeyId=ec612e67850449bea8117eefc1fbe449&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-11T01%3A39%3A09Z&Version=2011-12-15 Signature: h+bfZn/bGLJEahdrjBFHhGqgK/xSu1c6KkBZ/kVSPMw=
DEBUG:boto:encountered gaierror exception, reconnecting
DEBUG:boto:establishing HTTP connection: kwargs={}
import boto
import boto.regioninfo
import logging
logging.basicConfig(filename="boto.log", level=logging.DEBUG)
region = boto.regioninfo.RegionInfo(name="openstack", endpoint="http://192.168.1.135")
ec2 = boto.connect_ec2(aws_access_key_id="ec612e67850449bea8117eefc1fbe449",aws_secret_access_key="dbe69aae0f604b59836c17ad4d6f71ca", is_secure=False, region=region, port=8773, path="/services/Cloud")
print "About to call ec2.get_all_instances()"
ec2.get_all_instances()
@r0h4n
Copy link
Copy Markdown

r0h4n commented Aug 7, 2012

hey, did you get boto working with openstack nova? or any other openstack services?

@eren
Copy link
Copy Markdown

eren commented Apr 8, 2015

I have exactly the same problem with Swift S3 integration. s3curl works but I couldn't get it working with boto.

Wed, 08 Apr 2015 14:57:00 GMT
/boto_created/
Signature:
AWS 5678a86f0a734c14964d8f027ee44e94:xKm2VKghwimBRRYaDnEPEDjq07E=
encountered gaierror exception, reconnecting

EDIT: I just realized that boto was calling a subdomain while creating. I needed to add ordinary calling format to boto and it got fixed. The code snippet I use for S3 is below. Make sure you use calling_format=boto.s3.connection.OrdinaryCallingFormat())

from boto.s3.connection import S3Connection
import boto
import logging

logger = logging.getLogger("boto")
logger.setLevel(logging.DEBUG)

ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)

logger.addHandler(ch)

conn = S3Connection(
    aws_access_key_id='ID',
    aws_secret_access_key='SECRET',
    port=80,
    host='swift.yourdomain.tld',
    is_secure=False,
    calling_format=boto.s3.connection.OrdinaryCallingFormat())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment