How can we help you today? How can we help you today?

Flyway on AWS lambda doesn't execute the sql script inside migration folder.

I plain to write code Flyway on the lambda function and invoke it from github actions. But It seem Flyway doesn't execute my SQL script on the lambda Environment although it can execute SQL script on the Local.

My Java code: 
public class FlywayHandler {
private final String endpoint = System.getenv("ENDPOINT");
private final String jdbcUsername = System.getenv("USERNAME");
private final String jdbcPassword = System.getenv("PASSWORD");
private final String jdbcUrl = "jdbc:mysql://" + endpoint + ":3306/test_3";
public void handleRequest() {
Flyway flyway = Flyway.configure()
.locations("db/migration")
.dataSource(jdbcUrl, jdbcUsername, jdbcPassword)
.load();
flyway.migrate();
}
}

I tested it on the local and it works well.
But when I deploy on the AWS Lambda, I invoke the  AWS lambda function, it just creates table `flyway_schema_history`  without run script inside folder `db/migration`. (I already drop and re-create database).

- My tech use.
+ AWS Lambda
+ Java 21
+ Aurora Mysql 8.0
+ Maven
+ flyway-mysql: 10.11.1

Could you help me investigate it? 
Thank you so much!!
nghiabv120100
0

Comments

1 comment

  • Piers_Williams
    Do you have the code/configuration for AWS Lambda that relates to mounting the migration scripts? I wonder if the file paths are different between local and AWS
    Piers_Williams
    0

Add comment

Please sign in to leave a comment.