如何通过aws中的cli传递admin-update-user-attributes操作的json值?

Che*_*rry 3 amazon-web-services amazon-cognito

考虑这个例子:

aws cognito-idp admin-update-user-attributes --user-pool-id myUserPollId
--username myUser 
--user-attributes [{"Name": "custom:roles","Value": "ROLE1,ROLE2"}] --region us-east-1
Run Code Online (Sandbox Code Playgroud)

这给我带来了错误:

Invalid JSON:
    [{Name:
Run Code Online (Sandbox Code Playgroud)

age*_*420 5

  1. 您始终可以尝试使用简写语法:

    --user-attributes 名称=“自定义:角色”,值=“ROLE1,ROLE2”
  2. 如果您确实想使用 JSON 语法,请尝试以下操作:

    --user-attributes '[{“名称”:“自定义:角色”,“值”:“ROLE1,ROLE2”}]'
    • 确保用户属性列表用单引号引起来