내용으로 건너뛰기

aws rds add-tags-to-resource does not records the tags

0

Hello I'm using the cli command aws rds add-tags-to-resource from a json file to import tags. The command does not report error, runs ok, but no tags are written.. The instance target is a Rds replica. Maybe I miss something?

aws rds add-tags-to-resource --resource-name arn:aws:rds:us-east-1:name:db:instance-ro- --tags file://tags.json

And the file is like:

"{ "Tags": [ { "Key": "domain-name", "Value": "some-domain" }, { "Key": "owner", "Value": "some-owner" }, .... ] } "

질문됨 2년 전415회 조회

4개 답변
2

Hi,

You would need to use the parameter "cli-input-json" to input the json file to add the tag.

Below is sample command to add tag to the DB resource using the sample file - tags.json

aws rds add-tags-to-resource --resource-name arn:aws:rds:us-east-1:xxxxxxxxxxxx:db:mysampleDB --cli-input-json file://tags.json 
$cat tags.json 
{
  "Tags": [
    {
      "Key": "Environment",
      "Value": "Test"
    },
    {
      "Key": "Project",
      "Value": "Testing"
    }
  ]
}

Reference - https://docs.aws.amazon.com/cli/latest/reference/rds/add-tags-to-resource.html

AWS

답변함 2년 전

전문가

검토됨 2년 전

1

Hi,

Did you check the absence of tags by both AWS CLI and AWS console ?

Did you also try the so-called short-hand syntax document here: https://docs.aws.amazon.com/cli/latest/reference/rds/add-tags-to-resource.html

If they are really missing after all this trial, then, you should open a ticket to our Support via the AWS console of your account: you may well face a bug!

Best,

Didier

전문가

답변함 2년 전

전문가

검토됨 2년 전

1

Hello.

Please change the contents of the "tags.json" file as follows.

[{ "Key": "domain-name", "Value": "some-domain" }, { "Key": "owner", "Value": "some-owner" }]

As described in the document below, the json for the "--tags" option is as follows.
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/rds/add-tags-to-resource.html

[
  {
    "Key": "string",
    "Value": "string"
  }
  ...
]
전문가

답변함 2년 전

전문가

검토됨 2년 전

0

Works great ! The --cli-input-json parameter makes the difference. The wrong one I've used it comes from the ec2 command..

Thanks!

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