@@ -7,9 +7,13 @@ Parameters:
7
7
Type : String
8
8
AllowedValues : ["dev", "prod"]
9
9
AlertSNSArn :
10
- Description : SNS Queue to send alarm alerts to (prod only)
10
+ Description : SNS Queue to send general alarm alerts to (prod only)
11
11
Type : String
12
12
Default : arn:aws:sns:us-east-1:298118738376:infra-monitor-alerts
13
+ PriorityAlertSNSArn :
14
+ Description : SNS Queue to send priority alarm alerts to (prod only)
15
+ Type : String
16
+ Default : arn:aws:sns:us-east-1:298118738376:infra-core-api-priority-alerts
13
17
ApplicationPrefix :
14
18
Type : String
15
19
Description : Application prefix, no ending dash
@@ -24,11 +28,11 @@ Parameters:
24
28
AllowedValues : [true, false]
25
29
SqsLambdaTimeout :
26
30
Description : How long the SQS lambda is permitted to run (in seconds)
27
- Default : 300
31
+ Default : 180
28
32
Type : Number
29
33
SqsMessageTimeout :
30
- Description : MessageVisibilityTimeout for the SQS Lambda queue (should be at least 6xSqsLambdaTimeout )
31
- Default : 1800
34
+ Description : MessageVisibilityTimeout for the SQS Lambda queue (should be at least (numMaxRetry + 1)*SqsLambdaTimeout )
35
+ Default : 720
32
36
Type : Number
33
37
S3BucketPrefix :
34
38
Description : S3 bucket prefix which will ensure global uniqueness
@@ -119,7 +123,7 @@ Resources:
119
123
GWApiId : !Ref AppApiGateway
120
124
GWHostedZoneId :
121
125
!FindInMap [ApiGwConfig, !Ref RunEnvironment, HostedZoneId]
122
- CloudfrontDomain : !GetAtt [AppFrontendCloudfrontDistribution , DomainName]
126
+ CloudfrontDomain : !GetAtt [AppIcalCloudfrontDistribution , DomainName]
123
127
124
128
LinkryDomainProxy :
125
129
Type : AWS::Serverless::Application
@@ -139,7 +143,7 @@ Resources:
139
143
GWApiId : !Ref AppApiGateway
140
144
GWHostedZoneId :
141
145
!FindInMap [ApiGwConfig, !Ref RunEnvironment, HostedZoneId]
142
- CloudfrontDomain : !GetAtt [AppFrontendCloudfrontDistribution , DomainName]
146
+ CloudfrontDomain : !GetAtt [AppIcalCloudfrontDistribution , DomainName]
143
147
144
148
CoreUrlProd :
145
149
Type : AWS::Serverless::Application
@@ -258,6 +262,17 @@ Resources:
258
262
FunctionResponseTypes :
259
263
- ReportBatchItemFailures
260
264
265
+ SQSLambdaEventMappingSales :
266
+ Type : AWS::Lambda::EventSourceMapping
267
+ DependsOn :
268
+ - AppSqsLambdaFunction
269
+ Properties :
270
+ BatchSize : 5
271
+ EventSourceArn : !GetAtt AppSQSQueues.Outputs.SalesEmailQueueArn
272
+ FunctionName : !Sub ${ApplicationPrefix}-sqs-lambda
273
+ FunctionResponseTypes :
274
+ - ReportBatchItemFailures
275
+
261
276
MembershipRecordsTable :
262
277
Type : " AWS::DynamoDB::Table"
263
278
DeletionPolicy : " Retain"
@@ -515,7 +530,7 @@ Resources:
515
530
ComparisonOperator : " LessThanThreshold"
516
531
Threshold : " 1"
517
532
AlarmActions :
518
- - !Ref AlertSNSArn
533
+ - !Ref PriorityAlertSNSArn
519
534
Dimensions :
520
535
- Name : " ApiName"
521
536
Value : !Sub ${ApplicationPrefix}-gateway
@@ -534,7 +549,7 @@ Resources:
534
549
ComparisonOperator : " GreaterThanThreshold"
535
550
Threshold : " 2"
536
551
AlarmActions :
537
- - !Ref AlertSNSArn
552
+ - !Ref PriorityAlertSNSArn
538
553
Dimensions :
539
554
- Name : " ApiName"
540
555
Value : !Sub ${ApplicationPrefix}-gateway
@@ -547,13 +562,16 @@ Resources:
547
562
AlarmDescription : " Items are present in the application DLQ, meaning some messages failed to process."
548
563
Namespace : " AWS/SQS"
549
564
MetricName : " ApproximateNumberOfMessagesVisible"
550
- Statistic : " Sum "
551
- Period : " 60 "
552
- EvaluationPeriods : " 1 "
565
+ Statistic : " Maximum "
566
+ Period : 60
567
+ EvaluationPeriods : 1
553
568
ComparisonOperator : " GreaterThanThreshold"
554
- Threshold : " 0"
569
+ Threshold : 0
570
+ Dimensions :
571
+ - Name : QueueName
572
+ Value : !Sub ${ApplicationPrefix}-sqs-dlq
555
573
AlarmActions :
556
- - !Ref AlertSNSArn
574
+ - !Ref PriorityAlertSNSArn
557
575
558
576
APILambdaPermission :
559
577
Type : AWS::Lambda::Permission
@@ -608,20 +626,6 @@ Resources:
608
626
- ApiGwConfig
609
627
- !Ref RunEnvironment
610
628
- UiDomainName
611
- - !Join
612
- - " "
613
- - - "go."
614
- - !FindInMap
615
- - ApiGwConfig
616
- - !Ref RunEnvironment
617
- - EnvDomainName
618
- - !Join
619
- - " "
620
- - - "ical."
621
- - !FindInMap
622
- - ApiGwConfig
623
- - !Ref RunEnvironment
624
- - EnvDomainName
625
629
626
630
DefaultCacheBehavior :
627
631
TargetOriginId : S3WebsiteOrigin
@@ -749,19 +753,95 @@ Resources:
749
753
Properties :
750
754
FunctionName : !Ref AppFrontendEdgeLambda
751
755
756
+ AppIcalCloudfrontDistribution :
757
+ Type : AWS::CloudFront::Distribution
758
+ Properties :
759
+ DistributionConfig :
760
+ Origins :
761
+ - Id : ApiGatewayOrigin
762
+ DomainName : !Sub "${AppApiGateway}.execute-api.${AWS::Region}.amazonaws.com"
763
+ OriginPath : " /default"
764
+ CustomOriginConfig :
765
+ HTTPPort : 80
766
+ HTTPSPort : 443
767
+ OriginProtocolPolicy : https-only
768
+ Enabled : true
769
+ Aliases :
770
+ - !Join
771
+ - " "
772
+ - - "go."
773
+ - !FindInMap
774
+ - ApiGwConfig
775
+ - !Ref RunEnvironment
776
+ - EnvDomainName
777
+ - !Join
778
+ - " "
779
+ - - "ical."
780
+ - !FindInMap
781
+ - ApiGwConfig
782
+ - !Ref RunEnvironment
783
+ - EnvDomainName
784
+ DefaultCacheBehavior :
785
+ TargetOriginId : ApiGatewayOrigin
786
+ ViewerProtocolPolicy : redirect-to-https
787
+ AllowedMethods :
788
+ - GET
789
+ - HEAD
790
+ - OPTIONS
791
+ - PUT
792
+ - POST
793
+ - DELETE
794
+ - PATCH
795
+ CachedMethods :
796
+ - GET
797
+ - HEAD
798
+ ForwardedValues :
799
+ QueryString : false
800
+ Cookies :
801
+ Forward : none
802
+ CachePolicyId : !Ref CloudfrontCachePolicy
803
+ OriginRequestPolicyId : 216adef6-5c7f-47e4-b989-5492eafa07d3
804
+ ViewerCertificate :
805
+ AcmCertificateArn : !FindInMap
806
+ - ApiGwConfig
807
+ - !Ref RunEnvironment
808
+ - EnvCertificateArn
809
+ MinimumProtocolVersion : TLSv1.2_2021
810
+ SslSupportMethod : sni-only
811
+ HttpVersion : http2
812
+ PriceClass : PriceClass_100
813
+
814
+
752
815
Outputs :
753
816
DomainName :
754
817
Description : Domain name that the UI is hosted at
755
818
Value : !FindInMap
756
819
- ApiGwConfig
757
820
- !Ref RunEnvironment
758
821
- UiDomainName
822
+
759
823
CloudfrontCnameTarget :
760
824
Description : CNAME record target to create for the domain name above (create the CNAME manually)
761
825
Value :
762
826
Fn::GetAtt :
763
827
- AppFrontendCloudfrontDistribution
764
828
- DomainName
829
+
830
+ CloudfrontSecondaryCnameTarget :
831
+ Description : CNAME record target to create for the secondary domain names (create the CNAME manually)
832
+ Value :
833
+ Fn::GetAtt :
834
+ - AppIcalCloudfrontDistribution
835
+ - DomainName
836
+
765
837
CloudfrontDistributionId :
766
838
Description : Cloudfront Distribution ID
767
839
Value : !GetAtt AppFrontendCloudfrontDistribution.Id
840
+
841
+ CloudfrontSecondaryDistributionId :
842
+ Description : Cloudfront Distribution ID
843
+ Value : !GetAtt AppIcalCloudfrontDistribution.Id
844
+
845
+ SalesEmailQueueArn :
846
+ Description : Sales Email Queue Arn
847
+ Value : !GetAtt AppSQSQueues.Outputs.SalesEmailQueueArn
0 commit comments