【问题标题】:How to deploy to a specific object key inside an S3 Bucket with the Serverless framework?如何使用无服务器框架部署到 S3 存储桶内的特定对象键?
【发布时间】:2018-03-16 16:57:35
【问题描述】:
无服务器框架配置允许:
deploymentBucket:
name: foo
但是,它总是在 foo 存储桶内创建一个 serverless 对象键。我希望能够部署到不同的密钥,例如 BAR。
deploymentBucket:
name: foo/BAR # illustration only, doesn't work
我有什么选择?
【问题讨论】:
标签:
amazon-web-services
amazon-s3
aws-lambda
serverless-framework
【解决方案1】:
我不相信 Serverless 有这个功能。
你的选择是
- 提出 GitHub 问题并希望有人为您添加功能,或者
- 编写一个无服务器插件,让您可以为部署桶内的对象添加前缀
【解决方案2】:
我找到了这个sample config file,它包含一个以无服务器模块路径为前缀的存储桶名称。
deploymentBucket:
name: com.serverless.${self:provider.region}.deploys # Deployment bucket name. Default is generated by the framework
serverSideEncryption: AES256 # when using server-side encryption
这是一个完整的黑暗镜头,但如果你想写信给foo/BAR,也许这个设置对你有用:
name: com.serverless.${self:provider.region}.foo.BAR
编辑:
更改 package name 会影响部署写入哪个键吗?
【解决方案3】:
Here is 示例与放置index.html。
我对无服务器框架不太熟悉,希望对您有所帮助。