我正在使用运行Windows Server 2012 R2的EC2实例,并且我在启动时触发了一个计划任务,它来自git repo和s3存储桶。
当我RDP并自己运行任务时,一切都很可爱但是当我重新启动实例并允许onstart
触发器启动脚本时,它总是在第一次尝试获取远程资源时挂起。如果它是一个s3桶或一个git repo,它也是一样的。
以下是读取s3存储桶的输出:
Read-S3Object : Access Denied
At C:\Scripts\bootstrap.ps1:8 char:1
+ Read-S3Object -BucketName my-bucket -Key myScript.ps1 -F ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Amazon.PowerShe...dS3ObjectCmdlet:ReadS3ObjectCmdlet) [Read-S3Object]
, InvalidOperationException
+ FullyQualifiedErrorId : Amazon.S3.AmazonS3Exception,Amazon.PowerShell.Cmdlets.S3.ReadS3ObjectCmdlet
以下是git clone失败时的输出:
git : Cloning into 'myWork.myApp'...
At C:\Scripts\bootstrap.ps1:12 char:1
+ git clone -v git@bitbucket.org:myTeam/myWork.myApp.git
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Cloning into 'a....initialize'...:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我不能为我的生活弄清楚为什么这会失败。我是否应该将实例UserData
用于我的脚本?如果是这样的话,为什么呢?