Skip to content

Commit 9ebf9e7

Browse files
committed
updating README and changing md5 to hashlib
1 parent 8f25f5e commit 9ebf9e7

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

README.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,16 @@ value for the environment variable at the time of deployment (instead of hard co
165165
166166
This would create environment variables in the lambda instance upon deploy. If your functions don't need environment variables, simply leave this section out of your config.
167167

168+
Uploading to S3
169+
===============
170+
You may find that you do not need the toolkit to fully deploy your Lambda or that your code bundle is too large to upload via the API. You can use the `upload` command to send the bundle to an S3 bucket of your choosing.
171+
Before doing this, you will need to set the following variables in `config.yaml`:
172+
```
173+
role: basic_s3_upload
174+
bucket_name: 'example-bucket'
175+
s3_key_prefix: 'path/to/file/'
176+
```
177+
Your role must have `s3:PutObject` permission on the bucket/key that you specify for the upload to work properly. Once you have that set, you can execute `lambda upload` to initiate the transfer.
168178

169179
Development
170180
===========

aws_lambda/aws_lambda.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import botocore
1616
import pip
1717
import yaml
18-
import md5
18+
import hashlib
1919

2020
from .helpers import archive
2121
from .helpers import mkdir
@@ -468,7 +468,7 @@ def upload_s3(cfg, path_to_zip_file):
468468
with open(path_to_zip_file, mode='rb') as fh:
469469
byte_stream = fh.read()
470470
s3_key_prefix = cfg.get('s3_key_prefix', '/dist')
471-
checksum = md5.new(byte_stream).hexdigest()
471+
checksum = hashlib.new('md5', byte_stream).hexdigest()
472472
timestamp = str(time.time())
473473
filename = '{prefix}{checksum}-{ts}.zip'.format(prefix=s3_key_prefix, checksum=checksum, ts=timestamp)
474474

0 commit comments

Comments
 (0)