Skip to content

Commit

Permalink
[Improvement] vpc/vpc-nat-gateway - Monitor bandwidth (widdix#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwittig authored Mar 18, 2020
1 parent aaed245 commit 05fdc8f
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions vpc/vpc-nat-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,74 @@ Resources:
Dimensions:
- Name: NatGatewayId
Value: !Ref NatGateway
AlarmNatGatewayBandwidth:
Condition: HasAlertTopic
Type: 'AWS::CloudWatch::Alarm'
Properties:
AlarmActions:
- {'Fn::ImportValue': !Sub '${ParentAlertStack}-TopicARN'}
AlarmDescription: !Sub 'NAT gateway ${SubnetZone} bandwidth utilization is over 80%'
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Metrics:
- Id: 'in1'
Label: 'InFromDestination'
MetricStat:
Metric:
Namespace: 'AWS/NATGateway'
MetricName: BytesInFromDestination # bytes per minute
Dimensions:
- Name: NatGatewayId
Value: !Ref NatGateway
Period: 60
Stat: Sum
Unit: Bytes
ReturnData: false
- Id: 'in2'
Label: 'InFromSource'
MetricStat:
Metric:
Namespace: 'AWS/NATGateway'
MetricName: BytesInFromSource # bytes per minute
Dimensions:
- Name: NatGatewayId
Value: !Ref NatGateway
Period: 60
Stat: Sum
Unit: Bytes
ReturnData: false
- Id: 'out1'
Label: 'OutToDestination'
MetricStat:
Metric:
Namespace: 'AWS/NATGateway'
MetricName: BytesOutToDestination # bytes per minute
Dimensions:
- Name: NatGatewayId
Value: !Ref NatGateway
Period: 60
Stat: Sum
Unit: Bytes
ReturnData: false
- Id: 'out2'
Label: 'OutToSource'
MetricStat:
Metric:
Namespace: 'AWS/NATGateway'
MetricName: BytesOutToSource # bytes per minute
Dimensions:
- Name: NatGatewayId
Value: !Ref NatGateway
Period: 60
Stat: Sum
Unit: Bytes
ReturnData: false
- Expression: '(in1+in2+out1+out2)/2/60*8/1000/1000/1000' # to Gbit/s
Id: 'bandwidth'
Label: 'Bandwidth'
ReturnData: true
Threshold: 36 # hard limit is 45 Gbit/s
TreatMissingData: notBreaching
Outputs:
TemplateID:
Description: 'cloudonaut.io template id.'
Expand Down

0 comments on commit 05fdc8f

Please sign in to comment.