【发布时间】:2021-06-01 05:16:40
【问题描述】:
我正在使用 python3 运行 boto,并且正在运行 ansible playbook 来设置一些 ec2 实例。
一切都很好,创建实例、安全组、密钥对,eu-west-2 中的所有内容。
当弹性 IP 的任务运行时,它会失败并显示以下消息:
Region eu-west-2 does not seem to be available for aws module boto.ec2. If the region definitely exists, you may need to upgrade boto or extend with endpoints_path
我正在使用 -e ansible_python_interpreter="/usr/bin/python3" 运行 ansible。
我安装了最新的 boto。
> python3 -m pip freeze | grep boto
boto==2.44.0
boto3==1.4.2
botocore==1.16.19
> python3
>>> import boto.ec2
>>> for i in boto.ec2.regions():
... print(i)
...
RegionInfo:ap-northeast-1
RegionInfo:ap-northeast-2
RegionInfo:ap-south-1
RegionInfo:ap-southeast-1
RegionInfo:ap-southeast-2
RegionInfo:ca-central-1
RegionInfo:cn-north-1
RegionInfo:eu-central-1
RegionInfo:eu-west-1
RegionInfo:sa-east-1
RegionInfo:us-east-1
RegionInfo:us-east-2
RegionInfo:us-gov-west-1
RegionInfo:us-west-1
RegionInfo:us-west-2
您看到它缺少eu-west-2 区域吗?它应该在那里。有什么想法吗?
我使用的 ansible 模块是ec2_eip。如果这是 boto 的限制,我该如何为该模块强制 boto3?
【问题讨论】:
-
boto 是旧的 AWS 开发工具包,您应该导入 boto3 - 最后一个 boto 版本是在 2018 年 7 月 - 当时该区域不存在。 pypi.org/project/boto/#history
-
感谢您的信息。我更新了我的问题。
标签: amazon-ec2 ansible boto elastic-ip