AWS lambda question

Soldato
Joined
18 May 2010
Posts
22,784
Location
London
Daily we shut down our environments using lambda.

Is it possible to send an email prior with a clickable link that when clicked would cancel the execution of this shutdown event?

I'm thinking API gateway might have a role to play but I doubt it's possible to cancel a scheduled lambda.

What about if it polls an sqs queue or something which if it contains a certain message it will not run the lambda.

The message in the sqs would obviously be there by virtue of the clickable link in the email.
 
I would think something like having 3 lambdas
One which sends the warning email with a link and when the link it clicked it would just hit api gateway -> lambda which would write a s3://shouldIshutdown.txt file with todays date in.

Then a shutdown lambda which runs x minutes later and checks the file for todays date.

Could obviously use anything to hold state, redis/dynamo etc,
 
depending on the environment setup, you could automate it a bit more as well.

If it looks something like
API Gateway > EC2

Then you can inspect Cloudwatch logs for recent traffic, if there's none and it's passed 6pm then shutdown environment. If people are still hitting the servers then make Lambda fire in another 30 minutes
 
depending on the environment setup, you could automate it a bit more as well.

If it looks something like
API Gateway > EC2

Then you can inspect Cloudwatch logs for recent traffic, if there's none and it's passed 6pm then shutdown environment. If people are still hitting the servers then make Lambda fire in another 30 minutes

Yea that's not a bad idea.

The initial idea was for an email to go out to people telling them that the servers will be shut down at 7pm. And if they want to postpone this click the link in the email.

But I couldn't see how a link in an email would cancel a scheduled lambda.

I suppose monitoring for activity isn't a bad idea.

I need to think.

Thanks
 
Back
Top Bottom