我有一个应用程序,使用AWS Codedeploy将其部署到运行Windows Server 2012 R2且安装了代码部署代理的EC2实例。
代码修订版已成功从S3存储桶下载到EC2实例,但是PowerShell脚本引发错误。
只是要通知您,在EC2实例中手动执行脚本时,脚本运行成功。
这是我的appspec.yml和before-install.bat
appspec.yml
version: 0.0
os: windows
files:
- source: \index.html
destination: C:\DemoApp\MySite
hooks:
BeforeInstall:
- location: \before-install.bat
timeout: 900
before-install.bat
C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -Command "& {Import-Module WebAdministration; New-Item iis:\Sites\MySite -bindings @{protocol=\"http\";bindingInformation=\":80:\"} -physicalPath c:\DemoApp\MySite; New-Item IIS:\AppPools\MyPool; Set-ItemProperty IIS:\Sites\MySite -name applicationPool -value MyPool;}"
codedeploy-agent-deployments.log
脚本-\ before-install.bat C:\ Windows \ system32> C:\ Windows \ system32 \ WindowsPowerShell \ v1.0 \ powershell.exe-命令“&{Set-ExecutionPolicy Unrestricted; Import-Module WebAdministration; New-Item iis :\ Sites \ MySite -bindings @ {protocol = \“ http \”; bindingInformation …
iis powershell amazon-web-services windows-server-2012-r2 aws-code-deploy