0

I am unable to start an application with

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

The exception I get is:

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 ...

Tried all configurations that are suggested in Spring Cloud AWS Docs including ENV variable, System.setProperties(), and in application.yml as below

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

also tried even hardcoding in in 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>

and nothing works, help is appreciated....

soundslikeodd
  • 1,078
  • 3
  • 19
  • 32
Somasundaram Sekar
  • 5,244
  • 6
  • 43
  • 85

1 Answers1

0

Possible reasons to get this exception:

  • Make sure public access is enabled for RDS Instance and allow incoming traffic for your machine in Security Group.
  • Make sure internet gateway is attached with VPC and very importantly you have to use public subnet rather than private subnet.
Kumaresh Babu N S
  • 1,648
  • 5
  • 23
  • 39