[英]Can't transfer file from S3 to ElasticBeanstalk on Deploy
出于某种原因,我无法在 CodePipeline 运行期间将我的 Firebase 配置 JSON 传输到我的 EB 环境。
这是在 my.ebextensions/firebase.conf 文件中
Resources:
AWSEBAutoScalingGroup:
Metadata:
AWS::CloudFormation::Authentication:
S3Auth:
type: "s3"
buckets: ["*bucket-name*"]
roleName:
"Fn::GetOptionSetting":
Namespace: "aws:autoscaling:launchconfiguration"
OptionName: "IamInstanceProfile"
DefaultValue: "aws-elasticbeanstalk-ec2-role"
files:
"/tmp/fbsecuritykey.js":
mode: "000400"
owner: root
group: root
authentication: "S3Auth"
source: https://*bucket-name*.s3.us-west-1.amazonaws.com/fbsecuritykey.js
container_commands:
file_transfer_1:
command: "mv /tmp/fbsecuritykey.js /var/app/current"
我试过很多东西。 使用 container_commands 和不使用 container_commands 似乎都不起作用。
顺便说一句,我故意将存储桶名称用斜体表示:) 它在我的配置中是正确的。
管道在运行期间未显示任何错误。
任何帮助表示赞赏。谢谢。
您的 S3 存储桶需要允许 aws-elasticbeanstalk-ec2-role 访问。 您可以使用为您的区域生成的默认 Elastic Beanstalk 存储桶,因为该存储桶上已经存在这些权限,或者您可以使用自定义存储桶,但您必须为 Elastic Beanstalk ec2 角色添加权限才能访问您的自定义存储桶桶。
如果您想使用自定义存储桶,请在 Bucket Permissions 下添加类似于以下内容的 Bucket Policy:
{
"Version": "2012-10-17",
"Id": "Policy12345",
"Statement": [
{
"Sid": "Stmt12345",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::YOUR_ACCOUNT_NUMBER:role/aws-elasticbeanstalk-ec2-role"
},
"Action": "s3:*",
"Resource": "arn:aws:s3:::YOUR_BUCKET_NAME/*"
}
]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.