2014-12-11 21 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' 
         }, 
         ], 
       } 
      }, 
      ] 
    } 
) 
相關問題