-
Notifications
You must be signed in to change notification settings - Fork 1
made pricing api calls region specific + initDB #1
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
base: main
Are you sure you want to change the base?
Conversation
@mohamedlajmileanix please review changes and merge after finishing |
@@ -19,6 +19,26 @@ | |||
pricing_dict = {} | |||
region_table = {} | |||
container_instance_ec2_mapping = {} | |||
aws_regions = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need this to map region to region name to use it as param for Pricing API calls
""" | ||
svc_code = 'AmazonEC2' | ||
region_name = str(aws_regions[region]) | ||
client = boto3.client('pricing', region_name="us-east-1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to hard code the pricing api endpoint but make the region specific in the location param in the query
@@ -93,7 +122,9 @@ def ec2_pricing(region, instance_type, tenancy, ostype): | |||
ret_dict['pricePerUnit'] = mydict_terms['priceDimensions'][list( | |||
mydict_terms['priceDimensions'].keys())[0]]['pricePerUnit'] | |||
ret_list.append(ret_dict) | |||
|
|||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added improved logging for cases where we do not get pricing info - can still happen
table = db_res.Table("initDB") | ||
|
||
#db_client = boto3.client('dynamodb') | ||
initialised = table.scan( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls check if this query works properly
No description provided.