Last active
August 23, 2021 20:55
-
-
Save kireal/90b04d362449564ec9e000bf9d43cfcb to your computer and use it in GitHub Desktop.
Lambda import in ecs container
This file contains hidden or 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
# import goes here | |
def lambda_handler(event, context): | |
# lambda code goes here | |
pass | |
if __name__ == '__main__': # in case if we run it in a container | |
if 'EVENT' not in os.environ: | |
raise Exception('No event provided in os.environ.') | |
else: | |
eventstr = os.environ['EVENT'] # we always expect EVENT to be encoded as base64 | |
event = base64.b64decode(eventstr.encode('utf-8')) | |
event = json.loads(event) | |
results = lambda_handler(event, []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment