2014-12-11 23 views
2

我向下面的代码片段添加了一个值,以便稍后提交。如何使用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”参数来为基于延迟的路由添加区域。但是,我没有看到任何关于地理位置的提及。图书馆能够处理地理位置路由政策吗?或者我只需要坚持延迟路由策略。

回答

2

请尝试下面的代码段。尝试通过“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' 
         }, 
         ], 
       } 
      }, 
      ] 
    } 
) 
相关问题