【问题标题】:AWS Elastic beanstalk hook failed :- unable to copy file to c:/windows/fontsAWS Elastic beanstalk 挂钩失败:- 无法将文件复制到 c:/windows/fonts
【发布时间】:2019-12-15 06:24:01
【问题描述】:

我已配置 elasticbeanstalk 挂钩以将文件从 s3 存储桶下载到 windows elasticbeanstalk 实例。

文件在 elasticbeanstalk 管理员用户的桌面上成功下载,但我无法将该文件复制到 c:/Windows/fonts 目录。

下面是 .config 文件。

sources:  
  "C:/Users/Administrator/Desktop": https://test.s3-ap-southeast-1.amazonaws.com/font/ARIALUNI.zip
commands:
  copyfile: 
    command: copy C:/Users/Administrator/Desktop/ARIALUNI.TTF C:/Windows/Fonts

在 elasticbeanstalk 中出现以下错误。

构建期间发生错误:命令复制文件失败 nfra-WriteRuntimeConfig、Infra-EmbeddedPreBuild、Hook-PreAppDeploy、 Infra-EmbeddedPostBuild、Hook-EnactAppDeploy、Hook-PostAppDeploy] 命令在实例上失败。返回码:1 输出:null。

我也尝试过像这样挂钩文件,但这不起作用。

sources:  
  "c:/myproject/myapp": https://test.s3-ap-southeast-1.amazonaws.com/font/ARIALUNI.zip

在 elasticbeanstalk 中出现以下错误。

构建期间发生错误:[Errno 22] 无效模式 ('wb') 或 文件名:u'c:\Windows\Fonts\ARIALUNI.TTF'

【问题讨论】:

    标签: amazon-web-services amazon-ec2 aws-sdk amazon-elastic-beanstalk


    【解决方案1】:

    用下面的代码更新了配置文件,它可以工作了。

    参考网址:https://richardspowershellblog.wordpress.com/2008/03/20/special-folders/

    sources:
      "c:/windows/temp/fonts": https://test.s3-ap-southeast-1.amazonaws.com/font/ARIALUNI.zip
    
    files:
      "C:\\scripts\\install_font.ps1":
        content: |
          #Commands
          $Destination = (New-Object -ComObject Shell.Application).Namespace(0x14)
          #Font Location
          $Font = "C:\Windows\Temp\Fonts\ARIALUNI.TTF"
          #Install
          $Destination.CopyHere($Font,0x10)
    
    commands:
      install_font:
        command: powershell.exe -ExecutionPolicy Bypass -Command "C:\\scripts\\install_font.ps1"
        ignoreErrors: false
        waitAfterCompletion: 5
    

    【讨论】:

      猜你喜欢
      • 2016-02-27
      • 2012-01-02
      • 1970-01-01
      • 2014-10-27
      • 2015-12-15
      • 2020-12-17
      • 2022-01-22
      • 2012-08-25
      • 2017-01-29
      相关资源
      最近更新 更多