aws / aws-sdk

Landing page for the AWS SDKs on GitHub
https://aws.amazon.com/tools/
Other
68 stars 12 forks source link

aws ssm start-automation-execution not accepting taget filtering by multiple tags(short issue description) #717

Open RoshmiB opened 2 months ago

RoshmiB commented 2 months ago

Describe the bug

While running this command:- aws --region us-west-2 ssm start-automation-execution --document-name "AWS-ResizeInstance" --parameters "InstanceType=t3a.small,AutomationAssumeRole=arn:aws:iam:::role/AWS-SystemsManager-AutomationAdministrationRole" --target-parameter-name InstanceId --targets Key=tag:MaintenanceDays,Values=30,127 Key=tag:MaintenanceTimeStart,Values=12 --target-locations Accounts=,Regions=us-west-2,us-east-2,ExecutionRoleName=AWS-SystemsManager-AutomationExecutionRole

Expected Behavior

It should run successfully

Current Behavior

It is throwing error :- botocore.errorfactory.InvalidAutomationExecutionParametersException: An error occurred (InvalidAutomationExecutionParametersException) when calling the StartAutomationExecution operation: Only one resource group or tag can be specified at a time

Reproduction Steps

run this command:- aws --region us-west-2 ssm start-automation-execution --document-name "AWS-ResizeInstance" --parameters "InstanceType=t3a.small,AutomationAssumeRole=arn:aws:iam:::role/AWS-SystemsManager-AutomationAdministrationRole" --target-parameter-name InstanceId --targets Key=tag:MaintenanceDays,Values=30,127 Key=tag:MaintenanceTimeStart,Values=12 --target-locations Accounts=,Regions=us-west-2,us-east-2,ExecutionRoleName=AWS-SystemsManager-AutomationExecutionRole

Possible Solution

No response

Additional Information/Context

No response

CLI version used

aws-cli/2.15.36 Python/3.11.8 Linux/5.15.146.1-microsoft-standard-WSL2 exe/x86_64.ubuntu.22 prompt/off

Environment details (OS name and version, etc.)

Ubuntu 22.04.4 LTS

tim-finnigan commented 2 months ago

Hi @RoshmiB thanks for reaching out. The start-automation-execution command corresponds to the StartAutomationExecution API. Therefore the parameter validation is set by the service team. Here is the Target API documentation showing supported formats for reference.

The SSM User Guide does have a section on targeting multiple managed nodes, where it shows send-command as supporting multiple tags. So I'm not sure if start-automation-execution is designed to not support multiple tags, or maybe this is something that needs to be clarified in the documentation.

Since this issue involves a service API which is used across the CLI/SDKs, I'm going to transfer it to our cross-SDK repository. I'll also reach out to the service team to try to get more information. (ref: D77464262)