aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
238 stars 79 forks source link

S3 Bucket object should contain the Region #36

Closed juancrl closed 5 years ago

juancrl commented 5 years ago

The Amazon.S3.Model.S3Bucket type does not contain a property with the region where each specific bucket is located. So Get-S3Bucket can return the bucket names (and the creation date), but not the region.

Desired scenario, which cannot be achieved : Piping Get-S3Bucket | Get-S3Object, Which works only for buckets found in the default region. For all others, errors :

Get-S3Object : The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.

Expected behaviour : Get-S3Bucket | Get-S3Object working in all cases, as the Region property could be passed to Get-S3Object

Possible workaround : Calling Get-S3BucketLocation in the loop. That makes piping really cumbersome, too complex for a single property (which is a property OF the bucket)

matteo-prosperi commented 5 years ago

Hello, Thank you for providing this feedback.

The Get-S3Bucket cmdlet leverages the following S3 API which doesn't return the region information. We usually avoid making multiple service calls in a single cmdlet because it would increase the execution time even for people who don't need the additional information. Also, enforcing assumptions that are straightforward now but are not reflected by the service APIs (like the many-to-1 correlation between buckets and region), may result in not being able to udpate cmdlets in a backward compatible way if the APIs are evolved in a way that we didn't consider when designing the cmdlet.

I will close this because I don't have a direct way to address this issue, but I will keep into consideration for future improvements.