工具脚本-导入route53记录-2023-03-24
2023-03-23 本文已影响0人
貓叔
工作的时候需要做一次route53记录的迁移,根据文档 ,写了一个脚本去处理 step4 的json
import json
import copy
import os
import sys
input_path = os.path.abspath(sys.argv[1])
# read input from file
with open(input_path, 'r') as f:
data = json.load(f)
# convert data
changes = []
for record in data['ResourceRecordSets']:
print(record)
change = {
'Action': 'CREATE',
}
change['ResourceRecordSet'] = copy.deepcopy(record)
changes.append(change)
# write output to file
with open('output.json', 'w') as f:
json.dump({'Changes': changes}, f)