diff --git a/union.py b/union.py index 7a4622f..24861da 100644 --- a/union.py +++ b/union.py @@ -264,7 +264,15 @@ def lambda_handler(event, context): print e else: print 'No matching zone for %s' % configuration[0] - + + # Clean up DynamoDB after deleting records + if state != 'running': + table.delete_item( + Key={ + 'InstanceId': instance_id + } + ) + def create_table(table_name): dynamodb_client.create_table( TableName=table_name, @@ -457,4 +465,4 @@ def is_dns_support_enabled(vpc): def get_hosted_zone_properties(zone_id): hosted_zone_properties = route53.get_hosted_zone(Id=zone_id) hosted_zone_properties.pop('ResponseMetadata') - return hosted_zone_properties \ No newline at end of file + return hosted_zone_properties