Created
April 15, 2018 09:17
-
-
Save galbash/405903a077fc500268905f3a1117cacb to your computer and use it in GitHub Desktop.
Downloads the lambda runtime directory
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
import os | |
def download_code(event, context): | |
""" | |
Download the runtime environment of a lambda to a given s3 bucket. | |
""" | |
os.system("/bin/tar -zcvf /tmp/code.tar.gz /var/runtime/") | |
with open("/tmp/code.tar.gz", "rb") as code: | |
s3.upload_fileobj(code, event['bucket_name'], 'code.tar.gz') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Might want to add
import boto3
s3 = boto3.client('s3')