bref icon indicating copy to clipboard operation
bref copied to clipboard

document CloudWatch alarms

Open Nemo64 opened this issue 4 years ago • 3 comments

I'd like documentation about CloudWatch alarms.

I'm not fluent in that topic yet but i'll have to experiment with it in the future so I can add something in the coming weeks.

I mean something like this CloudFormation template:

        EmailTopic:
            Type: AWS::SNS::Topic
            Properties:
                Subscription:
                    -   Endpoint: [email protected]
                        Protocol: "email"
        Alarm:
            Type: AWS::CloudWatch::Alarm
            Properties:
                ActionsEnabled: true
                AlarmActions:
                    - !Ref EmailTopic
                AlarmDescription: HTTP 4xx
                AlarmName: HTTP 4xx
                ComparisonOperator: GreaterThanThreshold
                DatapointsToAlarm: 1
                EvaluationPeriods: 1
                Dimensions:
                    - Name: ApiName
                      Value: ${self:provider.stage}-${self:service}
                MetricName: 4XXError
                Namespace: AWS/ApiGateway
                Period: 60
                Statistic: Sum
                Threshold: 1
                TreatMissingData: notBreaching

One thing that I think is especially important is to monitor is lambda scaling since the default account limit is 1000 concurrent instances and 1000 lambda instance running none-stop will be very expensive and while amazon claims that CloudFront protects agains d-dos attacks, I still want to know if someone runs an ab -c 1000 on my endpoint.... which isn't really a d-dos.

Nemo64 avatar Mar 29 '20 18:03 Nemo64

There's a serverless plugin called 'serverless-plugin-aws-alerts' which might help here.

victormacko avatar Mar 29 '20 22:03 victormacko

Good hint, although by quickly looking over it, it seems like a slightly different syntax for vanilla alarms. I think I have to experiment more with it to see what problems that plugin tries to solve.

Nemo64 avatar Mar 29 '20 23:03 Nemo64

That's interesting, I would be 👍 to merge a documentation about this.

This could fit well as a new article in the Environment section:

Capture d’écran 2020-04-05 à 12 17 14

One thing to keep in mind if you put some examples: explain clearly what the alerts are about. The code example you posted is interesting, but to be honest it's hard to clearly understand when the alarm triggers exactly.

mnapoli avatar Apr 05 '20 10:04 mnapoli