Python boto3 route53 简单示例错误
Python boto3 route53 simple example errors
下面的脚本(简化的,虚构的zone/zoneid)在运行时给出了错误
botocore.errorfactory.InvalidInput: An error occurred (InvalidInput) when calling the ChangeResourceRecordSets operation: Invalid request
#!/usr/bin/python3.3
import boto3
ipaddress = '10.32.24.82'
zoneid = 'Z3GJIR73GHRHXX'
response = boto3.client('route53').change_resource_record_sets(
HostedZoneId=zoneid,
ChangeBatch={
'Comment': 'swarm manager',
'Changes': [
{
'Action': 'UPSERT',
'ResourceRecordSet':
{
'TTL': 600,
'Name': 'www.giganticwasteoftime.com.',
'SetIdentifier': 'abc1',
'Type': 'A'
'ResourceRecords':
[{'Value': ipaddress}, ],
}
}, ]
}
)
print(response)
我之前已经成功地 python 脚本来查询 route53 但我之前从未写过它
我在 boto3 上安装了 pip install --update,但这些版本的 python 模块出现了完全相同的错误:
boto3-1.4.4 botocore-1.5.56 docutils-0.13.1 jmespath-0.9.2 python-dateutil-2.6.0 s3transfer-0.1.10
这不是 python 库的问题,错误来自 AWS。从您的请求中省略 SetIdentifier,因为您正在创建 A 记录;如果域 www.giganticwasteoftime.com 存在,它应该可以工作。
来自boto3 docs:
SetIdentifier (string) --
Weighted, Latency, Geo, and Failover resource record sets only: An identifier that differentiates among multiple resource record sets that have the same combination of DNS name and type. The value of SetIdentifier must be unique for each resource record set that has the same combination of DNS name and type. Omit SetIdentifier for any other types of record sets.
下面的脚本(简化的,虚构的zone/zoneid)在运行时给出了错误
botocore.errorfactory.InvalidInput: An error occurred (InvalidInput) when calling the ChangeResourceRecordSets operation: Invalid request
#!/usr/bin/python3.3
import boto3
ipaddress = '10.32.24.82'
zoneid = 'Z3GJIR73GHRHXX'
response = boto3.client('route53').change_resource_record_sets(
HostedZoneId=zoneid,
ChangeBatch={
'Comment': 'swarm manager',
'Changes': [
{
'Action': 'UPSERT',
'ResourceRecordSet':
{
'TTL': 600,
'Name': 'www.giganticwasteoftime.com.',
'SetIdentifier': 'abc1',
'Type': 'A'
'ResourceRecords':
[{'Value': ipaddress}, ],
}
}, ]
}
)
print(response)
我之前已经成功地 python 脚本来查询 route53 但我之前从未写过它
我在 boto3 上安装了 pip install --update,但这些版本的 python 模块出现了完全相同的错误: boto3-1.4.4 botocore-1.5.56 docutils-0.13.1 jmespath-0.9.2 python-dateutil-2.6.0 s3transfer-0.1.10
这不是 python 库的问题,错误来自 AWS。从您的请求中省略 SetIdentifier,因为您正在创建 A 记录;如果域 www.giganticwasteoftime.com 存在,它应该可以工作。
来自boto3 docs:
SetIdentifier (string) --
Weighted, Latency, Geo, and Failover resource record sets only: An identifier that differentiates among multiple resource record sets that have the same combination of DNS name and type. The value of SetIdentifier must be unique for each resource record set that has the same combination of DNS name and type. Omit SetIdentifier for any other types of record sets.