2 Answers
did not work for me either
The print statements are in python 2 format and are causing a syntax error.
The cloudwatch logs show:
[ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'lambda_function': Missing parentheses in call to 'print'. Did you mean print(shuttingDown)? (lambda_function.py....
To fix add parenthesis to the print statement
print("shuttingDown") else: print("Nothing to see here")
Was having the same problem .. making the changes AC suggested above I was able to see the EC2-Instance shutting down. Thank you
did you see any error in cloudwatch log. I used Python 3.9 and also instead of empty tag.name tested with a name and lambda got triggered and stopped the instance filters = [{ ‘Name’: ‘tag:Name’, ‘Values’: [‘test’] },