File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -19,3 +19,31 @@ function aws_cost_list_months_later() {
1919 --time-period " Start=$( date -d " ${months} months ago" +%Y-%m-01) ,End=$( date -d " $( date +%Y-%m-01) -1 day" +%Y-%m-%d) " \
2020 --granularity MONTHLY --metrics " UnblendedCost"
2121}
22+
23+ function aws_cost_get_current_month() {
24+ aws ce get-cost-and-usage \
25+ --time-period " Start=$( date +%Y-%m-01) ,End=$( date +%Y-%m-%d) " \
26+ --granularity MONTHLY --metrics " UnblendedCost"
27+ }
28+
29+ function aws_cost_get_last_month() {
30+ aws ce get-cost-and-usage \
31+ --time-period " Start=$( date -d " $( date +%Y-%m-01) -1 month" +%Y-%m-01) ,End=$( date -d " $( date +%Y-%m-01) -1 day" +%Y-%m-%d) " \
32+ --granularity MONTHLY --metrics " UnblendedCost"
33+ }
34+
35+ function aws_cost_get_service_cost_current_month() {
36+ aws ce get-cost-and-usage \
37+ --time-period Start=$( date +%Y-%m-01) ,End=$( date -d " +1 day" +%Y-%m-%d) \
38+ --granularity MONTHLY \
39+ --metrics " UnblendedCost" \
40+ --group-by Type=DIMENSION,Key=SERVICE \
41+ --output table
42+ }
43+
44+ function aws_cost_get_last_7_days() {
45+ aws ce get-cost-and-usage \
46+ --time-period " Start=$( date -d " 7 days ago" +%Y-%m-%d) ,End=$( date +%Y-%m-%d) " \
47+ --granularity DAILY --metrics " UnblendedCost" \
48+ --output table
49+ }
You can’t perform that action at this time.
0 commit comments