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
235 stars 78 forks source link

Get-EC2Address -Filter using tags is so unclear #139

Closed olen2006 closed 3 years ago

olen2006 commented 4 years ago

Could you guys please update documentation with clear example on how to filter EIP addresses using tags.

In Documentation there is no way to know how to make it work

https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2Address.html

-Filter <Filter[]> One or more filters. Filter names and values are case-sensitive.

... tag: - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value. tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.

And there is no hope to find anything in the Examples section as well

get-help Get-EC2Address -examples

-------------------------------EXAMPLE 4--------------------------- Get-EC2Address -Filter @{ Name="domain";Value="standard" }

When in fact it should look like this:

Get-EC2Address -Filter @{Name="tag-key";Values="Name"} or Get-EC2Address -Filter @{Name="tag-value";Values="Bastion"} and finally Get-EC2Address -Filter @{Name="tag:Name";Values="Bastion"}

Thank you.

klaytaybai commented 4 years ago

Hi @olen2006. You are wanting an example in get-help Get-EC2Address -examples, is that correct? The results of running the command match what I would expect from the documentation. Are you having difficulty with executing the command or are you just wanting more complete examples?

I'm not sure why you say this:

When in fact it should look like this:

Get-EC2Address -Filter @{Name="tag-key";Values="Name"} or Get-EC2Address -Filter @{Name="tag-value";Values="Bastion"} and finally Get-EC2Address -Filter @{Name="tag:Name";Values="Bastion"}

If you want to get your addresses that have a tag "Name" with the value "Bastion", you only need to run the last option.

olen2006 commented 4 years ago

Just a clear example.

ashishdhingra commented 3 years ago

PR https://github.com/aws/aws-tools-for-powershell/pull/154 needs review.

ashishdhingra commented 3 years ago

Example added at https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2Address.html