如何从命令行部署后找到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"
}
必须有一个简单的命令我不知道这个。
答案 0 :(得分:6)
我有时间正确回答。拥有API网关定义:
Resources:
...
ServerlessRestApi:
Type: AWS::Serverless::Api
DeletionPolicy: "Retain"
Properties:
StageName: Prod
...
你可以输出
Outputs:
ProdDataEndpoint:
Description: "API Prod stage endpoint"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
答案 1 :(得分:4)
我有单独的create table #temp1(cid int,cvid int, date1 date, clone int)
insert into #temp1
values ('43','1001','1/1/2015',null),
('43','1002','2/1/2015',1001),
('43','1003','3/1/2015',null),
('43','1004','4/1/2015',1003)
create table #person(cid int)
insert into #person values(43),(44),(45)
select top 1 with ties
t.cid
,t.cvid
,clone = (select max(t2.cvid) from #temp1 t2 )
,t.date1
from #temp1 t
order by row_number() over (partition by cid order by date1)
drop table #temp1,#person
和AWS::ApiGateway::RestApi
资源,所以我的输出看起来有点不同,因为我没有/不能对阶段名称进行硬编码:
AWS::ApiGateway::Stage