aws api 网关 api 密钥访问

aws api gateway api key access

我已经部署了 AWS api网关 -> lambda 集成。

api网关有一个 POST 方法需要 api_key。

我在 X-API-Key 键和 x-api-key 下的请求 headers 中添加了 api 键,每次我仍然得到:

{
    "message": "Forbidden"
}

我 运行 没有想法,绝对没有拼写错误,密钥也被启用为 HEADER 源。

有谁知道我可能缺少什么才能正确验证请求?

我是这样调用它的:

curl --location --request POST 'https://my-endpoint/resource' \
--header 'X-Api-Key: mykey'

干杯

对于任何来这里得到这个答案的人来说,API 需要有一个 usage plan 才能验证 api-key。

失败,因为没有使用计划。

有用的清单:

  • Api 密钥已创建
  • Api 使用计划已创建
  • Api 阶段已创建
  • Api 使用计划与 api 阶段相关
  • Api 使用计划与 api 密钥关联
  • Api 密钥在 http header x-api-key
  • 中发送