简体   繁体   English

适用于 Powershell 的 AWS 工具,版本差异

[英]AWS Tools for Powershell, version differences

I have been testing an older AWS Tools install using AWSToolsAndSDKForNet_sdk-3.3.398.0_ps-3.3.390.0_tk-1.14.4.1.msi and a newer install using AWSToolsAndSDKForNet_sdk-3.5.2.0_ps-4.1.0.0_tk-1.14.5.0.msi .我一直在测试一个较旧的AWS工具使用安装AWSToolsAndSDKForNet_sdk-3.3.398.0_ps-3.3.390.0_tk-1.14.4.1.msi和新的安装使用AWSToolsAndSDKForNet_sdk-3.5.2.0_ps-4.1.0.0_tk-1.14.5.0.msi The code that I am using to test with is我用来测试的代码是

Set-AWSCredential -AccessKey:$ACCESSKEY -SecretKey:$SECRETKEY -StoreAs:default

$items = Get-S3Object -BucketName:$BUCKETNAME -Region:'eu-west-1' -Key:'revit/2020'
Write-Host "$($items.Length) items"

$count = 1
foreach ($item in $items) {
    Write-Host "$count $($item.key)"
    $count ++
}

I am seeing VERY different behavior, and can't figure out why.我看到了非常不同的行为,无法弄清楚原因。 With 3.3 the code works as intended, I end up with a list of files in my bucket and key.在 3.3 中,代码按预期工作,我最终得到了存储桶和密钥中的文件列表。 Performance is pretty decent, it takes a moment but I have about 5000 files in may "subfolders".性能相当不错,需要一点时间,但我可能在“子文件夹”中有大约 5000 个文件。 When I run this with 4.1 it takes 3-5 times as long and returns nothing.当我用 4.1 运行它时,它需要 3-5 倍的时间并且什么都不返回。 It seems that Help is a bit different too.帮助似乎也有点不同。 A first run of get-help Get-S3Object -detailed will take as long as 10 minutes to run, with CPU, Memory and Disk access often at 99% utilization.首次运行get-help Get-S3Object -detailed需要长达 10 分钟才能运行,CPU、内存和磁盘访问的利用率通常为 99%。 A second run is quite quick.第二次运行非常快。 3.3 Does nothing of the sort. 3.3 什么都不做。

So, is this current build of AWS Tools for Powershell just not ready for prime time?那么,这个当前版本的 AWS Tools for Powershell 还没有准备好迎接黄金时段吗? My searches for AWS Tools 4.1 performance have turned up nothing.我对AWS 工具 4.1 性能的搜索一无所获。 For what it is worth, I am using the MSI installer because I need the install to actually work consistently, and the NuGet approach has been very problematic on a number of production workstations.就其价值而言,我使用 MSI 安装程序是因为我需要安装才能真正一致地工作,而 NuGet 方法在许多生产工作站上都​​存在很大问题。 But if there is another option I would love to look at it.但如果有另一种选择,我很想看看。 The main issue is I need ultimately to do the install and immediately load the modules and work with AWS.主要问题是我最终需要进行安装并立即加载模块并使用 AWS。 I don't have that working with the MSI based install yet, but that's for a different thread.我还没有使用基于 MSI 的安装,但那是针对不同的线程。

It looks like they changed the results from Get-S3Object .看起来他们改变了Get-S3Object的结果。 You will need to add -Select S3Objects.Key to get the results you're looking for (or just -select * ).您需要添加-Select S3Objects.Key以获得您正在寻找的结果(或只是-select * )。 Here's the excerpt from the change notes:以下是更改说明的摘录:

Most cmdlets have a new parameter: -Select.大多数 cmdlet 都有一个新参数:-Select。 Select can be used to change the value returned by the cmdlet. Select 可用于更改 cmdlet 返回的值。 For example the service API used by Get-S3Object returns a ListObjectsResponse object but the cmdlet is configured to return only the S3Objects field.例如,Get-S3Object 使用的服务 API 返回 ListObjectsResponse 对象,但 cmdlet 配置为仅返回 S3Objects 字段。 Now you can specify -Select * to receive the full API response.现在您可以指定 -Select * 以接收完整的 API 响应。 You can also specify the path to a nested result property like -Select S3Objects.Key.您还可以指定嵌套结果属性的路径,例如 -Select S3Objects.Key。 In certain situations it may be useful to return a cmdlet parameter, this can be achieved with -Select ^ParameterName.在某些情况下,返回 cmdlet 参数可能很有用,这可以通过 -Select ^ParameterName 实现。

Found by going to the Change Notes and doing a CTRL+F for Get-S3Object .通过转到更改说明并为Get-S3Object执行 CTRL+F找到 Hope this resolves it for you!希望这可以为您解决!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM