簡體   English   中英

無法在 Windows EC2 上運行 Powershell 用戶數據腳本

[英]Can't run Powershell user data scripts on Windows EC2

我正在使用 Javascript SDK 運行 Windows Server2019 EC2 實例 - 我使用的 AMI 是自定義 AMI。 通過 SDK,我正在輸入以下用戶數據:

<powershell>
    Copy-S3Object -BucketName mybucket -KeyPrefix myprefix -LocalFolder C:\Users\myuser\Desktop -Region ap-southeast-2
</powershell>
<persist>true</persist>

當我 select 運行實例並查看用戶數據時,上述用戶數據正確顯示。

當我使用相同的用戶數據和 IAM 角色從控制台手動運行基本 Windows Server2019 實例時,我已將適當的 IAM 角色添加到實例中。

但是從 SDK 運行它時,EC2 日志顯示:

<powershell> tag was provided.. running powershell content
Failed to get metadata: The result from http://169.254.169.254/latest/user-data was empty
Unable to execute userdata: Userdata was not provided

訣竅是使用 sysprep 創建 AMI,如此處所示

暫無
暫無

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

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