Difference between revisions of "AWS::CloudWatch::Alarm"
Jump to navigation
Jump to search
↑ https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-cloudwatch.html
↑ https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-sns.html
(Redirected page to CloudWatch) Tag: New redirect |
|||
(26 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html | |
+ | |||
+ | *<code>[[AWS::CloudWatch::AnomalyDetector]]</code> | ||
+ | |||
+ | ===Autoscaling=== | ||
+ | <ref>https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-cloudwatch.html</ref> | ||
+ | |||
+ | <pre> AppScaleUpPolicy: | ||
+ | Type: AWS::AutoScaling::ScalingPolicy | ||
+ | Properties: | ||
+ | AdjustmentType: ChangeInCapacity | ||
+ | AutoScalingGroupName: !Ref DeployAppASG | ||
+ | Cooldown: '60' | ||
+ | ScalingAdjustment: 1</pre> | ||
+ | |||
+ | <pre>AppScaleDownPolicy: | ||
+ | Type: AWS::AutoScaling::ScalingPolicy | ||
+ | Properties: | ||
+ | AdjustmentType: ChangeInCapacity | ||
+ | AutoScalingGroupName: !Ref DeployAppASG | ||
+ | Cooldown: '300' | ||
+ | ScalingAdjustment: -1</pre> | ||
+ | |||
+ | === CPU alarm === | ||
+ | CPUAlarmHigh: | ||
+ | Type: [[AWS::CloudWatch::Alarm]] | ||
+ | Properties: | ||
+ | AlarmDescription: Scale-up if CPU > 80% for 5 minutes | ||
+ | MetricName: CPUUtilization | ||
+ | Namespace: AWS/EC2 | ||
+ | Statistic: Average | ||
+ | Period: 300 | ||
+ | EvaluationPeriods: 2 | ||
+ | Threshold: 80 | ||
+ | [[AlarmActions:]] [!Ref AppScaleUpPolicy] | ||
+ | Dimensions: | ||
+ | - Name: AutoScalingGroupName | ||
+ | Value: !Ref DeployAppASG | ||
+ | ComparisonOperator: GreaterThanThreshold | ||
+ | |||
+ | https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html | ||
+ | |||
+ | <pre> CPUAlarmLow: | ||
+ | Type: AWS::CloudWatch::Alarm | ||
+ | Properties: | ||
+ | AlarmDescription: Scale-down if CPU < 60% for 5 minutes | ||
+ | MetricName: CPUUtilization | ||
+ | Namespace: AWS/EC2 | ||
+ | Statistic: Average | ||
+ | Period: 300 | ||
+ | EvaluationPeriods: 2 | ||
+ | Threshold: 80 | ||
+ | AlarmActions: [!Ref AppScaleDownPolicy] | ||
+ | Dimensions: | ||
+ | - Name: AutoScalingGroupName | ||
+ | Value: !Ref DeployAppASG | ||
+ | ComparisonOperator: LessThanThreshold</pre> | ||
+ | |||
+ | == [[SNS]] == | ||
+ | <ref>https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-sns.html</ref> | ||
+ | |||
+ | MySNSTopic: | ||
+ | Type: [[AWS::SNS::Topic]] | ||
+ | Properties: | ||
+ | Subscription: | ||
+ | - Endpoint: "add valid email address" | ||
+ | Protocol: email | ||
+ | |||
+ | == See also == | ||
+ | * {{Type AWS}} | ||
+ | * {{CloudWatch}} | ||
+ | |||
+ | [[Category:AWS]] |
Latest revision as of 10:46, 29 September 2021
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html
Contents
Autoscaling[edit]
AppScaleUpPolicy: Type: AWS::AutoScaling::ScalingPolicy Properties: AdjustmentType: ChangeInCapacity AutoScalingGroupName: !Ref DeployAppASG Cooldown: '60' ScalingAdjustment: 1
AppScaleDownPolicy: Type: AWS::AutoScaling::ScalingPolicy Properties: AdjustmentType: ChangeInCapacity AutoScalingGroupName: !Ref DeployAppASG Cooldown: '300' ScalingAdjustment: -1
CPU alarm[edit]
CPUAlarmHigh: Type: AWS::CloudWatch::Alarm Properties: AlarmDescription: Scale-up if CPU > 80% for 5 minutes MetricName: CPUUtilization Namespace: AWS/EC2 Statistic: Average Period: 300 EvaluationPeriods: 2 Threshold: 80 AlarmActions: [!Ref AppScaleUpPolicy] Dimensions: - Name: AutoScalingGroupName Value: !Ref DeployAppASG ComparisonOperator: GreaterThanThreshold
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html
CPUAlarmLow: Type: AWS::CloudWatch::Alarm Properties: AlarmDescription: Scale-down if CPU < 60% for 5 minutes MetricName: CPUUtilization Namespace: AWS/EC2 Statistic: Average Period: 300 EvaluationPeriods: 2 Threshold: 80 AlarmActions: [!Ref AppScaleDownPolicy] Dimensions: - Name: AutoScalingGroupName Value: !Ref DeployAppASG ComparisonOperator: LessThanThreshold
SNS[edit]
MySNSTopic: Type: AWS::SNS::Topic Properties: Subscription: - Endpoint: "add valid email address" Protocol: email
See also[edit]
Type:
,AWS::CloudFormation::Stack
,AWS::S3::Bucket
,AWS::SNS::Topic
,AWS::CloudWatch::Alarm
,AWS::CloudWatch::AnomalyDetector
,AWS::SNS::Topic
- AWS monitoring: AWS CloudWatch: Logs, Logs Insights, Events, Alarms,
aws cloudwatch, aws logs
, Amazon CloudWatch Lambda Insights, AWS CloudWatch Container Insights, CloudWatch Dashboard, AWS CloudWatch Automatic Dashboards, Amazon RDS Performance Insights, Amazon CloudWatch Metric Streams, Amazon CloudWatch Lambda Insights,CloudwatchLogsGroup
, Amazon CloudWatch Anomaly Detection,cloudwatch kms key id
, CloudWatch agent, Amazon CloudWatch Evidently, namespace, Synthetics, Synthetics Canaries, YACE, Prometheus cloudwatch exporter, Amazon CloudWatch Observability Access Manager, Amazon CloudWatch Live Tail
Advertising: