Quick AWS cost estimation

Published: Wednesday, Nov 18, 2020 Last modified: Monday, Aug 2, 2021

echo aws --profile mine ce get-cost-forecast --time-period Start=$(date +%F),End=$(date -d"-1 day 1 $(date -d'+1 month' +%b)" +%F) --metric NET_UNBLENDED_COST --granularity MONTHLY

For example:

$ bash aws-cost.sh | sh
{
	"Total": {
        "Amount": "76.48344205901131",
        "Unit": "USD"
	},
	"ForecastResultsByTime": [
        {
            "TimePeriod": {
                "Start": "2020-11-01",
                "End": "2020-12-01"
            },
            "MeanValue": "76.48344205901131"
        }
	]
}