-
Notifications
You must be signed in to change notification settings - Fork 3
/
template.yaml
91 lines (73 loc) · 1.99 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
80
81
82
83
84
85
86
87
88
89
90
91
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
Go Path Router
This project allows you to setup custom domains for your golang packages without paying for infrasture, or paying a minimal amount.
Globals:
Function:
Timeout: 5
Parameters:
DomainName:
Type: String
HostedZoneName:
Type: String
CertificateArn:
Type: String
CodePath:
Type: String
HostedZoneId:
Type: String
Default: Z2FDTNDATAQYW2
Resources:
RouterFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: go-path-router/
Handler: go-path-router
Runtime: go1.x
Events:
Root:
Type: Api
Properties:
Path: /
Method: ANY
CatchAll:
Type: Api
Properties:
Path: /{all+}
Method: ANY
Environment:
Variables:
DOMAIN: !Ref DomainName
CODEPATH: !Ref CodePath
APIDomainName:
Type: AWS::ApiGateway::DomainName
Properties:
CertificateArn: !Ref CertificateArn
DomainName: !Ref DomainName
APIBasePathMapping:
Type: AWS::ApiGateway::BasePathMapping
Properties:
DomainName: !Ref APIDomainName
RestApiId: !Ref ServerlessRestApi
Stage: Prod
APIDomain:
Type: AWS::Route53::RecordSetGroup
Properties:
HostedZoneName: !Ref HostedZoneName
RecordSets:
- Name: !Sub ${DomainName}.
Type: A
AliasTarget:
DNSName: !GetAtt APIDomainName.DistributionDomainName
HostedZoneId: Z2FDTNDATAQYW2 # static ID for CloudFront aliases
Outputs:
RouterAPI:
Description: "Go Path Router API"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
RouterFunction:
Description: "Go Path Router ARN"
Value: !GetAtt RouterFunction.Arn
RouterIamRole:
Description: "Implicit IAM Role created for Go Path Router Function"
Value: !GetAtt RouterFunction.Arn