Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

For instance:

count = 0

        while True:

            try:

                if count == 5:

                    break

                snap = ec.create_snapshot(

                    VolumeId=vol_id,

                    Description=instance['InstanceId']

                )

                break

            except Exception as e:

                print(e)

                sleep(180)

                count = count + 1

So If I have a lot of instances and errors then it could be a long time of running lambda. What could be alternative to put Lambda to sleep?

1 Answer

0 votes
by (44.4k points)

You will still be charged. So you will pay them for the time a function takes to complete its execution or when you have the set the timeout. Calling sleep() won’t stop the execution of the function, so you will still be charged for that time too. Make sure, you stop your function after your functions task completes and set the function timeout accordingly.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
2 answers
asked Jul 26, 2019 in AWS by yuvraj (19.1k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...