Hello sekitaka.
If AWS also works on the developer console, it will not leave a history, so it would be nice to be able to code and manage the source.
DNS settings for CloudFront can be set by executing the API as follows.
# coding:utf-8
#!/usr/bin/python
import boto3
client = boto3.client('route53')
response = client.change_resource_record_sets(
HostedZoneId='XXXXXXXXXXXX', #Route53 record Domain you want to set(example.com)Zone ID
ChangeBatch={
'Comment': u'Any comment',
'Changes': [
{
'Action': 'UPSERT',
'ResourceRecordSet': {
'Name': "xxxxxx.example.com" + ".", #Domain you want to publish
'Type': 'A', #When directing to CloudFront, it was written in the document that it should be an A record
'AliasTarget': {
'HostedZoneId': 'Z2FDTNDATAQYW2', #When pointing to CloudFront, the document said that you should specify this value
'DNSName': "xxxxxxxx..cloudfront.net" + ".", #CloudFront distribution domain
'EvaluateTargetHealth': False
}
}
},
]
}
)
print response
The point is that the various settings of ResourceRecordSet have some values that can be used and some that cannot be used, depending on which record type is used and the type of alias.
When I set TTL
this time, I got addicted to the output of an incomprehensible error.
Fortunately, the boto3 documentation was pretty polite, so I read it carefully and noticed the mistake. ..
Recommended Posts