问题描述
你有一个 cloudformation yaml 模板。 Cloudwatch 应在 cpu > 55% 持续 5 分钟时发送电子邮件(例如)。但是没有电子邮件进来。 日志中没有错误。模板也执行得很好。
你能帮我找出问题所在吗。
谢谢。
NotificationTopic:
Type: AWS::SNS::Topic
Properties:
TopicName: AlarmTopic
Subscription:
- Endpoint: "aws@email.com"
Protocol: "email"
WebsiteAutoScalingGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
LaunchConfigurationName: !Ref WebsiteLaunchConfig
AvailabilityZones:
- Fn::Select:
- 0
- Fn::GetAZs: !Ref AWS::Region
- Fn::Select:
- 1
- Fn::GetAZs: !Ref AWS::Region
VPCZoneIdentifier:
- !Ref Publicsubnet1CIDR
- !Ref Publicsubnet2CIDR
DesiredCapacity: 1
MaxSize: 2
MinSize: 1
TargetGroupARNs:
- !Ref WebsiteTargetGroup
NotificationConfigurations:
TopicARN: !Ref NotificationTopic
NotificationTypes:
- 'autoscaling:EC2_INSTANCE_LAUNCH'
- 'autoscaling:EC2_INSTANCE_LAUNCH_ERROR'
- 'autoscaling:EC2_INSTANCE_TERMINATE'
- 'autoscaling:EC2_INSTANCE_TERMINATE_ERROR'
WebsiteScaleUpPolicy:
DependsOn: WebsiteAutoScalingGroup
Type: AWS::AutoScaling::ScalingPolicy
Properties:
AdjustmentType: ChangeInCapacity
AutoScalingGroupName: !Ref WebsiteAutoScalingGroup
Cooldown: '60'
ScalingAdjustment: 1
cpuAlarmHigh:
DependsOn: WebsiteAutoScalingGroup
Type: AWS::CloudWatch::Alarm
Properties:
AlarmDescription: Scale-up if cpu > 55% for 5 minutes
MetricName: cpuutilization
Namespace: AWS/EC2
Statistic: Average
Period: 300
EvaluationPeriods: 2
Threshold: 55
AlarmActions:
- !Ref WebsiteScaleUpPolicy
Dimensions:
- Name: AutoScalingGroupName
Value: !Ref WebsiteAutoScalingGroup
Comparisonoperator: GreaterThanThreshold
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)