AWS Certified Solutions Architect - Associate (SAA-C02)

Sign Up Free or Log In to participate!

I am not able to execute lamda trigger as shown.

I did not have python 2.7 in option so tried with 3.7 but it didnot trigger when i remove the tag from ec2

Venki

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’] },

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")
Martin Gabriele

Was having the same problem .. making the changes AC suggested above I was able to see the EC2-Instance shutting down. Thank you

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?