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

feat: Fix cost calculations for AWS S3 #1054

Merged

Conversation

bishal7679
Copy link
Contributor

@bishal7679 bishal7679 commented Oct 9, 2023

Problem #1022

Currently cost for AWS S3 is always showing as $0.

Solution

This PR is fixing that issue by adding more filters and usage metrics for request to s3 bucket with absolute pricemap fetching.

Changes Made

  • Fetching price info using AWS SDK price module using AmazonS3 service code and appropriate filters.
  • getting price map using util function GetPriceMap from utils.go
  • fetching resource objects using S3 client
  • also fetching usage metrics as request using cloudwatch
  • Finally added calculation as per all the metrics

Screenshots

09-10-2023:09:42:02

Checklist

  • Code follows the contributing guidelines
  • Changes have been thoroughly tested
  • Documentation has been updated, if necessary
  • Any dependencies have been added to the project, if necessary

Taking ref from :- #1053

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
@bishal7679
Copy link
Contributor Author

/cc @AvineshTripathi

@mlabouardy mlabouardy requested a review from Azanul October 9, 2023 08:15
Copy link
Collaborator

@Azanul Azanul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

providers/aws/s3/buckets.go Outdated Show resolved Hide resolved
providers/aws/s3/buckets.go Outdated Show resolved Hide resolved
providers/aws/s3/buckets.go Outdated Show resolved Hide resolved
Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
@bishal7679
Copy link
Contributor Author

@Azanul @AvineshTripathi PHAL!

providers/aws/s3/buckets.go Outdated Show resolved Hide resolved
providers/aws/s3/buckets.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@Azanul Azanul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the code comments are pretty obvious and can be removed. Thanks for the work @bishal7679

Copy link
Collaborator

@mlabouardy mlabouardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes @bishal7679 once the comments are removed, I'll merge the PR :)

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
bishal7679 and others added 2 commits October 9, 2023 23:15
@bishal7679
Copy link
Contributor Author

All good to go now 👍 @mlabouardy

@mlabouardy mlabouardy added this to the v3.1.2 milestone Oct 9, 2023
@mlabouardy mlabouardy added the aws label Oct 9, 2023
@mlabouardy mlabouardy merged commit d78af50 into tailwarden:develop Oct 9, 2023
2 checks passed
@bishal7679 bishal7679 deleted the feature/correct-cost-for-s3 branch October 11, 2023 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants