在API网关中使用AWS CLI为特定阶段创建使用计划时出错



我想为关联的API阶段创建一个使用计划。我现在正在使用以下命令:

aws apigateway create-usage-plan --name "New Usage Plan1"  --api-stages  '[{ "apiId": "abcde12345", "stage":"test-stage", "throttle": {"Test from CLI": { "burstLimit": 200, "rateLimit": 100}}}]' --throttle burstLimit=200,rateLimit=100 --quota limit=500,offset=0,period=MONTH

其中abcde12345是我的Rest API ID,test-stage是我希望与之关联的阶段,Test from CLI是我成功创建的API Key。

我得到以下错误:

An error occurred (BadRequestException) when calling the CreateUsagePlan operation: Invalid method {resourcePath: Test from CLI,method: } specified

我尝试用API密钥abc123的ID替换密钥Test from CLI,但也会抛出相同的错误:

An error occurred (BadRequestException) when calling the CreateUsagePlan operation: Invalid method {resourcePath: abc123,method: } specified

我查看了这个以创建这个使用计划。我在这个命令中哪里出错了?

从CLI测试是我的API密钥的名称

这不是KeyName1所指的。这是在API中代表你的方法的键名,例如以下默认示例中的/pets/GET:

"apiStages": [
{
"apiId": "ym7ggv1kh6",
"stage": "test",
"throttle": {
"/pets/GET": {
"burstLimit": 33,
"rateLimit": 33.0
}
}
}
],

相关内容

最新更新