我一直在研究某些AWS服务,并且能够获取EC2实例数据,S3数据等基本细节,但是在所有这些服务中,我还需要根据服务确定成本和大小。
我发现可以使用
之类的云监视指标来完成此操作Amazon.CloudWatch.Model.Metric CPUCreditBalanceMetric = new Amazon.CloudWatch.Model.Metric();
Amazon.CloudWatch.Model.Dimension CPUCreditBalanceDim = new Amazon.CloudWatch.Model.Dimension();
CPUCreditBalanceDim.Name = "InstanceId";
CPUCreditBalanceDim.Value = "i-*********";
List<Amazon.CloudWatch.Model.Dimension> CPUCreditBalanceDimLst = new
List<Amazon.CloudWatch.Model.Dimension>();
CPUCreditBalanceDimLst.Add(CPUCreditBalanceDim);
CPUCreditBalanceMetric.Dimensions = CPUCreditBalanceDimLst;
CPUCreditBalanceMetric.MetricName = "CPUCreditBalance";
CPUCreditBalanceMetric.Namespace = "AWS/EC2";
CPUCreditBalanceStat.Metric = CPUCreditBalanceMetric;
CPUCreditBalanceStat.Period = 3600;
CPUCreditBalanceStat.Stat = "Sum";
CPUCreditBalanceQry.MetricStat = CPUCreditBalanceStat;
CPUCreditBalanceQry.Label = "myCPUCreditBalanceLabel";
CPUCreditBalanceQry.ReturnData = true;
但是有很多指标和维度很难理解。是否有包含所有维度的所有矩阵的列表,以及有关如何使用它们查询指定服务的相关数据(例如实例,存储桶,EBS体积等)的示例。
修改
此图像包含Number of Hours at CPU Level (last 30 days)
,Number of Hours Running Overutilized (90% or more)
和Number of Hours Running Underutilized (5% or less)
还有Average CPU by Hour of Day (in the UTC/GMT Timezone)
和Average CPU by Day of Week
的图形。
如上图所示,我正在寻找查找成本和资源利用率值的方法,我想这可以使用AWS Cloud watch来完成,但不知道如何开始。因此,如果有人可以让我知道如何获得这样的价值,那将大有帮助。
谢谢