Use SQL to instantly query AWS resources across regions and accounts. Open source CLI. No DB required.
177
stars
89
forks
source link
Add support for the custom date range metric data in the table aws_cost_usage_* table #2168
Open
ParthaI opened 2 months ago
Note: Currently the changes has been made to the table
aws_cost_usage
Integration test logs
Logs
``` Add passing integration test logs here ```Example query results
Results
``` > with ranked_costs as ( select dimension_1 as account_id, dimension_2 as service_name, sum(net_unblended_cost_amount)::numeric::money as net_unblended_cost, rank() over(partition by dimension_1 order by sum(net_unblended_cost_amount) desc) from aws_cost_usage where granularity = 'MONTHLY' and dimension_type_1 = 'LINKED_ACCOUNT' and dimension_type_2 = 'SERVICE' group by dimension_1, dimension_2 order by dimension_1, net_unblended_cost desc ) select * from ranked_costs where rank <=5 +--------------+-------------------------------------------+--------------------+------+ | account_id | service_name | net_unblended_cost | rank | +--------------+-------------------------------------------+--------------------+------+ | xxxxxxxxxxxx | Amazon Route 53 | $776.67 | 1 | | xxxxxxxxxxxx | Amazon Managed Streaming for Apache Kafka | $684.66 | 2 | | xxxxxxxxxxxx | Amazon Simple Storage Service | $120.08 | 3 | | xxxxxxxxxxxx | AWS CloudTrail | $111.90 | 4 | | xxxxxxxxxxxx | AWS Cost Explorer | $87.31 | 5 | +--------------+-------------------------------------------+--------------------+------+ Time: 3.1s. Rows fetched: 356. Hydrate calls: 356. > select * from aws_cost_by_account_daily where search_start_time < '2023/10/22' +---------------------------+-----------------+-------------------+---------------------------+---------------------------+-----------+---------------------+-------------------+-----------------------+---------------------+------------> | search_start_time | search_end_time | linked_account_id | period_start | period_end | estimated | blended_cost_amount | blended_cost_unit | unblended_cost_amount | unblended_cost_unit | net_unblend> +---------------------------+-----------------+-------------------+---------------------------+---------------------------+-----------+---------------------+-------------------+-----------------------+---------------------+------------> | 2023-05-02T05:30:00+05:30 |