aws-samples / aws-lambda-ddns-function

Dynamically create Route 53 resource records using CloudWatch Events and Lambda
Apache License 2.0
236 stars 115 forks source link

DynamoDB records are not removed #25

Closed sigurdknippenberg closed 5 years ago

sigurdknippenberg commented 7 years ago

I noticed that when an instance is shutdown or terminated that the script doesn't remove the record from DynamoDB after it has removed the records from route 53 and the table slowly keeps growing with instance ids that are no longer used.

Is there a particular reason that the records are not removed? Or is this an oversight?

philipakash commented 6 years ago

I have the same question . The table keeps on growing . Is there a reason to keep it like that ?

mustanggb commented 6 years ago

I stuck the following right at the end of the lambda_handler() function (line 267), looks to be doing the job for now:

    # Clean up DynamoDB after deleting records
    if state != 'running':
        table.delete_item(
            Key={
                'InstanceId': instance_id
            }
        )
jicowan commented 5 years ago

Fixed in #29