Search code examples
amazon-web-servicesaws-lambdaaws-sam-cli

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?


Solution

  • 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.