Difference between revisions of "Aws ce get-cost-and-usage"

From wikieduonline
Jump to navigation Jump to search
Line 4: Line 4:
 
  [[aws ce get-cost-and-usage]] --time-period Start=2020-06-01,End=2020-06-30 --granularity MONTHLY --metrics "BlendedCost" "UnblendedCost" "UsageQuantity" --group-by Type=DIMENSION,Key=SERVICE Type=TAG,Key=Environment --filter file://filters.json
 
  [[aws ce get-cost-and-usage]] --time-period Start=2020-06-01,End=2020-06-30 --granularity MONTHLY --metrics "BlendedCost" "UnblendedCost" "UsageQuantity" --group-by Type=DIMENSION,Key=SERVICE Type=TAG,Key=Environment --filter file://filters.json
  
 +
Output:
 +
<pre>
 +
{
 +
    "GroupDefinitions": [
 +
        {
 +
            "Type": "DIMENSION",
 +
            "Key": "SERVICE"
 +
        },
 +
        {
 +
            "Type": "TAG",
 +
            "Key": "Environment"
 +
        }
 +
    ],
 +
    "ResultsByTime": [
 +
        {
 +
            "Estimated": false,
 +
            "TimePeriod": {
 +
                "Start": "2017-09-01",
 +
                "End": "2017-10-01"
 +
            },
 +
            "Total": {},
 +
            "Groups": [
 +
                {
 +
                    "Keys": [
 +
                        "Amazon Simple Storage Service",
 +
                        "Environment$"
 +
                    ],
 +
                    "Metrics": {
 +
                        "BlendedCost": {
 +
                            "Amount": "40.3527508453",
 +
                            "Unit": "USD"
 +
                        },
 +
                        "UnblendedCost": {
 +
                            "Amount": "40.3543773134",
 +
                            "Unit": "USD"
 +
                        },
 +
                        "UsageQuantity": {
 +
                            "Amount": "9312771.098461578",
 +
                            "Unit": "N/A"
 +
                        }
 +
                    }
 +
                },
 +
                {
 +
                    "Keys": [
 +
                        "Amazon Simple Storage Service",
 +
                        "Environment$Dev"
 +
                    ],
 +
                    "Metrics": {
 +
                        "BlendedCost": {
 +
                            "Amount": "0.2682364644",
 +
                            "Unit": "USD"
 +
                        },
 +
                        "UnblendedCost": {
 +
                            "Amount": "0.2682364644",
 +
                            "Unit": "USD"
 +
                        },
 +
                        "UsageQuantity": {
 +
                            "Amount": "22403.4395271182",
 +
                            "Unit": "N/A"
 +
                        }
 +
                    }
 +
                }
 +
            ]
 +
        }
 +
    ]
 +
}
 +
</pre>
  
 
== See also ==
 
== See also ==

Revision as of 14:37, 14 November 2021

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ce/get-cost-and-usage.html

aws ce get-cost-and-usage --time-period Start=2020-06-01,End=2020-06-30 --granularity MONTHLY --metrics "BlendedCost" "UnblendedCost" "UsageQuantity" --group-by Type=DIMENSION,Key=SERVICE Type=TAG,Key=Environment --filter file://filters.json
Output:
{
    "GroupDefinitions": [
        {
            "Type": "DIMENSION",
            "Key": "SERVICE"
        },
        {
            "Type": "TAG",
            "Key": "Environment"
        }
    ],
    "ResultsByTime": [
        {
            "Estimated": false,
            "TimePeriod": {
                "Start": "2017-09-01",
                "End": "2017-10-01"
            },
            "Total": {},
            "Groups": [
                {
                    "Keys": [
                        "Amazon Simple Storage Service",
                        "Environment$"
                    ],
                    "Metrics": {
                        "BlendedCost": {
                            "Amount": "40.3527508453",
                            "Unit": "USD"
                        },
                        "UnblendedCost": {
                            "Amount": "40.3543773134",
                            "Unit": "USD"
                        },
                        "UsageQuantity": {
                            "Amount": "9312771.098461578",
                            "Unit": "N/A"
                        }
                    }
                },
                {
                    "Keys": [
                        "Amazon Simple Storage Service",
                        "Environment$Dev"
                    ],
                    "Metrics": {
                        "BlendedCost": {
                            "Amount": "0.2682364644",
                            "Unit": "USD"
                        },
                        "UnblendedCost": {
                            "Amount": "0.2682364644",
                            "Unit": "USD"
                        },
                        "UsageQuantity": {
                            "Amount": "22403.4395271182",
                            "Unit": "N/A"
                        }
                    }
                }
            ]
        }
    ]
}

See also

Advertising: