How to assign more than one user via AWS CLI to a group?

326 Views Asked by At

Trying to assign multiple users to groups using json. Created a json file, and runnign the following: aws iam add-user-to-group --cli-input-json file://c:\awscli\json\iam-add-user-to-group.json

Json content is:

{ "GroupName": "devops", "UserName": ["devop1", "devop2"] }

and getting an error: Parameter validation failed: Invalid type for parameter UserName, value: ['devop1', 'devop2'], type: <class 'list'>, valid types: <class 'str'>

With the community help, changed incorrect json, and realized - there is no way to run any bulk add/remove scripts in AWS CLI.

1

There are 1 best solutions below

1
On

That's not a valid JSON. This is:

{
    "GroupName": "devops",
    "UserName": [
        "devop1",
        "devop2"
    ]
}