So I just started learning AWS Lambda today and tried to create a simple Hello World function in Python. The sample code which AWS generates looks like this:
import json
def lambda_handler(event, context):
# TODO implement
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}
Running this code gives the following output:
Response
{
"statusCode": 200,
"body": "\"Hello from Lambda!\""
}
But now when I try to modify this code and run it I get the exact same output as the sample code. I modified it to this:
import json
def lambda_handler(event, context):
# TODO implement
return {
'statusCode': 200,
'body': json.dumps('Hello!')
}
But I still get this as output:
Response
{
"statusCode": 200,
"body": "\"Hello from Lambda!\""
}
Things I've tried:
- Deleting the function and creating a new one.
- Using a different test event.
Neither worked. I also watched videos on YouTube where people are doing exactly what I was and their code change seemed to work. Can someone please help me with what I am missing?
CTRLSin the consule, you also has aSavebox at the top of the editor which really deploys the Lambda.