Introducing the AWS Database Acceleration Toolkit (DAT), an innovative open-source solution designed to enhance database performance. Utilizing Terraform, DAT streamlines the initial setup, provisioning, and ongoing maintenance of Amazon Aurora. By leveraging this toolkit, organizations can significantly reduce their time to market, thereby boosting customer satisfaction and optimizing cost efficiency. This article delves into DAT’s architecture, key features, and the process of creating a new Aurora cluster.
DAT is particularly beneficial for various types of organizations, including DevOps teams, software as a service (SaaS) providers managing multi-tenant databases, and enterprises transitioning from commercial databases to Aurora. The toolkit was developed from insights gained while assisting a large SaaS provider that experienced transformative results. For instance, one customer was able to cut their database migration time from 12 months to just 4 weeks for over 100 databases, maintain zero outages over a six-month span, enhance database team productivity by 60 to 70%, and lower infrastructure costs by 42%. While outcomes may differ, these results illustrate DAT’s potential to revolutionize database operations and yield substantial improvements in efficiency and reliability.
Solution overview
The architecture of DAT is designed for simplicity and effectiveness:
- DAT employs Terraform for automated resource provisioning and security. The source code is available in a Git repository to facilitate collaboration and version control.
- The toolkit offers multiple options for provisioning Aurora clusters in AWS:
- Using the Terraform command line interface (CLI)
- Utilizing Jenkins pipelines
This flexibility enables users to select the method that best aligns with their existing workflows and tools.
- DAT comprises specialized Terraform modules aimed at facilitating the setup of Aurora:
- Aurora cluster: This module simplifies the creation of a new Aurora cluster within an existing Amazon Virtual Private Cloud (VPC) environment or from the latest database snapshot. It allows for customization of cluster configurations, significantly reducing manual effort and time. Aurora supports both serverless and provisioned modes, offering flexibility based on application requirements.
- Amazon RDS Proxy for Aurora cluster: This feature enhances application performance and reliability by pooling database connections, minimizing connection overhead, and improving security with credential management and failover support. The Amazon RDS Proxy module enables the generation of a proxy for an existing Aurora cluster, enhancing connectivity and availability.
- Aurora GlobalDB: This module allows for the creation of Aurora Global Database clusters across primary and secondary AWS Regions, facilitating rapid disaster recovery and globally distributed read access.
- Aurora Monitoring: This module configures Amazon CloudWatch monitoring dashboards for Aurora databases, presenting key performance metrics and insights for efficient monitoring of database health, performance, and usage.
Use case examples
The Git repository contains use case examples with step-by-step instructions for implementing these modules on both Aurora PostgreSQL-Compatible and Aurora MySQL-Compatible engines. These examples serve as practical guides, providing detailed steps and automation scripts for executing various operations related to Aurora databases.
Aurora MySQL-Compatible examples
aurora-mysql-cluster-existing-vpc
aurora-mysql-cluster-global-db
aurora-mysql-cluster-latest-snapshot
aurora-mysql-dbproxy
aurora-mysql-monitoring
Aurora PostgreSQL-Compatible examples
aurora-postgres-cluster-existing-vpc
aurora-postgres-cluster-global-db
aurora-postgres-cluster-latest-snapshot
aurora-postgres-dbproxy
aurora-postgres-monitoring
After reviewing the prerequisites and deployment options, we guide you through an example deployment using an Aurora PostgreSQL cluster and Terraform.
Prerequisites
Ensure you have the following tools installed locally:
- Access to an AWS account. If you don’t have one, you can create a new AWS account.
- Install and configure the AWS Command Line Interface (AWS CLI).
- Install Terraform.
- Install git.
Deployment options
You can deploy AWS DAT using any of the following three options:
- Deployment using Terraform: This straightforward approach allows direct interaction with Terraform commands, offering flexibility and customization.
- Deployment using a new Jenkins instance: For those who prefer an integrated automation approach, this option involves provisioning a new Jenkins server, configuring it, and setting up pipelines to deploy DAT examples.
- Deployment using an existing Jenkins instance: If you already have a Jenkins setup, you can integrate DAT with your current environment, extending your automation processes to include DAT deployment.
Provision an Aurora PostgreSQL cluster using Terraform
Follow these steps to provision a new Aurora PostgreSQL cluster using Terraform CLI with one writer and one reader instance, with customization options available:
- Clone the source code from the DAT repository, which contains the necessary usage examples and Terraform modules.
git clone https://github.com/aws-samples/aws-database-acceleration-toolkit.git
- Navigate to the Aurora PostgreSQL folder.
cd aws-database-acceleration-toolkit/examples/aurora-postgres-cluster-existing-vpc
- Review the Terraform variable definition file called
terraform.tfvars
and configure the values for the variables as needed for your use case.#(mandatory) AWS Region where your resources will be located # For example: "us-west-2" region = "" # VPC Id where your resources will be located. # For example: "vpc-11112222333344445" vpc_id = "" # Database Engine for your Aurora mysql Cluster. engine = "aurora-postgresql" # Database engine version (optional). If not specified, the default version for the selected engine will be used. # For example: "15.3" engine_version = "" # Database engine mode. Valid value: provisioned # Refer AWS documentation for supported regions and engine versions for engine mode engine_mode = "provisioned" # DB Instance class. # Refer AWS documentation for supported DB instance class for DB engine. # For example: "db.r6g.large" instance_class ="" # Specify number of DB instances to be created in the cluster. # Optionally, you can pass the configuration parameters and values (for e.g., instance_class="db.r6g.xlarge") for each instance within the curly braces. # If no parameters are specified, all the DB instances will be created with the same values. instances = { instance1 = {} instance2 = {} } # Database cluster name # For example: "aurora-pg-poc" name = "" # Database environment # For example: "dev" environment = "" # Tagging : Team/Group Name # For example: "data-engineering" groupname = "" # Tagging : Project or Application Name # For example: "myapp" project = "" # Skip final snapshot during cluster deletion (optional). If set to 'true' (default), no final snapshot will be taken before deleting the cluster. skip_final_snapshot= "true"
- Initialize the working directory using the
terraform init
command.terraform init
- Execute the
terraform plan
command to create an execution plan, allowing you to preview the proposed changes that Terraform will make to your infrastructure.terraform plan -var-file terraform.tfvars
- Finally, execute the
terraform apply
command to implement the actions proposed in the plan. This command may take up to 15 minutes to complete. Upon successful deployment, you can view the new Aurora cluster using the AWS Management Console.terraform apply -var-file terraform.tfvars
Additional aspects
DAT enhances the security posture of database operations through robust encryption practices, secure credential management, flexible authentication, and comprehensive logging and monitoring capabilities:
- DAT allows the use of your own customer managed keys (CMKs), enabling you to rotate keys according to your policies. If a CMK is not provided, DAT defaults to an AWS managed key.
- Integration with AWS Secrets Manager allows for centralized and secure management of master user passwords for database clusters.
- DAT provides options for preferred authentication methods, defaulting to password authentication if none is specified.
- Enhanced monitoring and visualization of database activities are facilitated, crucial for performance tracking, troubleshooting, and security monitoring. DAT publishes events from your Aurora PostgreSQL DB cluster’s PostgreSQL log to CloudWatch, allowing the creation of dashboards based on available log data.
Cleanup
To clean up your environment, destroy the Aurora cluster created using Terraform by executing the following command:
terraform destroy -var-file terraform.tfvars
About the authors
Piyush Mattoo is a Senior Solution Architect for the Financial Services Data Provider segment at AWS, with over a decade of experience in building scalable software systems. He is based in Southern California and enjoys outdoor activities.
Mitesh Purohit serves as a Senior Solutions Architect at AWS in Dallas, TX, focusing on helping ISV fintech customers modernize on the cloud. His expertise includes serverless architectures and microservices.
Ravi Mathur is a Senior Solutions Architect at AWS, providing technical assistance and architectural guidance on various AWS services, backed by years of experience in software engineering.
Munish Dabra is a Principal Solutions Architect at AWS, specializing in AI/ML and Containers, with a strong background in designing scalable distributed systems.
Mythili Annamalai Sekar is a Solutions Architect at AWS, focusing on providing technical assistance to ISV customers, with a strong background in BPM applications and current interests in Serverless and AI/ML.