java – No database instance with id: found. Please specify a valid db instance
I had the same problem.
spring-cloud-aws probably cant resolve the proper
aws region on its own. If youre only on one region, insert this into your properties file with the region where your RDS instance is placed.
This solved the problem for me.
You could also try with:
to see if the EC2 meta data service can resolve the correct region.
It is also possible to connect via. normal spring-boot settings, where you simply specify the RDS instance endpoint in the url of the datasource like so: (for a postgresql instance)
and of course supply the
spring.jpa.database in your application.properties aswell.
The accepted answer did not work for me.
After some debugging I found the application.properties as given in the question is not correct:
#RDS cloud.aws.rds.mainrds #this line has to be deleted cloud.aws.rds.mainrds.username=dbadmin cloud.aws.rds.mainrds.password=password cloud.aws.rds.mainrds.readReplicaSupport=false cloud.aws.rds.mainrds.databasename=maindata
After deleting the line
cloud.aws.rds.mainrds everything worked just fine.
spring.datasource.* is not an option because we are using IAM authentication for RDS and therefore the password has to be regenerated every 15 minutes.