-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yml
59 lines (51 loc) · 1.27 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
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Parameters:
StageName:
Default: dev
Type: String
Resources:
MyApi:
Type: AWS::Serverless::Api
Properties:
StageName:
Ref: StageName
Cors:
AllowMethods: "'*'"
AllowHeaders: "'*'"
AllowOrigin: "'*'"
Auth:
DefaultAuthorizer: MyLambdaTokenAuthorizer
AddDefaultAuthorizerToCorsPreflight: False
Authorizers:
MyLambdaTokenAuthorizer:
FunctionArn: !GetAtt Auth0ValidatorFunction.Arn
HelloFunction:
Type: AWS::Serverless::Function
Properties:
Handler: hello.handler
Runtime: nodejs20.x
CodeUri: ./hello
Events:
HelloAPI:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /hello
Method: GET
Auth0ValidatorFunction:
Type: AWS::Serverless::Function
Properties:
Handler: auth0Validator.handler
Runtime: nodejs20.x
CodeUri: ./auth0
Outputs:
Region:
Description: Region
Value: !Ref AWS::Region
ApiId:
Description: API ID
Value: !Ref MyApi
ApiUrl:
Description: API endpoint URL
Value: !Sub https://${MyApi}.execute-api.${AWS::Region}.amazonaws.com/${StageName}