-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathserverless.yml
89 lines (83 loc) · 2.04 KB
/
serverless.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
service: test-layers
provider:
name: aws
region: us-east-1
runtime: nodejs12.x
deploymentBucket:
name: testbucket
functions:
hello:
handler: handler.hello
layers:
- { Ref: TestLambdaLayer }
events:
- schedule: "cron(0 * * * ? *)"
- http:
path: "/"
method: "get"
integration: "lambda-proxy"
authorizer: authorizerFunc
authorizerFunc:
handler: handler.authorizerFunc
layers:
- { Ref: TestLambdaLayer }
hello1:
handler: handler.hello
events:
- http:
path: "/1"
method: "get"
authorizer:
type: COGNITO_USER_POOLS
authorizerId:
Ref: CognitoAuthorizer
layers:
test:
path: layer
resources:
Resources:
ApiGatewayRestApi:
Type: "AWS::ApiGateway::RestApi"
Properties:
Name: "${self:provider.stage}-${self:service}"
GatewayResponseDefault400:
Type: "AWS::ApiGateway::GatewayResponse"
Properties:
RestApiId:
Ref: "ApiGatewayRestApi"
ResponseType: "DEFAULT_4XX"
ResponseTemplates:
application/json: '{"errors":[{"message":"Custom text."}]}'
UserPool:
Type: "AWS::Cognito::UserPool"
Properties:
UserPoolName: p1
UserPoolClient:
Type: "AWS::Cognito::UserPoolClient"
Properties:
UserPoolId:
Ref: UserPool
ClientName: c1
CognitoAuthorizer:
Type: AWS::ApiGateway::Authorizer
Properties:
IdentitySource: method.request.header.Authorization
Name: CognitoAuthorizer
RestApiId:
Ref: ApiGatewayRestApi
Type: COGNITO_USER_POOLS
ProviderARNs:
- !Sub arn:aws:cognito-idp:#{AWS::Region}:#{AWS::AccountId}:userpool/#{UserPool}
Outputs:
RestApiId:
Value:
Ref: ApiGatewayRestApi
Export:
Name: "${self:provider.stage}-${self:service}ServiceEndpoint"
plugins:
- serverless-localstack
- serverless-pseudo-parameters
custom:
localstack:
stages:
- local