Class: CloudCostTracker::Billing::AWS::RDS::ServerStorageBillingPolicy
- Inherits:
-
ResourceBillingPolicy
- Object
- ResourceBillingPolicy
- CloudCostTracker::Billing::AWS::RDS::ServerStorageBillingPolicy
- Defined in:
- lib/cloud_cost_tracker/billing/rds/server_storage.rb
Overview
The default billing policy for Amazon RDS server storage costs
Constant Summary collapse
- CENTS_PER_GB_PER_MONTH =
The YAML pricing data is read from config/billing
YAML.load(File.read File.join( CONSTANTS_DIR, 'rds-aws-servers', 'us-east-on_demand-storage.yml'))
Constants included from CloudCostTracker
Instance Method Summary collapse
- #billing_type ⇒ Object
-
#get_cost_for_duration(rds_server, duration) ⇒ Object
Returns the storage cost for a given RDS server over some duration (in seconds).
-
#zone_setting(resource) ⇒ Object
returns either ‘multi_az’ or ‘standard’, depending on whether this RDS server is multi-AZ.
Methods inherited from ResourceBillingPolicy
#initialize, #setup, #write_billing_record_for
Methods included from CloudCostTracker
account_coding_class, connect_to_database, create_billing_agents, create_coding_agents, env, read_accounts
Constructor Details
This class inherits a constructor from CloudCostTracker::Billing::ResourceBillingPolicy
Instance Method Details
#billing_type ⇒ Object
24 |
# File 'lib/cloud_cost_tracker/billing/rds/server_storage.rb', line 24 def billing_type ; "RDS Instance storage" end |
#get_cost_for_duration(rds_server, duration) ⇒ Object
Returns the storage cost for a given RDS server over some duration (in seconds)
13 14 15 16 |
# File 'lib/cloud_cost_tracker/billing/rds/server_storage.rb', line 13 def get_cost_for_duration(rds_server, duration) CENTS_PER_GB_PER_MONTH[zone_setting(rds_server)] * rds_server.allocated_storage * duration / SECONDS_PER_MONTH end |
#zone_setting(resource) ⇒ Object
returns either ‘multi_az’ or ‘standard’, depending on whether this RDS server is multi-AZ
20 21 22 |
# File 'lib/cloud_cost_tracker/billing/rds/server_storage.rb', line 20 def zone_setting(resource) resource.multi_az ? 'multi_az' : 'standard' end |