This solution can be scaled to any Aurora PostgreSQL database writer instances, including Aurora global databases and Aurora Serverless databases.Īll SQL scripts are under the $flyway_home/sql directory, which are deployed in Aurora PostgreSQL databases. They use different URLs pointing to two different Aurora PostgreSQL databases, as shown in the following screenshots. The two configuration files point to unique environments. Default config file is flyway.sql in this case it’s being used as a DEV environment $flyway_home/conf – to store config files to add database endpoints and credentials. Note the directory structure for Flyway software: We install Flyway community version 8.5.4 on Amazon EC2 for demonstration. To deploy changes into a unique environment, Flyway needs two different configuration files pointing to two different databases. An EventBridge rule that schedules the Lambda function to run at certain intervals.įor this post, we use two different Aurora PostgreSQL environments, dev and QA.An Amazon Simple Storage Service (Amazon S3) bucket to store the SQL files.A Lambda function to automate the database code changes from one database environment to another environment.For installation instructions, refer to Download and installation. We use the Flyway community edition in this post, and it has certain limitations. Flyway, an open-source database migration tool that helps to migrate SQL and manage changes from one environment to another environment.Also, an EC2 instance should have connectivity to Aurora database instances. This post doesn’t cover the security, high availability, and resiliency side of Amazon EC2 configurations. An EC2 instance for installing and configuring the Flyway software and deploying SQL files to keep track of changes of various SQLs and migrate them to different Aurora PostgreSQL databases.Two Aurora PostgreSQL instances to test and deploy scripts in one environment and, after successful completion, deploy that into another environment.To get started, you must have the following prerequisites: The following diagram illustrates the solution architecture. ![]() We can also keep track of changes that were completed successfully and are pending to be applied on respective databases. An Amazon EventBridge rule calls the Lambda function based on a schedule. We use a Lambda function to run the migrate command, which deploys SQL scripts to their respective databases. ![]() Instance and point the Flyway configuration to two different Aurora PostgreSQL databases. In this solution, we install Flyway on an Amazon Elastic Compute Cloud (Amazon EC2) With the help of Flyway, you can also undo or roll back migrations. Sometimes they’re used to correct reference data. You can use a versioned migration to create, alter, or drop an object. ![]() Migrations can be versioned or repeatable. In Flyway, all DDL and DML changes to the database are called migrations. Flyway overviewįlyway is an open-source database SQL deployment tool. You can do schema versioning and migrate from your sandbox to development, QA, and production, or you can add it to any other environment in your software development lifecycle. You can deploy quickly and schedule the function to run monthly, bi-weekly, or hourly. The solution in this post helps you centralize and deploy all your SQL scripts, which can be Data Definition Language (DDL) or Data Manipulation Language (DML). In this post, we explain how you can set up Flyway along with an AWS Lambda function to deploy SQL scripts into various Amazon Aurora PostgreSQL-Compatible Edition environments. To maintain environment integrity and consistency across applications, code and schema changes need to sync across multiple non-production and production environments. It’s very time-consuming when multiple developers are developing code and need to run multiple SQL files across multiple production databases. Monthly releases are always hectic, and companies face challenges with SQL deployments and schema versioning.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |