boto3 - Python boto3 route53
问题描述
我正在尝试定义一个包含 3 个条目的 NS 记录,但我找不到正确的方法。无法分配正确的有效值类型。
client = boto3.client('route53')
cluster_name="myserver.com"
for x in range(1, 4):
node = "node" + str(x) + "." + cluster_name
print(node)
response = client.change_resource_record_sets(
HostedZoneId='Z3Q8SD6RN2TO8XY1XXX',
ChangeBatch={
'Comment': '',
'Changes': [
{
'Action': 'UPSERT',
'ResourceRecordSet': {
'Name': node,
'Type': 'NS',
'TTL': 300,
'ResourceRecords': [
{
'Value': first node,
'Value': second_node,
'Value': third_node,
},
],
}
},
]
}
)
解决方案
ResourceRecord
需要是具有语法的对象列表{"Value": "entry"}
。
总而言之,它应该是这样的:
response = client.change_resource_record_sets(
HostedZoneId='Z3Q8SD6RN2TO8XY1XXX',
ChangeBatch={
'Comment': '',
'Changes': [
{
'Action': 'UPSERT',
'ResourceRecordSet': {
'Name': node,
'Type': 'NS',
'TTL': 300,
'ResourceRecords': [
{
'Value': first node
},{
'Value': second_node
},{
'Value': third_node,
}
],
}
},
]
}
)
推荐阅读
- css - 如何在没有动画里程表的情况下“重置”css位置?
- typescript - Typescript 中类型的引用透明性
- r - R中的三项式回归问题
- reactjs - 如何使用 Nextjs 将 useRouter 推送到新的 url?
- python - 如何使用 webdriver selenium 从标签中单击按钮
- android - Cordova android:关闭inappbrowser时退出应用程序
- python - Python Dataframe 使用 Numpy 逻辑操作丢弃坏列表
- javascript - parseFloat 忽略小数点后的字符
- python - 代码不会将嵌入发送到不和谐的 webhook
- javascript - 如何在javascript中对日期数组进行排序?格式“DD/MM/YYYY HH:mm”