forked from knofler/lambda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lambda.yml
187 lines (187 loc) · 5.34 KB
/
Lambda.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
AWSTemplateFormatVersion: 2010-09-09
Description: The AWS CloudFormation template for this Serverless application
Resources:
ServerlessDeploymentBucket:
Type: 'AWS::S3::Bucket'
Properties:
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
ApiLogGroup:
Type: 'AWS::Logs::LogGroup'
Properties:
LogGroupName: /aws/lambda/serverless-dev-api
IamRoleLambdaExecution:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- 'sts:AssumeRole'
Policies:
- PolicyName: !Join
- '-'
- - dev
- serverless
- lambda
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- 'logs:CreateLogStream'
Resource:
- !Sub >-
arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/serverless-dev*:*
- Effect: Allow
Action:
- 'logs:PutLogEvents'
Resource:
- !Sub >-
arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/serverless-dev*:*:*
Path: /
RoleName: !Join
- '-'
- - serverless
- dev
- !Ref 'AWS::Region'
- lambdaRole
ApiLambdaFunction:
Type: 'AWS::Lambda::Function'
Properties:
Code:
S3Bucket: !Ref ServerlessDeploymentBucket
S3Key: >-
serverless/serverless/dev/1563431520776-2019-07-18T06:32:00.776Z/serverless.zip
FunctionName: serverless-dev-api
Handler: src/api/index.handler
MemorySize: 1024
Role: !GetAtt
- IamRoleLambdaExecution
- Arn
Runtime: nodejs8.10
Timeout: 6
DependsOn:
- ApiLogGroup
- IamRoleLambdaExecution
ApiLambdaVersionU1hErBi0dqp4cfOUi8lpjUQUjT2m7DN2lVb3qQRtVc:
Type: 'AWS::Lambda::Version'
DeletionPolicy: Retain
Properties:
FunctionName: !Ref ApiLambdaFunction
CodeSha256: NY1zN7R23UNEp+UsVcvY+HsTxvA4r8pxGUhJhiZCFH8=
ApiGatewayRestApi:
Type: 'AWS::ApiGateway::RestApi'
Properties:
Name: dev-serverless
EndpointConfiguration:
Types:
- EDGE
ApiGatewayResourceProxyVar:
Type: 'AWS::ApiGateway::Resource'
Properties:
ParentId: !GetAtt
- ApiGatewayRestApi
- RootResourceId
PathPart: '{proxy+}'
RestApiId: !Ref ApiGatewayRestApi
ApiGatewayMethodAny:
Type: 'AWS::ApiGateway::Method'
Properties:
HttpMethod: ANY
RequestParameters: {}
ResourceId: !GetAtt
- ApiGatewayRestApi
- RootResourceId
RestApiId: !Ref ApiGatewayRestApi
ApiKeyRequired: false
AuthorizationType: NONE
Integration:
IntegrationHttpMethod: POST
Type: AWS_PROXY
Uri: !Join
- ''
- - 'arn:'
- !Ref 'AWS::Partition'
- ':apigateway:'
- !Ref 'AWS::Region'
- ':lambda:path/2015-03-31/functions/'
- !GetAtt
- ApiLambdaFunction
- Arn
- /invocations
MethodResponses: []
ApiGatewayMethodProxyVarAny:
Type: 'AWS::ApiGateway::Method'
Properties:
HttpMethod: ANY
RequestParameters: {}
ResourceId: !Ref ApiGatewayResourceProxyVar
RestApiId: !Ref ApiGatewayRestApi
ApiKeyRequired: false
AuthorizationType: NONE
Integration:
IntegrationHttpMethod: POST
Type: AWS_PROXY
Uri: !Join
- ''
- - 'arn:'
- !Ref 'AWS::Partition'
- ':apigateway:'
- !Ref 'AWS::Region'
- ':lambda:path/2015-03-31/functions/'
- !GetAtt
- ApiLambdaFunction
- Arn
- /invocations
MethodResponses: []
ApiGatewayDeployment1563431500066:
Type: 'AWS::ApiGateway::Deployment'
Properties:
RestApiId: !Ref ApiGatewayRestApi
StageName: dev
DependsOn:
- ApiGatewayMethodAny
- ApiGatewayMethodProxyVarAny
ApiLambdaPermissionApiGateway:
Type: 'AWS::Lambda::Permission'
Properties:
FunctionName: !GetAtt
- ApiLambdaFunction
- Arn
Action: 'lambda:InvokeFunction'
Principal: apigateway.amazonaws.com
SourceArn: !Join
- ''
- - 'arn:'
- !Ref 'AWS::Partition'
- ':execute-api:'
- !Ref 'AWS::Region'
- ':'
- !Ref 'AWS::AccountId'
- ':'
- !Ref ApiGatewayRestApi
- /*/*
Outputs:
ServerlessDeploymentBucketName:
Value: !Ref ServerlessDeploymentBucket
ApiLambdaFunctionQualifiedArn:
Description: Current Lambda function version
Value: !Ref ApiLambdaVersionU1hErBi0dqp4cfOUi8lpjUQUjT2m7DN2lVb3qQRtVc
ServiceEndpoint:
Description: URL of the service endpoint
Value: !Join
- ''
- - 'https://'
- !Ref ApiGatewayRestApi
- .execute-api.
- !Ref 'AWS::Region'
- .
- !Ref 'AWS::URLSuffix'
- /dev