我正在尝试使用适用于 PowerShell 的 AWSPowerShell 模块更新我的 CloudFront 分配。当我使用模块中的更新 cmdlet 时,我总是收到关于未提供“IfMatch”参数的错误。
$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 API 在我的 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