如何访问一个文件从s3桶复制到弹性豆茎内.net代码?



我在Elastic Beanstalk上托管一个。net后端应用程序。我做了一个配置文件:

Resources:
AWSEBAutoScalingGroup:
Metadata:
AWS::CloudFormation::Authentication:
S3Auth:
type: "s3"
buckets: ["my-bucket"]
roleName:
"Fn::GetOptionSetting":
Namespace: "aws:autoscaling:launchconfiguration"
OptionName: "IamInstanceProfile"
DefaultValue: "aws-elasticbeanstalk-ec2-role"
files:
# Private key
"/var/app/current/file":
mode: "000400"
owner: root
group: root
authentication: "S3Auth"
source: https://my-url/file

这似乎有效,然而,当我试图通过使用file(我也尝试过./file)作为路径名来访问. net中的文件时,我得到File not found错误。显示当前目录为var/app/current

我最终不确定如何查看EB实例的ec2中的文件,甚至查看它是否复制了,或者在没有抛出异常的情况下失败。如果它真的复制过来了,它被放在哪里…还是我访问文件的方式不对?

EB将覆盖您的/var/app/current在您的部署结束时。所以无论你在files里写什么,都会被删除。你可以试试/var/app/staging。如果这也不起作用,您可以考虑将文件保存在/var/app之外。

最新更新