1
+ {
2
+ "Resources" : {
3
+ "MyApi" : {
4
+ "Type" : " AWS::ApiGateway::RestApi" ,
5
+ "Properties" : {
6
+ "Body" : {
7
+ "info" : {
8
+ "title" : {
9
+ "Fn::Sub" : " ${AWS::StackName}-Api"
10
+ }
11
+ },
12
+ "paths" : {
13
+ "$default" : {
14
+ "x-amazon-apigateway-any-method" : {
15
+ "x-amazon-apigateway-integration" : {
16
+ "httpMethod" : " POST" ,
17
+ "type" : " aws_proxy" ,
18
+ "uri" : {
19
+ "Fn::Sub" : " arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${HttpApiFunction.Arn}/invocations"
20
+ },
21
+ "payloadFormatVersion" : " 2.0"
22
+ },
23
+ "isDefaultRoute" : true ,
24
+ "security" : [
25
+ {
26
+ "LambdaAuthorizer" : []
27
+ }
28
+ ],
29
+ "responses" : {}
30
+ }
31
+ },
32
+ "/" : {
33
+ "any" : {
34
+ "x-amazon-apigateway-integration" : {
35
+ "httpMethod" : " ANY" ,
36
+ "type" : " http_proxy" ,
37
+ "uri" : " https://www.alphavantage.co/" ,
38
+ "payloadFormatVersion" : " 1.0"
39
+ },
40
+ "security" : [
41
+ {
42
+ "LambdaAuthorizer" : []
43
+ }
44
+ ]
45
+ },
46
+ "get" : {
47
+ "x-amazon-apigateway-integration" : {
48
+ "httpMethod" : " POST" ,
49
+ "type" : " aws_proxy" ,
50
+ "uri" : {
51
+ "Fn::Sub" : " arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${HttpApiFunction.Arn}/invocations"
52
+ },
53
+ "payloadFormatVersion" : " 2.0"
54
+ },
55
+ "security" : [
56
+ {
57
+ "LambdaAuthorizer" : []
58
+ }
59
+ ],
60
+ "responses" : {}
61
+ }
62
+ }
63
+ },
64
+ "openapi" : " 3.0" ,
65
+ "components" : {
66
+ "securitySchemes" : {
67
+ "LambdaAuthorizer" : {
68
+ "in" : " header" ,
69
+ "type" : " apiKey" ,
70
+ "name" : " Unused" ,
71
+ "x-amazon-apigateway-authorizer" : {
72
+ "type" : " request" ,
73
+ "identitySource" : " method.request.header.Authorization" ,
74
+ "authorizerUri" : {
75
+ "Fn::Sub" : [
76
+ " arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${__FunctionArn__}/invocations" ,
77
+ {
78
+ "__FunctionArn__" : null
79
+ }
80
+ ]
81
+ }
82
+ },
83
+ "x-amazon-apigateway-authtype" : " custom"
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ },
90
+ "HttpApiFunction" : {
91
+ "Type" : " AWS::Lambda::Function" ,
92
+ "Properties" : {
93
+ "Handler" : " index.restapi" ,
94
+ "Code" : {
95
+ "S3Bucket" : " sam-demo-bucket" ,
96
+ "S3Key" : " todo_list.zip"
97
+ },
98
+ "Role" : {
99
+ "Fn::GetAtt" : [
100
+ " HttpApiFunctionRole" ,
101
+ " Arn"
102
+ ]
103
+ },
104
+ "Runtime" : " python3.7" ,
105
+ "Tags" : [
106
+ {
107
+ "Value" : " SAM" ,
108
+ "Key" : " lambda:createdBy"
109
+ }
110
+ ]
111
+ }
112
+ },
113
+ "HttpApiFunctionSimpleCasePermission" : {
114
+ "Type" : " AWS::Lambda::Permission" ,
115
+ "Properties" : {
116
+ "Action" : " lambda:InvokeFunction" ,
117
+ "Principal" : " apigateway.amazonaws.com" ,
118
+ "FunctionName" : {
119
+ "Ref" : " HttpApiFunction"
120
+ },
121
+ "SourceArn" : {
122
+ "Fn::Sub" : [
123
+ " arn:${AWS::Partition}:execute-api:${AWS::Region}:${AWS::AccountId}:${__ApiId__}/${__Stage__}/*" ,
124
+ {
125
+ "__Stage__" : " *" ,
126
+ "__ApiId__" : {
127
+ "Ref" : " MyApi"
128
+ }
129
+ }
130
+ ]
131
+ }
132
+ }
133
+ },
134
+ "HttpApiFunctionRole" : {
135
+ "Type" : " AWS::IAM::Role" ,
136
+ "Properties" : {
137
+ "AssumeRolePolicyDocument" : {
138
+ "Version" : " 2012-10-17" ,
139
+ "Statement" : [
140
+ {
141
+ "Action" : [
142
+ " sts:AssumeRole"
143
+ ],
144
+ "Effect" : " Allow" ,
145
+ "Principal" : {
146
+ "Service" : [
147
+ " lambda.amazonaws.com"
148
+ ]
149
+ }
150
+ }
151
+ ]
152
+ },
153
+ "ManagedPolicyArns" : [
154
+ " arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
155
+ ],
156
+ "Tags" : [
157
+ {
158
+ "Value" : " SAM" ,
159
+ "Key" : " lambda:createdBy"
160
+ }
161
+ ]
162
+ }
163
+ },
164
+ "MyApiStage" : {
165
+ "Type" : " AWS::ApiGateway::Stage" ,
166
+ "Properties" : {
167
+ "DeploymentId" : {
168
+ "Ref" : " MyApiDeployment69a80e7382"
169
+ },
170
+ "RestApiId" : {
171
+ "Ref" : " MyApi"
172
+ },
173
+ "StageName" : {
174
+ "Ref" : " Stage"
175
+ }
176
+ }
177
+ },
178
+ "MyApiDeployment69a80e7382" : {
179
+ "Type" : " AWS::ApiGateway::Deployment" ,
180
+ "Properties" : {
181
+ "RestApiId" : {
182
+ "Ref" : " MyApi"
183
+ },
184
+ "Description" : " RestApi deployment id: 69a80e738222706cff079ab8d7f348c0d89eddab" ,
185
+ "StageName" : " Stage"
186
+ }
187
+ }
188
+ }
189
+ }
0 commit comments