Elastic BeanstalkにSpring Bootアプリをデプロイ中に以下のような502 Bad Gateway(Nginx)エラーが発生しました。
色々調べてみると、ロードバランサーやポート番号の設定ミスが原因になることがあるらしいが、それは問題なさそう。ここで、RDSでデータベース作成の際に指定したDB名とapplication.propertiesファイルに記述したDB名が違っていることに気づく。
本来以下のようにapplication.properties内に記述するべきところ、
application.properties
spring.datasource.url=jdbc:mysql://{エンドポイント}:3306/db_ems_1
このようにDB名を記述していました。
application.properties
spring.datasource.url=jdbc:mysql://{エンドポイント}:3306/ems_db_1
今後はこのような簡単なミスをしないようにしたいですね。