InvalidResourceId Error When Trying to List Tags for Parameter

0

Hi there. I was attempting to use the aws cli to manage tags on some SSM Parameters I had created; specifically, I was using the list-tags-for-resource command. For most parameters, this works just fine. However, I have a few parameters with a "/" in their name, e.g. "/build-number/ExcelService". When I try to try to query the tags for these parameters, I receive an error.

Command:

aws ssm list-tags-for-resource --resource-type "Parameter" --resource-id "/build-number/ExcelService"

Error:

An error occurred (InvalidResourceId) when calling the ListTagsForResource operation:

(Note: the trailing colon in the error message is not a copy-paste mistake; nothing followed it in the error message).

The same error is also thrown for the command add-tags-to-resource. I've tried escaping the slashes with backslashes, tried removing the leading slash, and various other modifications, but nothing avoids the error. Is there another way I should be escaping or replacing the slashes? Any other options I'm missing? Or is this simply a bug?

Edited by: CMoss-VVS on Aug 16, 2019 11:02 AM

gefragt vor 5 Jahren1173 Aufrufe
4 Antworten
0
Akzeptierte Antwort

Yes, my guess is also that it is the version. I also just tried on an EC2 Amazon Linux 2 with the default aws cli of 1.16.102, and it worked fine.

[ec2-user@ip-172-31-81-169 ~]$ aws ssm add-tags-to-resource --resource-type "Parameter" --resource-id "/pets/dog/kukki" --tags "Key=car,Value=mazda"
[ec2-user@ip-172-31-81-169 ~]$ aws ssm list-tags-for-resource --resource-type "Parameter" --resource-id "/pets/dog/kukki"
{
    "TagList": [
        {
            "Value": "mazda",
            "Key": "car"
        },
        {
            "Value": "qa",
            "Key": "org"
        }
    ]
}
[ec2-user@ip-172-31-81-169 ~]$ aws --version
aws-cli/1.16.102 Python/2.7.16 Linux/4.14.123-111.109.amzn2.x86_64 botocore/1.12.92

-randy

beantwortet vor 5 Jahren
0

Hi,
I was not able to reproduce your problem in my environment.

rtakeshi@DESKTOP-OT2QIS0:~$ aws ssm add-tags-to-resource --resource-type "Parameter" --resource-id "/pets/dog/kukki" --t
ags "Key=org,Value=qa"
rtakeshi@DESKTOP-OT2QIS0:~$ aws ssm list-tags-for-resource --resource-type "Parameter" --resource-id "/pets/dog/kukki"
{
    "TagList": [
        {
            "Key": "org",
            "Value": "qa"
        }
    ]
}
rtakeshi@DESKTOP-OT2QIS0:~$ aws --version
aws-cli/1.14.44 Python/3.6.8 Linux/4.4.0-17763-Microsoft botocore/1.8.48

Note: when I was testing, I accidentally mispelled "pets" as "petg" and saw the following:

rtakeshi@DESKTOP-OT2QIS0:~$ aws ssm add-tags-to-resource --resource-type "Parameter" --resource-id "/petg/dog/kukki" --t
ags "Key=org,Value=qa"

An error occurred (InvalidResourceId) when calling the AddTagsToResource operation:

Is there any chance that the Parameter store name does NOT match "/build-number/ExcelService"?

-randy

beantwortet vor 5 Jahren
0

Hi Randy,

Thanks for your response. Yes, I am positive the name was spelled correctly. I even copy-pasted it into the command as a sanity check. I also duplicated your parameter, and your command, exactly and I'm still getting the same error.

Since there is a discrepancy in behaviour, I wonder if this is because I'm using the version of the CLI installed with pip? I made the switch a while ago because the msi-installed CLI was throwing an error on certain S3 commands (see https://stackoverflow.com/questions/53144254/aws-cli-upload-failed-unknown-encoding-idna). That's the only difference I can think of off the top of my head.

beantwortet vor 5 Jahren
0

Yeah, seems to be a Windows thing, actually. It works when I test from a Linux EC2 instance, but I tested with some coworkers' machines and it doesn't seem to work on Windows whether the .msi or pip was used to install.

Guess I won't worry about it much more at the moment, though maybe I'll file a bug report somewhere. Thanks for the help!

beantwortet vor 5 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen