help yourself
https://pipenv.pypa.io/en/latest/#install-pipenv-today
https://www.serverless.com/framework/docs/getting-started/
sls plugin install -n serverless-python-requirements
sls deploy
...however!
when deploying, first set up your credentials. for instance using env vars
AWS_ACCESS_KEY_ID=<your_acces_key_id> AWS_SECRET_ACCESS_KEY=<your_secret_access_key> sls deploy
or
export AWS_ACCESS_KEY_ID=<your_acces_key_id>
export AWS_SECRET_ACCESS_KEY=<your_secret_access_key>
sls deploy
you can create credentials in the aws console, if you haven't already
perform a deploy, familiarize yourself with the lambda in aws console. try calling the lambda using aws console (hint: create a test event) it should fail.
output to s3 by creating a bucket called workshop-aws-output
or something similar.
update handler.py#24 (_s3_upload(image_out, 'workshop-aws-output', key)
) so it matches the bucket name you chose.
deploy and verify that test calls produces objects in the bucket.
lambdas can be triggered by events in a bucket.
in serverless.yml
, uncomment the s3-config: functions.workshop-aws.events.s3
.
deploy and verify that serverless has created a bucket by name aws-workshop-input
.
since bucket names apparently must be unique :rolling_eyes:, rename it to whatever you like.
put a png-file into the input-bucket, verify that the result is written to output bucket.
lambdas can be triggered by http events.
in serverless.yml
, uncomment the s3-config: functions.workshop-aws.events.http
.
nb: this will expose a get-endpoint publicly.
figure out how you can adjust the lambda to support http events.
hint: you'll want to use url-encoding