我正在尝试按照此处的说明进行操作:
https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/generating-sdk-metrics.html
我已经将-Dcom.amazonaws.sdk.enableDefaultMetrics = cloudwatchRegion = eu-west-2添加到了Java选项中。我还在maven pom中添加了以下依赖项:
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-cloudwatch</artifactId>
<version>1.11.557</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-dynamodb</artifactId>
<version>1.11.557</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>1.11.557</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-cloudwatchmetrics</artifactId>
<version>1.11.557</version>
<scope>provided</scope>
</dependency>
在具有正确iam角色和策略的ec2实例上,docker容器可以正常运行。但是,如文档所示,没有适用于AWSSDK / Java的cloudwatch命名空间。
答案 0 :(得分:0)
这使用了另一个依赖项,将 aws-java-sdk-cloudwatchmetrics 更改为 aws-java-sdk-cloudwatchmetrics 。
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-cloudwatchmetrics</artifactId>
<version>1.11.557</version>
<scope>provided</scope>
</dependency>