Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to use AWS EC2 generator instead of Marketplace generator #509

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading