简体   繁体   中英

Proper version of boto for Eucalyptus cloud

I'm writing some code to interact with an HP Helion Eucalyptus 4.2 cloud server. At the moment I'm using boto 2.38.0, but I discovered that also exists the boto3 version. Which version should I use in order to keep the code up with the times? I mean, It seems that boto3's proposal is a ground-up rewrite more focused on the "official" Amazon Web Services (AWS).

You can easilly use boto3. Here is the article clearly explaining that. I tried it myself with Eucalyptus 4.2.1. So I defined the config and credentials file.

$ cat .aws/config 
[profile admin]
output = json
region = region1

$ cat .aws/credentials
[admin]
aws_access_key_id = XXXXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Then I used the interactive Ipython shell, so I listed my running instances.

In [1]: from boto3.session import Session

In [2]: session = Session(region_name='region1', profile_name="admin")

In [3]: client = session.client('ec2', endpoint_url='http://compute.region1.cloud.mydomain.net:8000/')

In [4]: for reservation in client.describe_instances()['Reservations']: 
   ...:       for instance in reservation['Instances']:
   ...:             print instance['InstanceId']
   ...:         
i-c706792f
i-af613099
i-fc0c55ee
i-4f493764
i-943d0ce3

I don't use verify argument in session.client() , because my testing EC2 endpoint doesn't use HTTPS but plain HTTP.

2.38 is the right version. boto3 is something totally different and I don't have experience with it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM