簡體   English   中英

在彈性 beantalk 上構建 war 文件時從 AWS S3 復制文件

[英]Copy files from AWS S3 when building war file on elastic beanstalk

我希望將文件從 s3 存儲桶ls-Bucket復制到/tmp/文件夾中的 EC2。 當我將戰爭文件上傳到彈性 beantalk 並點擊部署時,我想這樣做。

這里是我的配置文件.ebextentions文件夾setup.conf

container_commands:
# Copy script from s3-bucket to PATH: /tmp/myFile.txt
01-copyFromS3ToTmp:
 files:
 "/tmp/myFile.txt":
 source: https://ls-Busket.s3-eu-west-1.amazonaws.com/myFile.txt
 authentication: S3Access

Resources:
 AWSEBAutoScalingGroup:
  Metadata:
   AWS::CloudFormation::Authentication:
    S3Access:
     type: S3
     roleName: aws-elasticbeanstalk-ec2-role
     buckets: ls-Busket

我使用 Elastic Beanstalk 上傳和部署,一切正常(健康)但是當我通過 SSH 進入我的實例並檢查 tmp 文件夾時,我看不到我的文件,也看不到任何錯誤 誰能告訴我我在做什么錯誤的。

感謝任何幫助,AWS 新手。

提前致謝

G

您創建文件的方法不太正確。

嘗試這個:

Resources:
  AWSEBAutoScalingGroup:
    Metadata:
       AWS::CloudFormation::Authentication:
        S3Access:
         type: S3
         roleName: aws-elasticbeanstalk-ec2-role
         buckets: ["ls-Busket"]
  files:
    "/tmp/myFile.txt":
      source: https://ls-Busket.s3-eu-west-1.amazonaws.com/myFile.txt
      authentication: S3Access

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM