Created
April 13, 2022 19:18
-
-
Save zaireali649/bf599dd416ce04b2c79d565261771665 to your computer and use it in GitHub Desktop.
Create a Sample Lambda Handler Python Zip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Create Hello Lambda .py ### | |
lambda_code = ''' | |
import json | |
def lambda_handler(event, context): | |
# TODO implement | |
return { | |
'statusCode': 200, | |
'body': json.dumps('Hello from Lambda!') | |
} | |
''' | |
f = open("lambda_function.py", "w") | |
f.write(lambda_code) | |
f.close() | |
### Create handler .zip ### | |
from zipfile import ZipFile | |
fZip = ZipFile('lambda-handler.zip', 'w') | |
fZip.write('lambda_function.py') | |
fZip.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment