1
1
AWSTemplateFormatVersion : 2010-09-09
2
2
Transform : AWS::Serverless-2016-10-31
3
3
Resources :
4
- QuickstartAPI :
5
- Type : AWS::Serverless::Api
6
- Properties :
7
- Name : !Sub
8
- - ${ResourceName} From Stack ${StackTagName} Environment ${EnvironmentTagName}
9
- - ResourceName : QuickstartAPI
10
- StageName : !Ref EnvironmentAPIGatewayStageName
11
- DefinitionBody :
12
- swagger : ' 2.0'
13
- info : {}
14
- paths :
15
- /items :
16
- get :
17
- x-amazon-apigateway-integration :
18
- httpMethod : POST
19
- type : aws_proxy
20
- uri : !Sub arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${getItems.Arn}/invocations
21
- responses : {}
22
- /newItem :
23
- post :
24
- x-amazon-apigateway-integration :
25
- httpMethod : POST
26
- type : aws_proxy
27
- uri : !Sub arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${newItem.Arn}/invocations
28
- responses : {}
29
- EndpointConfiguration : REGIONAL
30
- TracingEnabled : true
31
- Cors :
32
- AllowHeaders : ' '' Authorization,Content-Type'' '
33
- AllowOrigin : ' '' *'' '
34
4
getItems :
35
5
Type : AWS::Serverless::Function
36
6
Properties :
@@ -49,12 +19,12 @@ Resources:
49
19
- DynamoDBCrudPolicy :
50
20
TableName : !Ref Items
51
21
Events :
52
- QuickstartAPIGETitems :
22
+ QuickstartApiGETitems :
53
23
Type : Api
54
24
Properties :
55
25
Path : /items
56
26
Method : GET
57
- RestApiId : !Ref QuickstartAPI
27
+ RestApiId : !Ref QuickstartApi
58
28
Environment :
59
29
Variables :
60
30
TABLE_NAME : !Ref Items
@@ -77,12 +47,12 @@ Resources:
77
47
- DynamoDBCrudPolicy :
78
48
TableName : !Ref Items
79
49
Events :
80
- QuickstartAPIPOSTnewItem :
50
+ QuickstartApiPOSTnewItem :
81
51
Type : Api
82
52
Properties :
83
53
Path : /newItem
84
54
Method : POST
85
- RestApiId : !Ref QuickstartAPI
55
+ RestApiId : !Ref QuickstartApi
86
56
Environment :
87
57
Variables :
88
58
TABLE_NAME : !Ref Items
@@ -132,6 +102,36 @@ Resources:
132
102
BucketName : !Sub ${AWS::StackName}-frontend-${AWS::AccountId}
133
103
WebsiteConfiguration :
134
104
IndexDocument : index.html
105
+ QuickstartApi :
106
+ Type : AWS::Serverless::Api
107
+ Properties :
108
+ Name : !Sub
109
+ - ${ResourceName} From Stack ${StackTagName} Environment ${EnvironmentTagName}
110
+ - ResourceName : QuickstartApi
111
+ StageName : !Ref EnvironmentAPIGatewayStageName
112
+ DefinitionBody :
113
+ swagger : ' 2.0'
114
+ info : {}
115
+ paths :
116
+ /items :
117
+ get :
118
+ x-amazon-apigateway-integration :
119
+ httpMethod : POST
120
+ type : aws_proxy
121
+ uri : !Sub arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${getItems.Arn}/invocations
122
+ responses : {}
123
+ /newItem :
124
+ post :
125
+ x-amazon-apigateway-integration :
126
+ httpMethod : POST
127
+ type : aws_proxy
128
+ uri : !Sub arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${newItem.Arn}/invocations
129
+ responses : {}
130
+ EndpointConfiguration : REGIONAL
131
+ TracingEnabled : true
132
+ Cors :
133
+ AllowHeaders : ' '' Authorization,Content-Type'' '
134
+ AllowOrigin : ' '' *'' '
135
135
Parameters :
136
136
StackTagName :
137
137
Type : String
0 commit comments