@@ -7,9 +7,13 @@ Parameters:
77 Type : String
88 AllowedValues : ["dev", "prod"]
99 AlertSNSArn :
10- Description : SNS Queue to send alarm alerts to (prod only)
10+ Description : SNS Queue to send general alarm alerts to (prod only)
1111 Type : String
1212 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
1317 ApplicationPrefix :
1418 Type : String
1519 Description : Application prefix, no ending dash
@@ -24,11 +28,11 @@ Parameters:
2428 AllowedValues : [true, false]
2529 SqsLambdaTimeout :
2630 Description : How long the SQS lambda is permitted to run (in seconds)
27- Default : 300
31+ Default : 180
2832 Type : Number
2933 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
3236 Type : Number
3337 S3BucketPrefix :
3438 Description : S3 bucket prefix which will ensure global uniqueness
@@ -119,7 +123,7 @@ Resources:
119123 GWApiId : !Ref AppApiGateway
120124 GWHostedZoneId :
121125 !FindInMap [ApiGwConfig, !Ref RunEnvironment, HostedZoneId]
122- CloudfrontDomain : !GetAtt [AppFrontendCloudfrontDistribution , DomainName]
126+ CloudfrontDomain : !GetAtt [AppIcalCloudfrontDistribution , DomainName]
123127
124128 LinkryDomainProxy :
125129 Type : AWS::Serverless::Application
@@ -139,7 +143,7 @@ Resources:
139143 GWApiId : !Ref AppApiGateway
140144 GWHostedZoneId :
141145 !FindInMap [ApiGwConfig, !Ref RunEnvironment, HostedZoneId]
142- CloudfrontDomain : !GetAtt [AppFrontendCloudfrontDistribution , DomainName]
146+ CloudfrontDomain : !GetAtt [AppIcalCloudfrontDistribution , DomainName]
143147
144148 CoreUrlProd :
145149 Type : AWS::Serverless::Application
@@ -258,6 +262,17 @@ Resources:
258262 FunctionResponseTypes :
259263 - ReportBatchItemFailures
260264
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+
261276 MembershipRecordsTable :
262277 Type : " AWS::DynamoDB::Table"
263278 DeletionPolicy : " Retain"
@@ -515,7 +530,7 @@ Resources:
515530 ComparisonOperator : " LessThanThreshold"
516531 Threshold : " 1"
517532 AlarmActions :
518- - !Ref AlertSNSArn
533+ - !Ref PriorityAlertSNSArn
519534 Dimensions :
520535 - Name : " ApiName"
521536 Value : !Sub ${ApplicationPrefix}-gateway
@@ -534,7 +549,7 @@ Resources:
534549 ComparisonOperator : " GreaterThanThreshold"
535550 Threshold : " 2"
536551 AlarmActions :
537- - !Ref AlertSNSArn
552+ - !Ref PriorityAlertSNSArn
538553 Dimensions :
539554 - Name : " ApiName"
540555 Value : !Sub ${ApplicationPrefix}-gateway
@@ -547,13 +562,16 @@ Resources:
547562 AlarmDescription : " Items are present in the application DLQ, meaning some messages failed to process."
548563 Namespace : " AWS/SQS"
549564 MetricName : " ApproximateNumberOfMessagesVisible"
550- Statistic : " Sum "
551- Period : " 60 "
552- EvaluationPeriods : " 1 "
565+ Statistic : " Maximum "
566+ Period : 60
567+ EvaluationPeriods : 1
553568 ComparisonOperator : " GreaterThanThreshold"
554- Threshold : " 0"
569+ Threshold : 0
570+ Dimensions :
571+ - Name : QueueName
572+ Value : !Sub ${ApplicationPrefix}-sqs-dlq
555573 AlarmActions :
556- - !Ref AlertSNSArn
574+ - !Ref PriorityAlertSNSArn
557575
558576 APILambdaPermission :
559577 Type : AWS::Lambda::Permission
@@ -608,20 +626,6 @@ Resources:
608626 - ApiGwConfig
609627 - !Ref RunEnvironment
610628 - 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
625629
626630 DefaultCacheBehavior :
627631 TargetOriginId : S3WebsiteOrigin
@@ -749,19 +753,95 @@ Resources:
749753 Properties :
750754 FunctionName : !Ref AppFrontendEdgeLambda
751755
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+
752815Outputs :
753816 DomainName :
754817 Description : Domain name that the UI is hosted at
755818 Value : !FindInMap
756819 - ApiGwConfig
757820 - !Ref RunEnvironment
758821 - UiDomainName
822+
759823 CloudfrontCnameTarget :
760824 Description : CNAME record target to create for the domain name above (create the CNAME manually)
761825 Value :
762826 Fn::GetAtt :
763827 - AppFrontendCloudfrontDistribution
764828 - 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+
765837 CloudfrontDistributionId :
766838 Description : Cloudfront Distribution ID
767839 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