0

我正在尝试按照此处的说明进行操作。

我已添加-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>

docker 容器在具有正确 iam 角色和策略的 ec2 实例上运行良好。但是,正如文档所建议的那样,AWS SDK/Java 没有 CloudWatch 命名空间。

4

1 回答 1

1

这使用了另一个依赖项,将aws-java-sdk-cloudwatch 更改aws-java-sdk-cloudwatchmetrics

<dependency>
  <groupId>com.amazonaws</groupId>
  <artifactId>aws-java-sdk-cloudwatchmetrics</artifactId>
  <version>1.11.557</version>
  <scope>provided</scope>
</dependency>
于 2019-12-18T17:58:37.240 回答