10000 Merge pull request #1 from alxsey/feature-db-cleanup · alxsey/aws-lambda-ddns-function@cc9a702 · GitHub
[go: up one dir, main page]

Skip to content

Commit cc9a702

Browse files
authored
Merge pull request #1 from alxsey/feature-db-cleanup
DB cleanup after record removal
2 parents 72181ee + 8bea129 commit cc9a702

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

union.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,15 @@ def lambda_handler(event, context):
264264
print e
265265
else:
266266
print 'No matching zone for %s' % configuration[0]
267-
267+
268+
# Clean up DynamoDB after deleting records
269+
if state != 'running':
270+
table.delete_item(
271+
Key={
272+
'InstanceId': instance_id
273+
}
274+
)
275+
268276
def create_table(table_name):
269277
dynamodb_client.create_table(
270278
TableName=table_name,
@@ -457,4 +465,4 @@ def is_dns_support_enabled(vpc):
457465
def get_hosted_zone_properties(zone_id):
458466
hosted_zone_properties = route53.get_hosted_zone(Id=zone_id)
459467
hosted_zone_properties.pop('ResponseMetadata')
460-
return hosted_zone_properties
468+
return hosted_zone_properties

0 commit comments

Comments
 (0)
0