如何解决如何使用boto3的export_image?
似乎 EC2 客户端缺少 export_image
函数,即使它的 listed in the EC2 docs 也是如此。
import boto3
session = boto3.Session(profile_name=my_aws_profile)
client = session.client('ec2')
client.export_image() # MISSING!
AttributeError: 'EC2' object has no attribute 'export_image'
我错过了什么吗? (除了函数的参数?)
解决方法
它对我有用:
>>> import boto3
>>> ec2 = boto3.client('ec2')
>>> ec2.export_image()
Traceback (most recent call last):
File "<stdin>",line 1,in <module>
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/botocore/client.py",line 386,in _api_call
return self._make_api_call(operation_name,kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/botocore/client.py",line 677,in _make_api_call
request_dict = self._convert_to_request_dict(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/botocore/client.py",line 725,in _convert_to_request_dict
request_dict = self._serializer.serialize_to_request(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/botocore/validate.py",line 293,in serialize_to_request
raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Missing required parameter in input: "DiskImageFormat"
Missing required parameter in input: "ImageId"
Missing required parameter in input: "S3ExportLocation"
>>> boto3.__version__
'1.17.76'
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。