Boto3: Route 53 Alias record creation failing

Created on 28 Jun 2015  路  2Comments  路  Source: boto/boto3

Hi,

I'm not totally sure if I am missing something or if I hit a bug, I wrote a _Route 53_ helper function to easily create DNS records that works perfectly for a ResourceRecords-type record but fails at the AliasTarget method. Here's the generated ChangeBatch:

{
    'Comment': 'CREATE / test / mydomain.com',
    'Changes': [
        {
            'Action': 'CREATE',
            'ResourceRecordSet': {
                'Name': 'test.mydomain.com.',
                'Type': 'A',
                'Region': 'eu-west-1',
                'SetIdentifier': 'eu-west-1_test_mydomain.com',
                'TTL': 300,
                'AliasTarget': {
                    'HostedZoneId': 'Z3DZXE0Q79N41H',
                    'EvaluateTargetHealth': False,
                    'DNSName': 'rp-lb-809228403.us-east-1.elb.amazonaws.com'
                }
            }
        }
    ]
}

When calling client.change_resource_record_sets with that ChangeBatch, I get the following traceback:

/usr/home/imil/aws/awscli/lib/python2.7/site-packages/botocore/client.pyc in _api_call(self, *args, **kwargs)
    256             mapping[py_operation_name] = operation_name
    257         return mapping
--> 258 
    259     def _create_api_method(self, py_operation_name, operation_name,
    260                            service_model):

/usr/home/imil/aws/awscli/lib/python2.7/site-packages/botocore/client.pyc in _make_api_call(self, operation_name, api_params)
    313 
    314         self.meta.events.emit(
--> 315             'after-call.{endpoint_prefix}.{operation_name}'.format(
    316                 endpoint_prefix=self._service_model.endpoint_prefix,
    317                 operation_name=operation_name),

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

I tried both with and without the trailing dot, same result.

Most helpful comment

Ok, I figured it out from Amazon Route 53 API Reference, an AliasTarget record should not have a TTL entry.

All 2 comments

Ok, I figured it out from Amazon Route 53 API Reference, an AliasTarget record should not have a TTL entry.

@iMilnb thanks for posting the solution to your own problem, you just saved me a bunch of time. :)

Was this page helpful?
0 / 5 - 0 ratings