Kshitij Kohli
Kshitij Kohli

Reputation: 4393

How to change the name of a record set in Route 53 using python boto3?

I am able to perform actions such as updating the value of a record set in Route 53, but can't find an api to rename an existing record set using python boto3. The Name parameter in the documentation is the Name of the record set which we want to change. How do I specify the new name for the record set?

See: boto3: change_resource_record_sets()

Upvotes: 1

Views: 960

Answers (2)

John Rotenstein
John Rotenstein

Reputation: 270294

It would appear that the Name is the unique identifier of the Record Set.

Therefore, there is no capability to change the name.

You will need to create a new Record Set with the different name.

Upvotes: 3

Juned Ahsan
Juned Ahsan

Reputation: 68715

From one of my record files, which I used to update the route53 recordset. Hope it helps

try:
    route53 = boto3.client('route53')
    route53.change_resource_record_sets(
        HostedZoneId = hosted_zone_id,
        ChangeBatch={
            'Changes': [
                {
                    'Action': 'UPSERT',
                    'ResourceRecordSet': {
                        'Name': record_name,
                        'Type': 'A',
                        'ResourceRecords': [
                            {
                                'Value': ipForRecord
                            }
                        ],
                        'TTL': 300
                    }
                }
            ]
        } 
    )

except Exception as e:
    print 'Exception while updating cloud 53 record'
    print e

Upvotes: 2

Related Questions