【发布时间】:2018-11-22 04:45:07
【问题描述】:
命令行部署后如何找到API网关的URL地址?
我使用类似于下面的脚本来部署我的 API 网关和授权器,并且部署良好。
https://github.com/floodfx/aws-lambda-proxy-using-sam-local/blob/master/deploy.sh
我正在想办法在部署后从命令行获取 API 网关的地址
API 网关已创建,我可以看到堆栈:
aws cloudformation describe-stacks
"Stacks": [
{
"StackId": "arn:aws:cloudformation:us-east-1:761861444952:stack/mygateway912/72100720-6e67-11e8-93e9-500c28604c4a",
"Description": "An example serverless \"Hello World2 \" application with a custom authorizer.",
"Tags": [],
"CreationTime": "2018-06-12T17:38:40.946Z",
"Capabilities": [
"CAPABILITY_IAM"
],
"StackName": "mygateway912",
"NotificationARNs": [],
"StackStatus": "CREATE_COMPLETE",
"DisableRollback": false,
"ChangeSetId": "arn:aws:cloudformation:us-east-1:76161444952:changeSet/awscli-cloudformation-package-deploy-1528825120/352f7c7a-2870-44ea-9e7f-40d16c0015df",
"LastUpdatedTime": "2018-06-12T17:38:46.411Z"
}
我必须有一个简单的命令才能得到这个。
【问题讨论】:
-
可以使用cloudformation模板的输出参数导出资源引用
-
我刚看到.. 也许它会帮助别人我会添加一个例子
-
输出:ExampleAPIUrl:值:!Sub "https://${ExampleAPI}.execute-api.${AWS::Region}.amazonaws.com/${StageName}/"跨度>
标签: amazon-web-services aws-api-gateway sam