-
Notifications
You must be signed in to change notification settings - Fork 0
/
infrastructure.yaml
96 lines (96 loc) · 2.69 KB
/
infrastructure.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
92
93
94
95
96
AWSTemplateFormatVersion: '2010-09-09'
Description: Daily reading infrastructure
Transform: AWS::Serverless-2016-10-31
Parameters:
pDomainNameRoot:
Type: String
pDomainNameEmail:
Type: String
pDomainNameApi:
Type: String
pEmailSubject:
Type: String
pHostedZoneId:
Type: String
Resources:
# API Gateway
Certificate:
Type: AWS::CertificateManager::Certificate
Properties:
DomainName: !Ref pDomainNameApi
DomainValidationOptions:
- DomainName: !Ref pDomainNameApi
HostedZoneId: !Ref pHostedZoneId
ValidationMethod: DNS
Tags:
- Key: application:group
Value: reading
- Key: application:subgroup
Value: infrastructure
- Key: application:owner
Value: heeki
Domain:
Type: AWS::ApiGateway::DomainName
Properties:
DomainName: !Ref pDomainNameApi
EndpointConfiguration:
Types:
- REGIONAL
RegionalCertificateArn: !Ref Certificate
Tags:
- Key: application:group
Value: reading
- Key: application:subgroup
Value: api
- Key: application:owner
Value: heeki
DomainRecordSet:
Type: AWS::Route53::RecordSet
Properties:
HostedZoneId: !Ref pHostedZoneId
Name: !Ref pDomainNameApi
Type: A
AliasTarget:
HostedZoneId: !GetAtt Domain.RegionalHostedZoneId
DNSName: !GetAtt Domain.RegionalDomainName
# SES
EmailConfiguration:
Type: AWS::SES::ConfigurationSet
Properties:
DeliveryOptions:
TlsPolicy: REQUIRE
ReputationOptions:
ReputationMetricsEnabled: true
SendingOptions:
SendingEnabled: true
SuppressionOptions:
SuppressedReasons:
- BOUNCE
- COMPLAINT
VdmOptions:
DashboardOptions:
EngagementMetrics: ENABLED
GuardianOptions:
OptimizedSharedDelivery: ENABLED
EmailIdentity:
Type: AWS::SES::EmailIdentity
Properties:
ConfigurationSetAttributes:
ConfigurationSetName: !Ref EmailConfiguration
EmailIdentity: !Ref pDomainNameRoot
MailFromAttributes:
BehaviorOnMxFailure: USE_DEFAULT_VALUE
MailFromDomain: !Ref pDomainNameEmail
EmailTemplate:
Type: AWS::SES::Template
Properties:
Template:
SubjectPart: !Sub "${pEmailSubject} for {{date}}"
HtmlPart: "<p>{{reading}}</p><br><p><a href='{{complete}}'>Click here when you've completed today's reading</a>.</p><p>To unsubscribe, click <a href='{{unsubscribe}}'>here</a>.<p>"
Outputs:
outCertificateArn:
Value: !Ref Certificate
outEmailIdentity:
Value: !Ref EmailIdentity
outEmailTemplate:
Value: !Ref EmailTemplate