适用于 Eucalyptus 云的 boto 的正确版本

Proper version of boto for Eucalyptus cloud

我正在编写一些代码来与 HP Helion Eucalyptus 4.2 云服务器进行交互。 目前我正在使用 boto 2.38.0,但我发现它也存在 boto3 版本。 我应该使用哪个版本以使代码与时俱进? 我的意思是,似乎 boto3 的提议是从头开始重写,更加集中 在 "official" 亚马逊网络服务 (AWS) 上。

2.38 是正确的版本。 boto3 是完全不同的东西,我没有使用它的经验。

您可以轻松使用boto3。 Here 是清楚解释这一点的文章。 我自己用 Eucalyptus 4.2.1 试过了。所以我定义了配置和凭证文件。

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

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

然后我使用了交互式 Ipython shell,所以我列出了我的 运行 个实例。

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

我没有在 session.client() 中使用 verify 参数,因为我的测试 EC2 端点没有使用HTTPS 但纯 HTTP。