【问题标题】:How to give AWS api gateway stage variable in resource integration uri如何在资源集成uri中赋予AWS api网关阶段变量
【发布时间】:2018-12-12 17:17:34
【问题描述】:

我在 AWS API 网关的每个阶段都创建了一个阶段变量。此变量名称包含后端 api 的主机名。

现在我正在尝试使用带有阶段变量的 aws update-integration 命令更新资源集成 URI。

我的更新集成命令如下:

aws apigateway update-integration --rest-api-id  apiId --resource-id resId --http-method GET --patch-operations op='replace',path='/uri',value='http://${stageVariables.variablename}'

执行上述命令后,我得到:

-bash: http://${stageVariables.variablename}: bad substitution

错误信息。

【问题讨论】:

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


    【解决方案1】:

    为了解决这个问题,我改变了创建 uri 的方法 现在我的 uri 是 http://hostname$\{stageVariables.variablename\} 格式。 并且阶段变量名称包含“Api_Stage_Name\endpoint_uri”形式的相对uri路径

    一个重要的变化是我使用 \ 转义了花括号。

    【讨论】:

      猜你喜欢
      • 2019-11-14
      • 2022-12-22
      • 1970-01-01
      • 2020-03-10
      • 2021-12-14
      • 1970-01-01
      • 2019-12-05
      • 2017-01-24
      • 2020-08-18
      相关资源
      最近更新 更多