如何使用 boto 在 route53 中的 DNS 记录上设置地理位置



我下面的代码片段我正在向稍后提交的更改集添加一个值。

add = changes.add_change('CREATE', url, record_type, ttl=DEFAULT_TTL)
add.add_value(new_val)

如何将地理位置添加到创建的记录?我可以在 [http://boto.readthedocs.org/en/latest/ref/route53.html#module-boto.route53.record] 的文档中看到,我应该能够通过添加 region="blah" 参数为基于延迟的路由添加一个区域。但是,我没有看到任何提及地理位置的内容。库是否能够处理地理位置路由策略?还是我只需要坚持延迟路由策略。

请尝试以下代码片段。尝试通过"pip install boto3"安装 boto3

import boto3
client = boto3.client('route53')
response = client.change_resource_record_sets(
    HostedZoneId='ZYMJVBD6FUN6S',
    ChangeBatch={
        'Comment': 'comment',
        'Changes': [
            {
                'Action': 'CREATE',
                'ResourceRecordSet': {
                    'Name': 'udara.com',
                    'Type': 'A',
                    'SetIdentifier': 'Africa record',
                    'GeoLocation': {
                        'ContinentCode': 'AF'
                    },
                    'TTL': 123,
                    'ResourceRecords': [
                        {
                            'Value': '127.0.0.1'
                        },
                        ],
                }
            },
            ]
    }
)

最新更新