Skip to content

PowerShell - New-S3Bucket: Improve error message and cmdlet help info for bucket naming restrictions #347

@pauby

Description

@pauby

When executing the following command: New-S3Bucket -BucketName SomeLogs the following error is issued:

New-S3Bucket : One or more errors occurred. (The specified bucket is not valid.)
At line:1 char:1
+ New-S3Bucket -BucketName 'SomeLogs'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Amazon.PowerShe...wS3BucketCmdlet:NewS3BucketCmdlet) [New-S3Bucket], AggregateException
+ FullyQualifiedErrorId : Failed to create the specified bucket.
Amazon S3 error: One or more errors occurred. (The specified bucket is not valid.),Amazon.PowerShell.Cmdlets.S3.NewS3BucketCmdlet

New-S3Bucket : One or more errors occurred. (The specified bucket is not valid.)
At line:1 char:1
+ New-S3Bucket -BucketName 'SomeLogs'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Amazon.PowerShe...wS3BucketCmdlet:NewS3BucketCmdlet) [New-S3Bucket], InvalidOperationException
+ FullyQualifiedErrorId : System.AggregateException,Amazon.PowerShell.Cmdlets.S3.NewS3BucketCmdlet

Executing New-S3Bucket -BucketName somelogs creates the bucket as normal.

The case of the BucketName parameter should be handled within the function itself either to convert it to lower case and pass onto AWS to create the bucket (preferred), or an error thrown with a helpful error message advising that the bucket case is important AND update the cmdlet help to say this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions