Skip to content

Instantly share code, notes, and snippets.

@kireal
Last active August 23, 2021 20:55
Show Gist options
  • Save kireal/90b04d362449564ec9e000bf9d43cfcb to your computer and use it in GitHub Desktop.
Save kireal/90b04d362449564ec9e000bf9d43cfcb to your computer and use it in GitHub Desktop.
Lambda import in ecs container
# 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