【问题标题】:AWS CLI unable to add permissions to API Gateway Stage variablesAWS CLI 无法向 API Gateway 阶段变量添加权限
【发布时间】:2020-12-28 22:11:57
【问题描述】:

我一直在尝试使用 AWS CLI 将阶段变量添加到我的 API Gateway Lambda 函数中, 我试图传递的命令是:

aws lambda add-permission --function-name "arn:aws:lambda:me-south-1:xxxxxxxxxxxx:function:SignInUser:ifapos" --source-arn "arn:aws:execute-api:me-south-1:xxxxxxxxxxxx:xxxxxxxxxxxx/*/GET/users" --principal apigateway.amazonaws.com --statement-id xxxxxxxxxxxxxxxxxxx --action lambda:InvokeFunction —region me-south-1

但我无法添加权限,而是获得以下任一权限:

Invalid choice: 'add-permission\xa0', maybe you meant:

  * add-permission

或:

aws: error: argument operation: Invalid choice, valid choices are:

我该如何解决这个问题?

【问题讨论】:

    标签: amazon-web-services aws-api-gateway aws-cli


    【解决方案1】:

    你的命令中有一个non-breaking space(错误也告诉你)。

    仔细看看:

    Invalid choice: 'add-permission\xa0' [...]
    

    重要的是\xa0。这是导致此问题的“特殊”字符。

    只需删除它,命令就会按预期工作。

    【讨论】:

      猜你喜欢
      • 2017-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-29
      • 1970-01-01
      • 2017-02-14
      相关资源
      最近更新 更多