Skip to content

Commit

Permalink
fix: error handling and missing arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
skymoore committed May 8, 2024
1 parent 5ced3cf commit bc5ff3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion aws_cost_mutilator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def tgs_(region, profile):
def lbs_(region, profile):
# Perform analysis of ELBv2 resources in the specified region and profile
session = boto_session(region, profile)
load_balancers = get_lbs_no_targets(session)
load_balancers = get_lbs_no_targets(session, region)

total_monthly_cost = load_balancers["total_monthly_cost"]
del load_balancers["total_monthly_cost"]
Expand Down
11 changes: 3 additions & 8 deletions aws_cost_mutilator/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@


def boto_session(region, profile):
try:
session = boto3.Session(region_name=region, profile_name=profile)
session.client("sts").get_caller_identity()
return session

except Exception as e:
print(f"Error: {e}")
return None
session = boto3.Session(region_name=region, profile_name=profile)
session.client("sts").get_caller_identity()
return session


def get_lb_hourly_costs(session):
Expand Down

0 comments on commit bc5ff3e

Please sign in to comment.