如何在 AWS 中找到 API 网关的端点 URL
How to find endpoint URL of an API Gateway in AWS
我在 AWS 中制作了几个 API 网关。
此时,我想卷曲到每个 API 网关的端点以开始测试。但是,我找不到端点 URL:
例如,通过 CLI,我 运行:
aws --profile dev apigateway get-rest-apis --output json
我得到:(没有端点URL)
"apiKeySource": "HEADER",
"description": "API one",
"endpointConfiguration": {
"types": [
"REGIONAL"
]
},
"createdDate": 1570655986,
"policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Effect\\":\\"Allow\\",\\"Principal\\":\\"*\\",\\"Action\\":\\"execute-api:Invoke\\",\\"Resource\\":\\"arn:aws:FOOBAR\/*\/*\/*\\",\\"Condition\\":{\\"IpAddress\\":{\\"aws:SourceIp\\":[\\"0.0.0.0\/0\\""]}}}]}",
"id": "foobar",
"name": "foobar"
}
您必须部署 API。
然后您会在部署阶段找到 https 地址。
或者您可以使用自定义域名
我在 AWS 中制作了几个 API 网关。
此时,我想卷曲到每个 API 网关的端点以开始测试。但是,我找不到端点 URL:
例如,通过 CLI,我 运行:
aws --profile dev apigateway get-rest-apis --output json
我得到:(没有端点URL)
"apiKeySource": "HEADER",
"description": "API one",
"endpointConfiguration": {
"types": [
"REGIONAL"
]
},
"createdDate": 1570655986,
"policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Effect\\":\\"Allow\\",\\"Principal\\":\\"*\\",\\"Action\\":\\"execute-api:Invoke\\",\\"Resource\\":\\"arn:aws:FOOBAR\/*\/*\/*\\",\\"Condition\\":{\\"IpAddress\\":{\\"aws:SourceIp\\":[\\"0.0.0.0\/0\\""]}}}]}",
"id": "foobar",
"name": "foobar"
}
您必须部署 API。 然后您会在部署阶段找到 https 地址。 或者您可以使用自定义域名