Between the summer of 2014 and the end of 2018, I wrote solely at tommymaynard.com. As of January 2019, I took it upon myself to step up my game and write exclusively at PowerShell.org -- the center of the PowerShell community. One of the things I was able to do with my personal website over the years, was to help promote change. This, through simply learning for some, but also though reaching out for things I believed we needed.
There was an article I wrote in 2016 where I discussed AWS' (Amazon Web Services) need for an additional EC2 cmdlet. At that time, the Remove-EC2Instance cmdlet did not exist. To remove an EC2 AWS compute instance -- a virtual server -- the Stop-EC2Instance cmdlet had to be invoked and include its Terminate parameter. Awesome, right? No.
Someone close to the PowerShell work at AWS read, agreed, and saw that a change was made. This was of no great surprise, as AWS is highly customer focused. I've heard several times that much of what they do is driven by customer interaction and need. As it should be. Here's the Remove-EC2Instance cmdlet, as a part of their AWSPowerShell module.
Today I want to discuss the Get-AWSPowerShellVersion cmdlet. It’s one of those hey-run-this-command-after-you-install-the-module commands, in order to determine if things were installed properly. Here's the default output produced when it's invoked.
I don't think Get-AWSPowerShellVersion is a bad cmdlet. It even provides additional information. Nice, but it's from here where the cmdlet gets "interesting," and where I think we should see some changes from AWS.
For those of us that have been paying attention to PowerShell, we've all likely been through, or heard, some best practices. Cmdlets and functions should do one thing, and that one thing well. Additionally, they should only produce a single object type. Simple. The problem with this cmdlet, is that it does do more than it should. When Get-AWSPowerShellVersion is invoked with its ListServiceVersionInfo switch parameter, it will return both the version information we saw previously, as well as the AWS Service information.
As you can see in the above image, this command likely produces two different object types. And, in the below image, it's verified that it does. This shouldn't be happening.
Now, just because this command has been written this way, doesn't mean the cmdlet is of no use when someone wants to filter against the properties in the PSCustomObject -- the service output. I am able to include the ListServiceVersionInfo switch parameter and filter against the services, the noun prefixes, and even the API version dates that are returned. That's nice, but it still just doesn't feel right.
I’m grateful the command can be used this way, but just maybe we can separate the values returned by this cmdlet by using and not using the ListServiceVersionInfo, into more than one command. Keep Get-AWSPowerShellVersion and make it only return the text-based version information. Then, create a new cmdlet -- Get-AWSService, perhaps -- that only returns the service information. Both invocations of Get-AWSPowerShellVersion provide valuable information; however, I feel as they should do so separately. Additionally, this makes AWS service discoverability and the matching nouns more difficult to find. It should have its own command; it shouldn't be buried in a command where it doesn't feel like it should be.
AWS has long added warning messages that a certain switch(es) will be deprecated in future releases, and indicated to instead use new cmdlets. So AWS, if you're listening, let's see a Get-AWSService cmdlet is created. And, just maybe we should throw in a couple new aliases, too. Allow Get-AWSNounPrefix and Get-AWSAPIVersion to invoke Get-AWSService, as well.
In closing, I want to mention how vital it is to be able to find commands within a specific AWS service using the Noun Prefix property of Get-AWSPowerShellVersion.
Like with Get-Service, let me do this...
PS > Get-AWSService -Noun T*
Instead of this...
PS > Get-AWSPowerShellVersion -ListServiceVersionInfo | Where-Object -Property 'Noun Prefix' -like 'T*'
≥ Tommy Maynard (Twitter: @thetommymaynard)