aws python sdk批量上传_AWS Python SDK |路线53 – 删除资源记录

本文介绍了一位用户尝试删除Amazon Route53中特定DNS记录的过程。用户使用Python的boto3库进行操作,但遇到了无效请求的错误。文中包含了用户使用的代码示例及其遇到的具体错误信息。

如何删除Route 53中的DNS记录?我跟着

documentation,但我仍然无法使它工作.我不知道我在这里遗失了什么.

根据文档:

DELETE : Deletes a existing resource record set that has the specified

values for Name , Type , SetIdentifier (for latency, weighted,

geolocation, and failover resource record sets), and TTL (except alias

resource record sets, for which the TTL is determined by the AWS

resource that you’re routing DNS queries to).

但我总是得到这个错误:

Traceback (most recent call last):

File "./test.py", line 37, in

main()

File "./test.py", line 34, in main

print(del_record())

File "./test.py", line 23, in del_record

'TTL': 300

File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/botocore/client.py", line 251, in _api_call

return self._make_api_call(operation_name, kwargs)

File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/botocore/client.py", line 537, in _make_api_call

raise ClientError(parsed_response, operation_name)

botocore.exceptions.ClientError: An error occurred (InvalidInput) when calling the ChangeResourceRecordSets operation: Invalid request

这是我的代码:

#!/usr/bin/env python3

import boto3

r53 = boto3.client('route53')

zone_id = 'ABCDEFGHIJKLMNO'

record = 'me.domain.com'

r_type = 'CNAME'

r_val = 'google.com'

def del_record():

response = r53.change_resource_record_sets(

HostedZoneId=zone_id,

ChangeBatch={

'Changes': [

{

'Action': 'DELETE',

'ResourceRecordSet': {

'Name': record,

'Type': r_type,

'TTL': 300

}

}

]

}

)

return response

def main():

print(del_record())

if __name__ == '__main__':

main()

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值