如何使用AWS CLI知道RDS免费存储?

时间:2018-12-18 16:44:49

标签: amazon-web-services amazon-rds aws-cli

我尝试使用以下命令,但是没有运气(如果做错了,请告诉我)。

aws cloudwatch get-metric-statistics --metric-name FreeStorageSpace --start-time 2018-12-15T23:18:00Z --end-time 2018-12-16T23:18:00Z --period 60 --namespace AWS/RDS --statistics Average --dimensions Name=Instance name, value=dev

我得到以下输出:-

{ "Datapoints": [], "Label": "FreeStorageSpace" }

2 个答案:

答案 0 :(得分:0)

输入是这样的:

aws cloudwatch get-metric-statistics
--region us-east-1
--metric-name FreeStorageSpace
--start-time 2018-12-15T20:05:00
--end-time 2017-12-16T20:05:00
--period 3600
--namespace AWS/RDS
--statistics Maximum
--dimensions="Name=MyDB,Value=cc-mysql-prod-db"

输出:

{
"Datapoints": [
    {
        "Timestamp": "2018-12-15T20:05:00Z",
        "Maximum": 2196401152.0,
        "Unit": "Bytes"
    },
    {
        "Timestamp": "2018-12-15T21:05:00Z",
        "Maximum": 2196433920.0,
        "Unit": "Bytes"
    },
    {
        "Timestamp": "2018-12-15T22:05:00Z",
        "Maximum": 2196401152.0,
        "Unit": "Bytes"
    },


    ...


    {
        "Timestamp": "2018-12-16T18:05:00Z",
        "Maximum": 2196405248.0,
        "Unit": "Bytes"
    },
    {
        "Timestamp": "2018-12-16T19:05:00Z",
        "Maximum": 2196405248.0,
        "Unit": "Bytes"
    },
    {
        "Timestamp": "2018-12-16T20:05:00Z",
        "Maximum": 2196433920.0,
        "Unit": "Bytes"
    }
],
"Label": "FreeStorageSpace"
    }

是否还可以确保使用与数据库实例驻留在aws cli中相同的默认区域,并尝试使用句号(可能为300左右)?

答案 1 :(得分:0)

是的,我做到了。这是我的输出:-

..... ...... ..... "Timestamp": "2018-12-18T11:18:00Z", "Average": 103001828556.8, "Unit": "Bytes" }, { "Timestamp": "2018-12-17T20:18:00Z", "Average": 103001801386.66667, "Unit": "Bytes" }, { "Timestamp": "2018-12-18T01:18:00Z", "Average": 103001622664.53334, "Unit": "Bytes" } ], "Label": "FreeStorageSpace"

但是这里显示103.00162266453334 GB(我的Rds实例大小仅为100GB),在AWS控制台上显示98.3456775GB