0

我无法启动应用程序

@EnableRdsInstance(databaseName = "test",
        dbInstanceIdentifier = "test",
        password = "password",
        username = "username",
        readReplicaSupport = true
)

我得到的例外是:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'test': Invocation of init method failed; nested exception is com.amazonaws.services.rds.model.AmazonRDSException: The security token included in the request is invalid. (Service: AmazonRDS; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 925519ec-582e-11e7-8ca6-8159eafdc3e8)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
    ...
Caused by: com.amazonaws.services.rds.model.AmazonRDSException: The security token included in the request is invalid. (Service: AmazonRDS; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 925519ec-582e-11e7-8ca6-8159eafdc3e8)
    at ...

尝试了Spring Cloud AWS Docs中建议的所有配置,包括 ENV 变量、System.setProperties() 和 application.yml,如下所示

cloud:
  aws:
    credentials:
      accessKey: XXXXXXX
      secretKey: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    region:
      static: us-east-2

还尝试在 aws-beans 中进行硬编码

<beans ...>

    <aws-context:context-credentials>
        <aws-context:simple-credentials access-key="XXXXXXXXXX" secret-key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
    </aws-context:context-credentials>

    <aws-context:context-resource-loader/>

    <aws-context:context-region region="us-east-2" />

</beans>

没有任何效果,感谢您的帮助....

4

1 回答 1

0

获得此异常的可能原因:

  • 确保为 RDS 实例启用公共访问,并允许安全组中您的机器的传入流量。
  • 确保互联网网关与 VPC 连接,非常重要的是,您必须使用公共子网而不是私有子网。
于 2017-06-24T04:34:12.410 回答