aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

ssm unable to specify multiple targets

Open ivarrian opened this issue 9 years ago • 5 comments

The documentation indicates that you can do this :

aws ssm send-command --document-name name --targets "Key=tag:tag name,Values=tag value" [...]

However, specifying multiple targets does not actually work

example :

aws ssm send-command --document-name "AWS-RunShellScript" --targets "Key=tag:clusterId,Values=abc" "Key=tag:nodeId,Values=xyz" --parameters commands=["date"]

An error occurred (InvalidParameters) when calling the SendCommand operation: Specifying multiple target filters is not supported yet.

This could be classified as a documentation issue.

ivarrian avatar Jun 16 '17 03:06 ivarrian

The docs come from the service API: http://docs.aws.amazon.com/systems-manager/latest/APIReference/API_SendCommand.html#EC2-SendCommand-request-Targets

We can follow up and ask them to update their docs. Thanks for reporting.

jamesls avatar Jun 16 '17 23:06 jamesls

Hello, I'm also facing the issue but I can't even use the single target filters Example : aws ssm send-command --document-name "AWS-RunShellScript" --targets "Key=tag:Name,Values=test-acp" --parameters commands=["date"]

aws: error: the following arguments are required: --instance-ids

Any help will be appreciated

amalcp avatar Jan 22 '18 11:01 amalcp

eu-west-3(Paris) doesn't support multiple tags

debu99 avatar Dec 17 '18 03:12 debu99

@ivarrian and @amalcp - Using the latest version of the CLI, this issue was re-tested successfully using two tag key/value pairs and two values:

Targeting two tag key/value pairs:

aws ssm send-command --document-name "AWS-RunPowerShellScript" --parameters commands=["echo helloWorld"] --targets Key=tag:Name,Values=ToolsInstance Key=tag:PatchGroup,Values=TestInstance
{
    "Command": {
        "CommandId": "<id removed>",

Targeting two values for a single tag key:

aws ssm send-command --document-name "AWS-RunPowerShellScript" --parameters commands=["echo foobar"] --targets Key=tag:Name,Values=ToolsInstance,TestInstance
{
    "Command": {
        "CommandId": "<id removed>",

Please let us know if it is still an issue.

justnance avatar Apr 22 '19 22:04 justnance

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

no-response[bot] avatar Apr 29 '19 23:04 no-response[bot]