Class: CfnGuardian::Resource::RDSInstance
- Defined in:
- lib/cfnguardian/resources/rds_instance.rb
Instance Method Summary collapse
Methods inherited from Base
#default_checks, #default_events, #default_metric_filters, #get_alarms, #get_checks, #get_cost, #get_event_subscriptions, #get_events, #get_metric_filters, #initialize
Methods included from Logging
colors, included, logger, #logger, logger=
Constructor Details
This class inherits a constructor from CfnGuardian::Resource::Base
Instance Method Details
#default_alarms ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/cfnguardian/resources/rds_instance.rb', line 6 def default_alarms alarm = CfnGuardian::Models::RDSInstanceAlarm.new(@resource) alarm.name = 'FreeStorageSpaceCritical' alarm.metric_name = 'FreeStorageSpace' alarm.threshold = 50000000000 alarm.evaluation_periods = 1 alarm.comparison_operator = 'LessThanThreshold' @alarms.push(alarm) alarm = CfnGuardian::Models::RDSInstanceAlarm.new(@resource) alarm.name = 'FreeStorageSpaceTask' alarm.metric_name = 'FreeStorageSpace' alarm.threshold = 100000000000 alarm.evaluation_periods = 1 alarm.comparison_operator = 'LessThanThreshold' alarm.alarm_action = 'Task' @alarms.push(alarm) alarm = CfnGuardian::Models::RDSInstanceAlarm.new(@resource) alarm.name = 'CPUUtilizationHighSpike' alarm.metric_name = 'CPUUtilization' alarm.threshold = 95 alarm.evaluation_periods = 10 @alarms.push(alarm) alarm = CfnGuardian::Models::RDSInstanceAlarm.new(@resource) alarm.name = 'CPUUtilizationHighBase' alarm.metric_name = 'CPUUtilization' alarm.threshold = 75 alarm.evaluation_periods = 60 alarm.alarm_action = 'Warning' @alarms.push(alarm) alarm = CfnGuardian::Models::RDSInstanceAlarm.new(@resource) alarm.name = 'DatabaseConnections' alarm.metric_name = 'DatabaseConnections' alarm.statistic = 'Minimum' alarm.threshold = 45 alarm.evaluation_periods = 10 @alarms.push(alarm) alarm = CfnGuardian::Models::RDSInstanceAlarm.new(@resource) alarm.name = 'ReplicaLag' alarm.metric_name = 'ReplicaLag' alarm.threshold = 30 # seconds alarm.evaluation_periods = 5 alarm.alarm_action = 'Warning' alarm.enabled = false @alarms.push(alarm) end |
#default_event_subscriptions ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/cfnguardian/resources/rds_instance.rb', line 57 def default_event_subscriptions() event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'MasterPasswordReset' event_subscription.event_id = 'RDS-EVENT-0016' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'MasterPasswordResetFailure' event_subscription.event_id = 'RDS-EVENT-0067' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'Deletion' event_subscription.event_id = 'RDS-EVENT-0003' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'StorageFullShutDown' event_subscription.event_id = 'RDS-EVENT-0221' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'StorageCapacityLow' event_subscription.event_id = 'RDS-EVENT-0222' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'InvalidState' event_subscription.event_id = 'RDS-EVENT-0219' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'StorageScalingReachedThreshold' event_subscription.event_id = 'RDS-EVENT-0224' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'StorageScalingFailed' event_subscription.event_id = 'RDS-EVENT-0223' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'MultiAZStandByFailoverStarted' event_subscription.event_id = 'RDS-EVENT-0013' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'MultiAZStandByFailoverCompleted' event_subscription.event_id = 'RDS-EVENT-0015' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'MultiAZFailoverStarted' event_subscription.event_id = 'RDS-EVENT-0050' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'MultiAZFailoverCompleted' event_subscription.event_id = 'RDS-EVENT-0049' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'NotAttemptingFailover' event_subscription.event_id = 'RDS-EVENT-0034' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'DBFailure' event_subscription.event_id = 'RDS-EVENT-0031' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'TableCountExceedsRecommended' event_subscription.event_id = 'RDS-EVENT-0055' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'DatabasesCountExceedsRecommended' event_subscription.event_id = 'RDS-EVENT-0056' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'ReplicationFailure' event_subscription.enabled = false event_subscription.event_id = 'RDS-EVENT-0045' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'ReplicationTerminated' event_subscription.enabled = false event_subscription.event_id = 'RDS-EVENT-0057' @event_subscriptions.push(event_subscription) event_subscription = CfnGuardian::Models::RDSInstanceEventSubscription.new(@resource) event_subscription.name = 'ReplicationStopped' event_subscription.enabled = false event_subscription.event_id = 'RDS-EVENT-0062' @event_subscriptions.push(event_subscription) end |
#resource_exists? ⇒ Boolean
157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/cfnguardian/resources/rds_instance.rb', line 157 def resource_exists? client = Aws::RDS::Client.new resource = Aws::RDS::Resource.new(client: client) instance = resource.db_instance(@resource['Id']) begin instance.load rescue Aws::RDS::Errors::DBInstanceNotFound return false end return true end |