Giter Site home page Giter Site logo

Comments (8)

JimbroAmazon avatar JimbroAmazon commented on September 26, 2024

Hi Ameya,
Thanks for sending this feedback. I'm going to set up an environment and see if I can repro your issue. But before I do so, would you mind testing one thing for me? Could you change your last parameter in the command from --task-invocation-parameters to --task-parameters "{"Operation":{"Values":["Install"]}}"

Please let me know if that works. Thanks!

from aws-systems-manager-user-guide.

bcxpro avatar bcxpro commented on September 26, 2024

I think that the part of the quotes and escape characters differs depending on the shell you are using and is not valid, for different reasons, neither on Linux/bash nor Windows/CMD.

If you pass '{\"Operation\":{\"Values\":[\"Install\"]}}'as an argument on CMD, the program receives: '{"Operation":{"Values":["Install"]}}' (note that there are single quotes, which makes the JSON document invalid)

The result of calling the actual aws ssm command is:
Error parsing parameter '--task-invocation-parameters': Expected: '=', received: ''' for input: '{"Operation":{"Values":["Install"]}}'

If you pass '{\"Operation\":{\"Values\":[\"Install\"]}}' as an argument on bash, the program receives: {\"Operation\":{\"Values\":[\"Install\"]}} (this is because the \ inside single quotes in bash is not acting as an escape character)

The result of calling the aws ssm command is:
Error parsing parameter '--task-invocation-parameters': Invalid JSON: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) JSON received: {\"Operation\":{\"Values\":[\"Install\"]}}

With the proposed modification:
Passing "{\"Operation\":{\"Values\":[\"Install\"]}}" via CMD, the program receives {"Operation":{"Values":["Install"]}}. Valid JSON.

The result is:
Parameter validation failed: Unknown parameter in TaskInvocationParameters: "Operation", must be one of: RunCommand, Automation, StepFunctions, Lambda

Passing "{\"Operation\":{\"Values\":[\"Install\"]}}" via bash, the program receives {"Operation":{"Values":["Install"]}}{"Operation":{"Values":["Install"]}}. Valid JSON.

Result:
Parameter validation failed: Unknown parameter in TaskInvocationParameters: "Operation", must be one of: RunCommand, Automation, StepFunctions, Lambda

from aws-systems-manager-user-guide.

JimbroAmazon avatar JimbroAmazon commented on September 26, 2024

Thanks everyone. We've created a ticket in our internal system to update the example so I'm going to close this issue. Also, here is an example of --task-invocation-parameters that might be useful: https://docs.aws.amazon.com/systems-manager/latest/userguide/mw-cli-tutorial-tasks.html

from aws-systems-manager-user-guide.

ameyaagashe avatar ameyaagashe commented on September 26, 2024

@JimbroAmazon If I use --task-parameters that still does not work,.

aws ssm register-task-with-maintenance-window --window-id $grpa_maint_window --targets "Key=WindowTargetIds,Values=$reg_grpa_tar_wind_id" --task-arn "AWS-RunPatchBaseline" --service-role-arn "arn:aws:iam::xxxxxxxxxxxxxxxxxxxxxx:role/AmazonSSMRoleForInstancesQuickSetup" --task-type "RUN_COMMAND" --max-concurrency 2 --max-errors 1 --priority 1 --task-parameters '{\"Operation\":{\"Values\":[\"Install\"]}}'
+ aws ssm register-task-with-maintenance-window --window-id mw-086bfbb3f3181ec38 --targets Key=WindowTargetIds,Values=102fcef1-7c14-4a54-823b-cc01a637ddb5 --task-arn AWS-RunPatchBaseline --service-role-arn arn:aws:iam::xxxxxxxxxxxxxxxxxxxxx:role/AmazonSSMRoleForInstancesQuickSetup --task-type RUN_COMMAND --max-concurrency 2 --max-errors 1 --priority 1 --task-parameters '{\"Operation\":{\"Values\":[\"Install\"]}}'

Error parsing parameter '--task-parameters': Invalid JSON: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
JSON received: {\"Operation\":{\"Values\":[\"Install\"]}}

from aws-systems-manager-user-guide.

ameyaagashe avatar ameyaagashe commented on September 26, 2024

@JimbroAmazon The example you have provided is for the task-arn AWS-RunShellScript, do you an example for AWS-RunPatchBaseline? If yes then kindly suggest. Thanks in advance.

from aws-systems-manager-user-guide.

mark-amzn avatar mark-amzn commented on September 26, 2024

@ameyaagashe

Try this format:

aws ssm register-task-with-maintenance-window --window-id mw-00897dfab9EXAMPLE --targets "Key=WindowTargetIds,Values=ff3ef102-eb72-4b56-ad8f-dcc7cEXAMPLE" --task-arn "AWS-RunPatchBaseline" --task-type "RUN_COMMAND" --max-concurrency 2 --max-errors 1 --priority 1 --task-invocation-parameters "RunCommand={Parameters={Operation=Install}}"

Note that this is using --task-invocation-parameters, not --task-parameters. I've also omitted --service-role-arn because I'm letting the command use the service-linked role, but you can of course specify a different role as you did in your examples.

We're working on getting the walkthrough updated later this week.

from aws-systems-manager-user-guide.

ameyaagashe avatar ameyaagashe commented on September 26, 2024

@mark-amzn Thanks for that. The command work and it produces no output. However, I do not see any task associated with the maintenance window though.

from aws-systems-manager-user-guide.

mark-amzn avatar mark-amzn commented on September 26, 2024

@ameyaagashe

I've verified again that the command format just above with --task-invocation-parameters works, running from both my Windows and Linux local machines.

Are you using a third-party tool like GitBash to run commands? I noticed this in your earlier example: --window-id $grpa_maint_window. If so, there may be an issue with your setup there that we can't help with.

If you continue to have issues, you may want to contact AWS Support or post your issue in the Systems Manager Developer Forum.

-Mark

from aws-systems-manager-user-guide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.