Java 带S3 bucket的AWS成本使用API

Java 带S3 bucket的AWS成本使用API,java,amazon-web-services,aws-sdk,Java,Amazon Web Services,Aws Sdk,我使用以下代码从AWS获取成本使用数据 GetCostAndUsageRequest request = new GetCostAndUsageRequest(); DateInterval interval = new DateInterval(); interval.setStart("2020-09-03"); interval.setEnd("2020-09-04"); Expression expression = new Expression

我使用以下代码从AWS获取成本使用数据

GetCostAndUsageRequest request = new GetCostAndUsageRequest();
DateInterval interval = new DateInterval();
interval.setStart("2020-09-03");
interval.setEnd("2020-09-04");

Expression expression = new Expression();
DimensionValues dimension = new DimensionValues();
dimension.setKey("SERVICE");
dimension.setValues(Arrays.asList("Amazon Simple Storage Service"));
expression.withDimensions(dimension);

request.withGranularity(Granularity.DAILY).withTimePeriod(interval).withFilter(expression).withMetrics("UsageQuantity");
AWSCostExplorer awsCostExplorer = this.getAWSCostExplorerClient();
GetCostAndUsageResult result = awsCostExplorer.getCostAndUsage(request);
List<ResultByTime> byTime = result.getResultsByTime();
相反,我希望检索按照每个bucket分组的数据,类似于文档中描述的内容:


CSV显示按存储桶分组的数据。我希望使用API实现同样的功能。有人能解释一下,我需要在上面的API调用中配置哪些附加标志吗?

添加一个维度为
USAGE\u TYPE
GroupBy
似乎提供了更多信息,但我看不到如何按bucket名称分组。这可能值得一通AWS支持电话。让我们知道你发现了什么!