@@ -22,6 +22,14 @@ Parameters:
2222    Default : false 
2323    Type : String 
2424    AllowedValues : [true, false] 
25+   SqsLambdaTimeout :
26+     Description : How long the SQS lambda is permitted to run (in seconds) 
27+     Default : 300 
28+     Type : Number 
29+   SqsMessageTimeout :
30+     Description : MessageVisibilityTimeout for the SQS Lambda queue (should be at least 6xSqsLambdaTimeout) 
31+     Default : 1800 
32+     Type : Number 
2533
2634Conditions :
2735  IsProd : !Equals [!Ref RunEnvironment, 'prod'] 
@@ -89,7 +97,7 @@ Resources:
8997      Location : ./sqs.yml 
9098      Parameters :
9199        QueueName : !Sub ${ApplicationPrefix}-sqs 
92- 
100+          MessageTimeout :  !Ref SqsMessageTimeout 
93101
94102  IcalDomainProxy :
95103    Type : AWS::Serverless::Application 
@@ -171,7 +179,7 @@ Resources:
171179      Handler : index.handler 
172180      MemorySize : 512 
173181      Role : !GetAtt AppSecurityRoles.Outputs.MainFunctionRoleArn 
174-       Timeout : 900 
182+       Timeout : !Ref SqsLambdaTimeout 
175183      LoggingConfig :
176184        LogGroup : !Sub /aws/lambda/${ApplicationPrefix}-lambda 
177185      Environment :
@@ -390,6 +398,23 @@ Resources:
390398        - Name : ' ApiName' 
391399          Value : !Sub ${ApplicationPrefix}-gateway 
392400
401+ 
402+   AppDLQMessagesAlarm :
403+     Type : ' AWS::CloudWatch::Alarm' 
404+     Condition : IsProd 
405+     Properties :
406+       AlarmName : !Sub ${ApplicationPrefix}-sqs-dlq 
407+       AlarmDescription : ' Items are present in the application DLQ, meaning some messages failed to process.' 
408+       Namespace : ' AWS/SQS' 
409+       MetricName : ' ApproximateNumberOfMessagesVisible' 
410+       Statistic : ' SUM' 
411+       Period : ' 60' 
412+       EvaluationPeriods : ' 1' 
413+       ComparisonOperator : ' GreaterThanThreshold' 
414+       Threshold : ' 0' 
415+       AlarmActions :
416+         - !Ref  AlertSNSArn 
417+ 
393418  APILambdaPermission :
394419    Type : AWS::Lambda::Permission 
395420    Properties :
0 commit comments