awless icon indicating copy to clipboard operation
awless copied to clipboard

Backing up route 53 records and restoration ?

Open rgarrigue opened this issue 6 years ago • 1 comments

Hi

Just wanted to know if anyone tried to backup & restore route 53 zones and records using awless ? I know I can awless list records --output=json, but not sure if I can re-create from this json. Anyone got any experience on this ?

Best regards,

rgarrigue avatar Mar 28 '19 11:03 rgarrigue

import json
import subprocess

with open('route53_backup.json', 'r') as file:
    data = json.load(file)

for zone in data['Zones']:
    zone_id = zone['Id']
    records = zone['Records']

    for record in records:
        record_type = record['Type']
        name = record['Name']
        value = record['Value']

        cmd = f"awless create record -z {zone_id} -t {record_type} -n {name} -v {value}"
        subprocess.call(cmd, shell=True)

ljluestc avatar Aug 06 '23 17:08 ljluestc