-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
79 lines (74 loc) · 2.25 KB
/
template.yaml
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Serverless Swift API
Resources:
RestApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
ApiFunction:
Type: AWS::Serverless::Function
Properties:
Handler: bootstrap
Runtime: provided.al2
CodeUri: ./bin/
MemorySize: 128
Timeout: 30
Architectures:
- arm64
Events:
RootEvent:
Type: Api
Properties:
RestApiId: !Ref RestApi
Path: /
Method: any
Auth:
ApiKeyRequired: true
ProxyEvent:
Type: Api
Properties:
RestApiId: !Ref RestApi
Path: /{proxy+}
Method: any
Auth:
ApiKeyRequired: true
ApiKey:
Type: AWS::ApiGateway::ApiKey
DependsOn:
- RestApi
- RestApiProdStage
- ApiFunction
Properties:
Name: !Join ["", [{"Ref": "AWS::StackName"}, "-apikey-", !Select [2, !Split ['/', !Ref AWS::StackId]]]]
Description: "API Key"
Enabled: true
StageKeys:
- RestApiId: !Ref RestApi
StageName: Prod
ApiUsagePlan:
Type: AWS::ApiGateway::UsagePlan
DependsOn:
- RestApi
- RestApiProdStage
- ApiFunction
Properties:
ApiStages:
- ApiId: !Ref RestApi
Stage: Prod
Description: !Join [" ", [{"Ref": "AWS::StackName"}, "usage plan"]]
Quota:
Limit: 1000
Period: DAY
UsagePlanName: !Join ["", [{"Ref": "AWS::StackName"}, "-usage-plan"]]
ApiUsagePlanKey:
Type: AWS::ApiGateway::UsagePlanKey
DependsOn:
- RestApi
- RestApiProdStage
- ApiKey
- ApiUsagePlan
Properties:
KeyId: !Ref ApiKey
KeyType: API_KEY
UsagePlanId: !Ref ApiUsagePlan