- Mais recentes
- Mais votos
- Mais comentários
You can use lineItem/ResourceId to query anything that has the instance ID in it. But it won't give you the EBS volume. You would have to also query the specific EBS Volume ID. The best way to get the total cost associated with an EC2 instance is to use cost allocation tag. Without the tag, you would have to use the instance ID and the volume ID (that is attached to the instance) to query separately.
If you are okay to use Athena + CUR , then here's a query that you might want to try:
line_item_resource_id, bill_payer_account_id, bill_billing_period_start_date, line_item_usage_account_id, DATE_FORMAT(line_item_usage_start_date,'%Y-%m') AS month_line_item_usage_start_date, savings_plan_savings_plan_a_r_n, line_item_product_code, line_item_usage_type, SUM(line_item_usage_amount) AS sum_line_item_usage_amount, line_item_line_item_description, pricing_public_on_demand_rate, SUM(pricing_public_on_demand_cost) AS sum_pricing_public_on_demand_cost, savings_plan_savings_plan_rate, SUM(savings_plan_savings_plan_effective_cost) AS sum_savings_plan_savings_plan_effective_cost FROM "<CUR_DB>" WHERE year='<YEAR>' AND month='<MONTH>' AND line_item_resource_id='<Instance-Id>' AND line_item_line_item_type LIKE 'SavingsPlanCoveredUsage' GROUP BY line_item_resource_id, bill_payer_account_id, bill_billing_period_start_date, line_item_usage_account_id, DATE_FORMAT(line_item_usage_start_date,'%Y-%m'), savings_plan_savings_plan_a_r_n, line_item_product_code, line_item_usage_type, line_item_unblended_rate, line_item_line_item_description, pricing_public_on_demand_rate, savings_plan_savings_plan_rate ORDER BY sum_pricing_public_on_demand_cost DESC;
Conteúdo relevante
- AWS OFICIALAtualizada há 2 anos
I put a "select" at the beginning but results are 0