AWS-AMI-Automated-Creation-Deletion
AWS-AMI-Automated-Creation-Deletion copied to clipboard
Error
Hi, iam very new to the Lambda, but when i execute your scripts in lambda, here iam getting the Error , please find below 2017-05-07T23:00:14.702Z e6ba23fe-3378-11e7-b141-6384f3daab93 TypeError: Cannot read property 'SnapshotId' of undefined at null._onTimeout (/var/task/index.js:76:73) at Timer.listOnTimeout (timers.js:92:15)
@raakey - did you setup the permissions
did you follow steps here https://www.webdigi.co.uk/blog/2017/aws-instance-automated-ami-creation-deletion-system/ to create this permissions https://github.com/webdigi/AWS-AMI-Automated-Creation-Deletion/blob/master/roles/roles.json and then add that permission to Lambda?
It just looks like a permission issue.
Yes i followed the same. AMI got deleted but Snapshots are still exist.
how many EBS volumes were attached to the instances?
Only One.
can you please try another AMI. Looks like https://github.com/webdigi/AWS-AMI-Automated-Creation-Deletion/blob/master/lambda/deleteAMI.js line 79 is not set.
Please paste the log lines above and below the ones you sent earlier also. We have multiple instances and they all work well as expected.
Ok i will let u know that, thanks
Logs FYI,
Logs FYI,
Time (UTC +00:00) Message 2017-05-07 23:00:02 START RequestId: e6ba23fe-3378-11e7-b141-6384f3daab93 Version: $LATEST 23:00:04 2017-05-07T23:00:04.182Z e6ba23fe-3378-11e7-b141-6384f3daab93 Time to delete ELK_204_70 23:00:04 2017-05-07T23:00:04.182Z e6ba23fe-3378-11e7-b141-6384f3daab93 image that is going to be deregistered: ELK_204_70 23:00:04 2017-05-07T23:00:04.182Z e6ba23fe-3378-11e7-b141-6384f3daab93 image id: ami-23f89035 23:00:04 2017-05-07T23:00:04.182Z e6ba23fe-3378-11e7-b141-6384f3daab93 { ImageId: 'ami-23f89035' } 23:00:04 2017-05-07T23:00:04.502Z e6ba23fe-3378-11e7-b141-6384f3daab93 Not yet time to delete ELK_204_70 23:00:04 2017-05-07T23:00:04.823Z e6ba23fe-3378-11e7-b141-6384f3daab93 Image Deregistered 23:00:14 2017-05-07T23:00:14.510Z e6ba23fe-3378-11e7-b141-6384f3daab93 Time to delete ELK_204_70 23:00:14 2017-05-07T23:00:14.510Z e6ba23fe-3378-11e7-b141-6384f3daab93 snap-0bb0a59e5a537b13c 23:00:14 2017-05-07T23:00:14.642Z e6ba23fe-3378-11e7-b141-6384f3daab93 snap-0fd68eb48398e2386 23:00:14 2017-05-07T23:00:14.702Z e6ba23fe-3378-11e7-b141-6384f3daab93 TypeError: Cannot read property 'SnapshotId' of undefined at null._onTimeout (/var/task/index.js:76:73) at Timer.listOnTimeout (timers.js:92:15) 23:00:14 END RequestId: e6ba23fe-3378-11e7-b141-6384f3daab93 23:00:14 REPORT RequestId: e6ba23fe-3378-11e7-b141-6384f3daab93 Duration: 12409.69 ms Billed Duration: 12500 ms Memory Size: 128 MB Max Memory Used: 38 MB 23:00:14 RequestId: e6ba23fe-3378-11e7-b141-6384f3daab93 Process exited before completing request 23:01:07 START RequestId: e6ba23fe-3378-11e7-b141-6384f3daab93 Version: $LATEST 23:01:13 2017-05-07T23:01:13.302Z e6ba23fe-3378-11e7-b141-6384f3daab93 Not yet time to delete ELK_204_70 23:01:23 2017-05-07T23:01:23.606Z e6ba23fe-3378-11e7-b141-6384f3daab93 Not yet time to delete ELK_204_70 23:01:23 END RequestId: e6ba23fe-3378-11e7-b141-6384f3daab93 23:01:23 REPORT RequestId: e6ba23fe-3378-11e7-b141-6384f3daab93 Duration: 15655.76 ms Billed Duration: 15700 ms Memory Size: 128
ok, did you try the create and delete again?
Have you made any changes to the code?
except region, haven't changed any thing, i just copy and pasted
thanks, we could not replicate this issue at all. Very odd.
- Can you please send me a screenshot of the tags that are added to the instance. I just want to make sure none are missed.
- it will be helpful if you can please try a new instance.
- Do you have any permission restriction on this account or do you have root access?
Ok, im going to try on another instance. i will send the logs again. Thanks for the reply
TypeError: Cannot read property 'SnapshotId' of undefined at null._onTimeout (/var/task/index.js:76:73) at Timer.listOnTimeout (timers.js:92:15) 2017-05-18T23:00:54.054Z cf73cb83-3c1d-11e7-9030-e39ef6280ae5 TypeError: Cannot read property 'SnapshotId' of undefined at null._onTimeout (/var/task/index.js:76:73) at Timer.listOnTimeout (timers.js:92:15)
I tried on another Instances, Getting same problem,
Sorry, we could not replicate the issue.
If possible can you please send us a screenshot
-
The tags used in the instance
-
AMI name after the instance is created.
It might be best to run just the create script first and then send us the screenshot and run the delete script later.
I have tried on another instance just now, with adding same tags to that, that was working fine and clearing all AMI's with snapshots, and which i created earlier (above screen shot). that was not working properly. it showing timeout error (earlier error code.).
so did you fix it with a change? I assume you mentioned it worked?
Nope, i have tried on some other instance with same Tags, but how its possible that, it is working fine on one machine and not working on other machine ????
changes i did.
instead of DATETODEL- i used "BackupAMIUid-". thats it,
With this minimal changes one instance working perfectly, and other one not working.
instead of DATETODEL- i used "BackupAMIUid-". thats it,
was that applied to both the create and delete lambda function?
Yes
Thanks for that. It looks like a timeout. In the lambda script can you please check configuration and the timeout is set to 5 minutes? Related to issue #4.
Yes 5 minutes, still getting problem.
On Wed, Jun 14, 2017 at 10:31 AM, Webdigi - Web Development < [email protected]> wrote:
Thanks for that. It looks like a timeout. In the lambda script can you please check configuration and the timeout is set to 5 minutes? Related to issue #4 https://github.com/webdigi/AWS-AMI-Automated-Creation-Deletion/issues/4.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/webdigi/AWS-AMI-Automated-Creation-Deletion/issues/3#issuecomment-308320226, or mute the thread https://github.com/notifications/unsubscribe-auth/AXkVnKvT1VPNJu-AQjCWu5P8lPxjIOU2ks5sD2lCgaJpZM4NTiXx .
--
S Rakesh +91-8105209463
I set timeout to 5 minutes. And again i getting that problem.snapshots deletion problem. TypeError: Cannot read property 'SnapshotId' of undefined at null._onTimeout (/var/task/index.js:76:73) at Timer.listOnTimeout (timers.js:92:15) I didn't change anything in code also.still i am getting that problem.Any suggestions plz....
I am also facing same issue. Any solutions to fix this issue.
found another solution here "https://github.com/webdigi/AWS-AMI-Automated-Creation-Deletion/issues/4". I have updated my code and lets see how my job will go on sunday.
@Joshuapaul There's been new commits from Dec 2018, and it addressed this issue for me.