我正在使用 Spring Boot 2.0.9.RELEASE 并试图弄清楚如何为我在 EC2 实例上运行的应用程序配置 CloudWatch 监控。我所做的可以从我对这个问题的回答中看出。但是我遇到了以下异常:
ERROR Oct 23, 2019 12:20:06.881 [pool-2-thread-30] {} io.micrometer.cloudwatch.CloudWatchMeterRegistry:134 - error sending metric data.
com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain: [com.amazonaws.auth.profile.ProfileCredentialsProvider@32ee6fee: profile file cannot be null]
at com.amazonaws.auth.AWSCredentialsProviderChain.getCredentials(AWSCredentialsProviderChain.java:136) ~[aws-java-sdk-core-1.11.641.jar!/:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.getCredentialsFromContext(AmazonHttpClient.java:1225) ~[aws-java-sdk-core-1.11.641.jar!/:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.runBeforeRequestHandlers(AmazonHttpClient.java:801) ~[aws-java-sdk-core-1.11.641.jar!/:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:751) ~[aws-java-sdk-core-1.11.641.jar!/:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:744) ~[aws-java-sdk-core-1.11.641.jar!/:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:726) ~[aws-java-sdk-core-1.11.641.jar!/:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:686) ~[aws-java-sdk-core-1.11.641.jar!/:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:668) ~[aws-java-sdk-core-1.11.641.jar!/:?]
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:532) ~[aws-java-sdk-core-1.11.641.jar!/:?]
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:512) ~[aws-java-sdk-core-1.11.641.jar!/:?]
at com.amazonaws.services.cloudwatch.AmazonCloudWatchClient.doInvoke(AmazonCloudWatchClient.java:2027) ~[aws-java-sdk-cloudwatch-1.11.641.jar!/:?]
at com.amazonaws.services.cloudwatch.AmazonCloudWatchClient.invoke(AmazonCloudWatchClient.java:1994) ~[aws-java-sdk-cloudwatch-1.11.641.jar!/:?]
at com.amazonaws.services.cloudwatch.AmazonCloudWatchClient.invoke(AmazonCloudWatchClient.java:1983) ~[aws-java-sdk-cloudwatch-1.11.641.jar!/:?]
at com.amazonaws.services.cloudwatch.AmazonCloudWatchClient.executePutMetricData(AmazonCloudWatchClient.java:1754) ~[aws-java-sdk-cloudwatch-1.11.641.jar!/:?]
at com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient$20.call(AmazonCloudWatchAsyncClient.java:972) [aws-java-sdk-cloudwatch-1.11.641.jar!/:?]
at com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient$20.call(AmazonCloudWatchAsyncClient.java:966) [aws-java-sdk-cloudwatch-1.11.641.jar!/:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_191]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_191]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_191]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]
奇怪的是,我在之前的尝试中已经设法将指标放入 CloudWatch,但我不知道我破坏了什么。我没有做梦。我仍然可以看到指标^^。
根据我的阅读,我必须对我的 EC2 实例的 IAM 角色做一些事情,但我在这里迷路了。