-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtemplate.yml
183 lines (183 loc) · 5.3 KB
/
template.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
AWSTemplateFormatVersion: 2010-09-09
Description: The AWS CloudFormation template for this Serverless application
Resources:
ServerlessDeploymentBucket:
Type: 'AWS::S3::Bucket'
AppLogGroup:
Type: 'AWS::Logs::LogGroup'
Properties:
LogGroupName: /aws/lambda/my-express-application-dev-app
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
- my-express-application
- 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/my-express-application-dev-app:*
- Effect: Allow
Action:
- 'logs:PutLogEvents'
Resource:
- !Sub >-
arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/my-express-application-dev-app:*:*
Path: /
RoleName: !Join
- '-'
- - my-express-application
- dev
- us-west-2
- lambdaRole
AppLambdaFunction:
Type: 'AWS::Lambda::Function'
Properties:
Code:
S3Bucket: !Ref ServerlessDeploymentBucket
S3Key: >-
serverless/my-express-application/dev/1538578697137-2018-10-03T14:58:17.137Z/my-express-application.zip
FunctionName: my-express-application-dev-app
Handler: index.aws
MemorySize: 1024
Role: !GetAtt
- IamRoleLambdaExecution
- Arn
Runtime: nodejs8.10
Timeout: 6
DependsOn:
- AppLogGroup
- IamRoleLambdaExecution
AppLambdaVersionRcDugvVVkDHsDtMerdeRdHf5HyTNLvpx2ZiAe3rw874:
Type: 'AWS::Lambda::Version'
DeletionPolicy: Retain
Properties:
FunctionName: !Ref AppLambdaFunction
CodeSha256: 7QGuC9HFwAn7Y9d4/pV8hzjkfzNP/6M3OD1dnXdeVqU=
ApiGatewayRestApi:
Type: 'AWS::ApiGateway::RestApi'
Properties:
Name: dev-my-express-application
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
- AppLambdaFunction
- 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
- AppLambdaFunction
- Arn
- /invocations
MethodResponses: []
ApiGatewayDeployment1538578697528:
Type: 'AWS::ApiGateway::Deployment'
Properties:
RestApiId: !Ref ApiGatewayRestApi
StageName: dev
DependsOn:
- ApiGatewayMethodAny
- ApiGatewayMethodProxyVarAny
AppLambdaPermissionApiGateway:
Type: 'AWS::Lambda::Permission'
Properties:
FunctionName: !GetAtt
- AppLambdaFunction
- Arn
Action: 'lambda:InvokeFunction'
Principal: !Join
- ''
- - apigateway.
- !Ref 'AWS::URLSuffix'
SourceArn: !Join
- ''
- - 'arn:'
- !Ref 'AWS::Partition'
- ':execute-api:'
- !Ref 'AWS::Region'
- ':'
- !Ref 'AWS::AccountId'
- ':'
- !Ref ApiGatewayRestApi
- /*/*
Outputs:
ServerlessDeploymentBucketName:
Value: !Ref ServerlessDeploymentBucket
AppLambdaFunctionQualifiedArn:
Description: Current Lambda function version
Value: !Ref AppLambdaVersionRcDugvVVkDHsDtMerdeRdHf5HyTNLvpx2ZiAe3rw874
ServiceEndpoint:
Description: URL of the service endpoint
Value: !Join
- ''
- - 'https://'
- !Ref ApiGatewayRestApi
- .execute-api.us-west-2.
- !Ref 'AWS::URLSuffix'
- /dev