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
239 stars 79 forks source link

Get-EC2Subnet -name attribute /AWS Console #220

Closed manuelh2410 closed 3 years ago

manuelh2410 commented 3 years ago

Good Day,

I have come across another anomaly.

This issue/bug consists of two parts.

Part one : If you check the AWS console, you will see that the console offers an option to enter a "name" for the vpc subnets in your account Yet if you compare this to the documentation for both the "Get-EC2Subnet" command-let and the "Amazon.EC2.Model.Subnet object" you will see that the "name" property is not available for the "Amazon.EC2.Model.Subnet" object, nor is possible to query your subnets based the "name" attribute, see the "Get-EC2Subnet" documentation.

The second part of this anomaly is that when one adds a "name" to a subnet, the "Tags" property is populated with a "{Name}" value ,instead of the name added in the AWS Console. I tested this with several subnets and the behaviour is the same each and every time.

SubnetId : subnet-0dxxxxxb Tags : {Name}

SubnetId : subnet-0e7xxx2f Tags : {Name}

SubnetId : subnet-1xxxc25 Tags : {Name}

This shows yet another inconsistency between the information in the AWS console and the available API calls. And in this case, It also shows that the "Tags" property for the "Amazon_EC2_Model_Subnet" object is unreliable, specifically when you interact with this object using the EC2Console. test

I have added screenshots to better illustrate my point.

PowerShell Module: PS C:\Windows\System32> get-installedModule -name AWS

Version Name Repository Description


4.1.12.0 AWSPowerShell.NetCore PSGallery The AWS Tools for PowerShell lets develo…

Powershell version:

PS C:\Windows\System32> $PSVersionTable

Name Value


PSVersion 7.1.3 PSEdition Core GitCommitId 7.1.3 OS Microsoft Windows 10.0.19042 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

Documentation: https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2Subnet.html https://docs.aws.amazon.com/sdkfornet/v3/apidocs/index.html?page=EC2/TEC2Subnet.html&tocid=Amazon_EC2_Model_Subnet

ashishdhingra commented 3 years ago

Hi @manuelh2410,

Good morning.

Thanks for posting the issue. Upon reviewing the subnet documentation, it appears that the Amazon EC2 - Subnet - API reference does not have a property name. The model in AWS .NET SDK (and hence PowerShell) relies on definitions shared by service and hence appear to be correct. Upon reviewing further, when I create a subnet from AWS VPC console, it clearly specifies for Subnet name field that Create a tag with a key of 'Name' and a value that you specify.:

Screen Shot 2021-06-14 at 9 57 11 AM

It indicates that the subnet name information is present as value for a tag Name. For instance, I create a subnet with name testsubnet, it created a tag Name with value testsubnet:

Screen Shot 2021-06-14 at 10 08 33 AM

When PowerShell command Get-EC2Subnet is executed, it displays the subnet details. The Tags property is an array of Tag objects. To view the Tags, use (Get-EC2Subnet).Tags instead, which displays tag information:

Key  Value
---  -----
Name testsubnet

To apply Filter on Get-EC2Subnet, you may use any of the following 2 queries:

Hope this helps.

Thanks, Ashish

manuelh2410 commented 3 years ago

Good Day ,

Thanks for investigating, your time and your update, but no, this does not help, nor do your troubleshooting steps represent the steps I took to replicate the behaviour .

ashishdhingra commented 3 years ago

Good Day ,

Thanks for investigating, but no, this does not help, nor do your troubleshooting steps represent the steps I took to replicate the behaviour .

@manuelh2410 Could you please elaborate on what is missing here where all the screenshots are attached and let us know the steps you used to replicate the behavior? May be something is missing here. I do not see any inconsistency with the API documentation and AWS Console behavior.

manuelh2410 commented 3 years ago

Good Day ,

Thanks for investigating, your time and your update, but no, this does not help, nor do your troubleshooting steps represent the steps I took to replicate the behaviour .

The object does not contain the -Name attribute , and yet , there is a Name attribute clearly shown in the EC2 console . When you interact with the name attribute in the AWS console , the "Tag" attribute of the object is populated .

You can see how this is unreliable , unexpected and plain wrong

this is clearly a bug

ashishdhingra commented 3 years ago

Good Day ,

Thanks for investigating, your time and your update, but no, this does not help, nor do your troubleshooting steps represent the steps I took to replicate the behaviour .

The object does not contain the -Name attribute , and yet , there is a Name attribute clearly shown in the EC2 console . When you interact with the name attribute in the AWS console , the "Tag" attribute of the object is populated .

You can see how this is unreliable , unexpected and plain wrong

this is clearly a bug

@manuelh2410 As mentioned in my detailed findings, the Name column in the AWS Console specifies the value of tag named Name. This is not a bug/issue with the PowerShell tools or AWS .NET SDK. You may try to create an issue with support for inconsistent AWS Console UI behavior using Support option in AWS Console.

