-
Notifications
You must be signed in to change notification settings - Fork 0
/
domain.py
34 lines (31 loc) · 1.01 KB
/
domain.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import boto3
import logging
import os
def update_display_record(name, value):
try:
client = boto3.client(
"route53",
aws_access_key_id=os.environ['aws_access_key_id'],
aws_secret_access_key=os.environ['aws_secret_access_key']
)
response = client.change_resource_record_sets(
HostedZoneId="Z093312912USRZWYPJ91W",
ChangeBatch={
"Comment": "add %s -> %s" % (name, value),
"Changes": [
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": f'{name}.display.crablab.uk',
"Type": "A",
"TTL": 300,
"ResourceRecords": [{"Value": value}],
},
}
],
},
)
except Exception as e:
logging.error(e)
return False
return True