Skip to content

Commit

Permalink
Enable to use AWS EC2 generator instead of Marketplace generator (#509)
Browse files Browse the repository at this point in the history
  • Loading branch information
esebesto authored Jun 7, 2024
1 parent 75f3128 commit 392662c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nise/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "4.5.3"
__version__ = "4.5.4"

VERSION = __version__.split(".")
11 changes: 9 additions & 2 deletions nise/generators/aws/ec2_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,17 @@ def __init__(self, start_date, end_date, currency, payer_account, usage_accounts
def _update_data(self, row, start, end, **kwargs):
"""Update data with generator specific data."""
inst_type, physical_cores, vcpu, memory, storage, family, cost, rate, saving, description = self._instance_type

inst_description = description.format(cost=cost, inst_type=inst_type)
product_name = "Amazon Elastic Compute Cloud"
billing_entity = "AWS"
if self.attributes:
inst_description = self.attributes.get("lineitem_lineitemdescription", inst_description)
product_name = self.attributes.get("product_name", product_name)
billing_entity = self.attributes.get("billing_entity", billing_entity)
location, aws_region, avail_zone, _ = self._get_location()
row = self._add_common_usage_info(row, start, end)

row["bill/BillingEntity"] = billing_entity
row["lineItem/ProductCode"] = "AmazonEC2"
row["lineItem/UsageType"] = f"BoxUsage:{inst_type}"
row["lineItem/Operation"] = "RunInstances"
Expand All @@ -136,7 +143,7 @@ def _update_data(self, row, start, end, **kwargs):
row["lineItem/BlendedRate"] = rate
row["lineItem/BlendedCost"] = cost
row["lineItem/LineItemDescription"] = inst_description
row["product/ProductName"] = "Amazon Elastic Compute Cloud"
row["product/ProductName"] = product_name
row["product/clockSpeed"] = "2.8 GHz"
row["product/currentGeneration"] = "Yes"
row["product/ecu"] = "14"
Expand Down

0 comments on commit 392662c

Please sign in to comment.