manuelh2410 commented 3 years ago

Correct, I found the same issue with 3 other command-lets. I know the difference between a -name attribute, and a "name" "value" tag. The documentation clearly makes that destinction. So lets not conflate the two . The object does not have a name attribute that is correct and we have already established that .But when I populate the -name attribute for an already existing object in the AWS Console, and then querry my object using the AWS-Powershell tools the "Tag" object attribute is populated with an obscure " {Name}" value instead of listing a -Name attribute ,with the value I added trough the aws console . again , it does not seem very client obsessed to ask or demand that I open yet another case for this issue . And If possible I would like you to discuss this with your superiors or colleagues before pushing back on this .

Its the object which is missing the -Name attribute . and I stated at the beginning that this is a two-part issue.

1- An issue with the object (missing attribute /incorrect population of an incorrect attribute) 2- An issue when populating the name attribute using the AWS Console

ashishdhingra commented 3 years ago

@manuelh2410 Let me discuss with the team and if possible, would create an issue with appropriate service team. The reason I requested you to open the issue using the Support option is for easy tracking and direct communication from service team. I will post an update here based on my discussion.

ashishdhingra commented 3 years ago

Related issues:

ashishdhingra commented 3 years ago

Upon further investigation, For AWS Console: If you click on the settings for Subnet list, it clearly selects Name tag by default to display and uses tag name as column name:

Screen Shot 2021-06-14 at 11 59 01 AM

Based on my testing, you have ability to create multiple tags for a subnet and select that Tag to be displayed as a column in the list.

Screen Shot 2021-06-14 at 12 10 18 PM

Hence, clearly, Name column is mapped to tag named Name.

For PowerShell CmdLet: The output of the CmdLet is controlled by PowerShell console. The Tags property is an array, hence it displays the Name property in curly braces. For testing, I added another tag named CustomTag and now the output is shown below:

Screen Shot 2021-06-14 at 12 12 54 PM

Hope this provides detailed explanation.

manuelh2410 commented 3 years ago

Being a graphical user interface, One assumes that the AWS Console is a 1 to 1 representation of objects, attributes, their related data, and the associated API functionality.

In line with this, any end-user would assume that the data stored in the NAME column would represent the data linked to the -Name Parameter of the object being shown (displayed), an not that of a "mapped" to a Tag: key Value pair.

In this scenario e both established that this is clearly not the case.

If you check the example I included you can clearly see that the Get-EC2Image command-let returns both a Name attribute with its corresponding "my-image" value and a separate Tags attribute with the corresponding, albeit obscure {name} value.

So please tell me how is it logically sound, to have the Name attribute of an object, not map to the Name column of a graphical user interface displaying that same object.

And how is it possible that not all user-configurable objects have a Name attribute, while the console clearly provides a designated "Name" column

If you like I can check with the graphical user interfaces of competing cloud providers in order to confirm if what I am suggesting /asking is unreasonable.

In case someone asks me, Is it safe to conclude that not all object attributes have a 1 to 1 mapping with what is displayed in the AWS console ?

https://docs.aws.amazon.com/sdkfornet/v3/apidocs/index.html?page=EC2/TEC2Image.html&tocid=Amazon_EC2_Model_Image Get-EC2Image

ashishdhingra commented 3 years ago

@manuelh2410 For graphical user interface issues, please submit the feedback using the option provided in the AWS Console. In case you face any PowerShell related issues, feel free to open a new issue.

github-actions[bot] commented 3 years ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

manuelh2410 commented 3 years ago

Customer Obsession!!!!!

ashishdhingra commented 3 years ago

Being a graphical user interface,

One assumes that the AWS Console is a 1 to 1 representation of objects, attributes, their related data, and the associated API functionality.

In line with this, any end-user would assume that the data stored in the NAME column would represent the data linked to the -Name Parameter of the object being shown (displayed), an not that of a "mapped" to a Tag: key Value pair.

In this scenario e both established that this is clearly not the case.

If you check the example I included you can clearly see that the Get-EC2Image command-let returns both a Name attribute with its corresponding "my-image" value and a separate Tags attribute with the corresponding, albeit obscure {name} value.

So please tell me how is it logically sound, to have the Name attribute of an object, not map to the Name column of a graphical user interface displaying that same object.

And how is it possible that not all user-configurable objects have a Name attribute, while the console clearly provides a designated "Name" column

If you like I can check with the graphical user interfaces of competing cloud providers in order to confirm if what I am suggesting /asking is unreasonable.

In case someone asks me, Is it safe to conclude that not all object attributes have a 1 to 1 mapping with what is displayed in the AWS console ?

https://docs.aws.amazon.com/sdkfornet/v3/apidocs/index.html?page=EC2/TEC2Image.html&tocid=Amazon_EC2_Model_Image

Get-EC2Image

@manuelh2410 Yes, I do see some inconsistency between different API s provided by service. I will post this question to service team to get their inputs for this inconsistency and update you accordingly.