我正嘗試使用PowerShell的AWSPowerShell模塊更新我的CloudFront分配。當我使用模塊中的更新cmdlet時,我總是收到有關未提供「IfMatch」參數的錯誤。AWS PowerShell更新CloudFront分配
$cfd = Update-CFDistribution @parameters -Id "E2POBWR9AXFROP"
Error: The If-Match version is missing or not valid for the resource.
Update-CFDistribution : The If-Match version is missing or not valid for the resource.
我去AWS文檔瞭解這個參數,它說:
-IfMatch:您檢索分配的配置時收到的ETag頭的價值。例如: E2QWRUHAPOMQZL。
我想知道是否有辦法使用AWSPowerShell模塊cmdlet獲取ETag頭的內容。我不想直接調用AWS PowerShell腳本中的Http請求來獲取標題的內容......但也許這是唯一的方法。
我試着用Get-CFDistributionConfig cmdlet,但是它沒有返回這個信息。
$cfd = Get-CFDistributionConfig @parameters -Id "E2POBWR9AXFROP"
這是PowerShell中的版本我使用:
PS C:\> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 15063 608
這是AWSPowerShell模塊的版本我使用:
PS C:\> Get-Module "AWSPowerShell" -ListAvailable
ModuleType Version Name
---------- ------- ----
Binary 3.3.169.0 AWSPowerShell