Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

deploy lambda to s3 bucket folder?

Here is the command to deploy the lambda:

$ sam package --template-file sam.yaml --s3-bucket mybucket --output-template-file packaged.yaml

But can I specify a bucket prefix? so it gets deployed to subfolder instead of root of bucket?

like image 510
red888 Avatar asked Jan 19 '18 22:01

red888


People also ask

Can Lambda upload file to S3?

In this short post, I will show you how to upload file to AWS S3 using AWS Lambda. We will use Python's boto3 library to upload the file to the bucket. Once the file is uploaded to S3, we will generate a pre-signed GET URL and return it to the client.

How do I upload a folder to AWS S3?

To upload folders and files to an S3 bucketSign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that you want to upload your folders or files to. Choose Upload.


1 Answers

You can provide the bucket prefix using --s3-prefix parameter

$ sam package --template-file sam.yaml --s3-bucket mybucket --s3-prefix path/to/file --output-template-file packaged.yaml

Under the hood sam is calling aws command and all the options listed here are valid.

like image 102
Anuruddha Avatar answered Sep 19 '22 12:09

Anuruddha