Giter VIP home page Giter VIP logo

terraform-aws-rds-aurora's Introduction

Note: This module is in alpha state and is likely to contain bugs and updates may introduce breaking changes. It is not recommended for production use at this time.

Terraform Amazon Aurora

Terraform module for automating deployment of Amazon Aurora and related resources following AWS best practices.

Supported Features

  • Aurora Provisioned cluster (MySQL & PostgreSQL)
  • Aurora Global databases (MySQL & PostgreSQL)

Deployment Procedure

To deploy the Terraform Amazon Aurora module, do the following:

  1. Install Terraform. For instructions and a video tutorial, see Install Terraform.

  2. Sign up and log into Terraform Cloud (There is a free tier available).

    1. Create a Terraform organization.
  3. Configure Terraform Cloud API access. Run the following to generate a Terraform Cloud token from the command line interface:

    terraform login
    
    --For Mac/Linux
    export TERRAFORM_CONFIG="$HOME/.terraform.d/credentials.tfrc.json"
    
    --For Windows
    export TERRAFORM_CONFIG="$HOME/AppData/Roaming/terraform.d/credentials.tfrc.json"
    
  4. Install and configure the AWS Command Line Interface (AWS CLI).

  5. If you don't have git installed, install git.

  6. Clone this aws-ia/terraform-aws-rds-aurora repository using the following command:

    git clone https://github.com/aws-ia/terraform-aws-rds-aurora.git

  7. Change directory to the root repository directory.

    cd terraform-aws-rds-aurora/

  8. Set up a new terraform workspace.

    cd setup_workspace
    terraform init
    terraform apply
    
  9. Deploy Aurora Terraform module.

    1. To create VPC and deploy Aurora module
      • Change to the deploy directory. Run cd ../deploy
      • Initialize the deploy directory. Run terraform init.
      • Start a Terraform run using the configuration files in your deploy directory. Run terraform apply or terraform apply -var-file="$HOME/.aws/terraform.tfvars" (Note: The deployment is remotely run in Terraform Cloud)
    2. To deploy Aurora module into existing VPCs, pass the list of private subnets (var.Private_subnet_ids_p & var.Private_subnet_ids_s) directly to the Aurora module.

Authors and Contributors

David Wright ([email protected]), Tony Vattahil ([email protected]), Arabinda Pani ([email protected]) and other contributors.

Requirements

Name Version
terraform >= 1.3.0
aws >= 5.30
random >= 2.2

Providers

Name Version
aws >= 5.30
aws.primary >= 5.30
aws.secondary >= 5.30
random >= 2.2

Modules

No modules.

Resources

Name Type
aws_cloudwatch_metric_alarm.cpu_util_p resource
aws_cloudwatch_metric_alarm.cpu_util_s resource
aws_cloudwatch_metric_alarm.free_local_storage_p resource
aws_cloudwatch_metric_alarm.free_local_storage_s resource
aws_cloudwatch_metric_alarm.free_random_access_memory_p resource
aws_cloudwatch_metric_alarm.free_random_access_memory_s resource
aws_cloudwatch_metric_alarm.pg_max_used_tx_ids_p resource
aws_cloudwatch_metric_alarm.pg_max_used_tx_ids_s resource
aws_db_event_subscription.default_p resource
aws_db_event_subscription.default_s resource
aws_db_parameter_group.aurora_db_parameter_group_p resource
aws_db_parameter_group.aurora_db_parameter_group_s resource
aws_db_subnet_group.private_p resource
aws_db_subnet_group.private_s resource
aws_iam_role.rds_enhanced_monitoring resource
aws_kms_key.kms_p resource
aws_kms_key.kms_s resource
aws_rds_cluster.primary resource
aws_rds_cluster.secondary resource
aws_rds_cluster_instance.primary resource
aws_rds_cluster_instance.secondary resource
aws_rds_cluster_parameter_group.aurora_cluster_parameter_group_p resource
aws_rds_cluster_parameter_group.aurora_cluster_parameter_group_s resource
aws_rds_global_cluster.globaldb resource
aws_sns_topic.default_p resource
aws_sns_topic.default_s resource
random_id.snapshot_id resource
random_password.master_password resource
aws_availability_zones.region_p data source
aws_availability_zones.region_s data source
aws_iam_policy_document.monitoring_rds_assume_role data source
aws_partition.current data source
aws_rds_engine_version.family data source

Inputs

Name Description Type Default Required
password Master DB password string n/a yes
private_subnet_ids_p A list of private subnet IDs in your Primary AWS region VPC list(string) n/a yes
private_subnet_ids_s A list of private subnet IDs in your Secondary AWS region VPC list(string) n/a yes
region The name of the primary AWS region you wish to deploy into string n/a yes
sec_region The name of the secondary AWS region you wish to deploy into string n/a yes
allow_major_version_upgrade Enable to allow major engine version upgrades when changing engine versions. Defaults to false bool true no
auto_minor_version_upgrade Determines whether minor engine upgrades will be performed automatically in the maintenance window bool true no
backup_retention_period How long to keep backups for (in days) number 7 no
database_name Name for an automatically created database on cluster creation string "mydb" no
enable_audit_log Enable MySQL audit log export to Amazon Cloudwatch. bool false no
enable_error_log Enable MySQL error log export to Amazon Cloudwatch. bool false no
enable_general_log Enable MySQL general log export to Amazon Cloudwatch. bool false no
enable_postgresql_log Enable PostgreSQL log export to Amazon Cloudwatch. bool false no
enable_slowquery_log Enable MySQL slowquery log export to Amazon Cloudwatch. bool false no
engine Aurora database engine type: aurora (for MySQL 5.6-compatible Aurora), aurora-mysql (for MySQL 5.7-compatible Aurora), aurora-postgresql string "aurora-postgresql" no
engine_version_mysql Aurora database engine version. string "8.0.mysql_aurora.3.05.1" no
engine_version_pg Aurora database engine version. string "15.4" no
final_snapshot_identifier_prefix The prefix name to use when creating a final snapshot on cluster destroy, appends a random 8 digits to name to ensure it's unique too. string "final" no
identifier Cluster identifier string "aurora" no
instance_class Aurora DB Instance type. Specify db.serverless to create Aurora Serverless v2 instances. string "db.r7g.large" no
manage_master_user_password Manage master user password using AWS Secrets Manager bool false no
monitoring_interval Enhanced Monitoring interval in seconds number 1 no
name Prefix for resource names string "aurora" no
port The port on which to accept connections string "" no
preferred_backup_window When to perform DB backups string "02:00-03:00" no
primary_instance_count instance count for primary Aurora cluster number 2 no
secondary_instance_count instance count for secondary Aurora cluster number 1 no
serverless_v2_max_acu Aurora Serverless v2 Maximum ACU number 16 no
serverless_v2_min_acu Aurora Serverless v2 Minimum ACU number 0.5 no
setup_as_secondary Setup aws_rds_cluster.primary Terraform resource as Secondary Aurora cluster after an unplanned Aurora Global DB failover bool false no
setup_globaldb Setup Aurora Global Database with 1 Primary and 1 X-region Secondary cluster bool false no
skip_final_snapshot skip creating a final snapshot before deleting the DB bool true no
snapshot_identifier id of snapshot to restore. If you do not want to restore a db, leave the default empty string. string "" no
storage_encrypted Specifies whether the underlying Aurora storage layer should be encrypted bool false no
storage_type Specifies Aurora storage type: Aurora Standard vs. Aurora I/O-Optimized string "" no
tags A map of tags to add to all resources. map(string)
{
"Name": "aurora-db"
}
no
username Master DB username string "root" no

Outputs

Name Description
aurora_cluster_database_name Name for an automatically created database on Aurora cluster creation
aurora_cluster_master_password Aurora master User password
aurora_cluster_master_username Aurora master username
primary_aurora_cluster_arn The ARN of the Primary Aurora cluster
primary_aurora_cluster_endpoint Primary Aurora cluster endpoint
primary_aurora_cluster_hosted_zone_id Route53 hosted zone id of the Primary Aurora cluster
primary_aurora_cluster_id The ID of the Primary Aurora cluster
primary_aurora_cluster_instance_endpoints A list of all Primary Aurora cluster instance endpoints
primary_aurora_cluster_instance_ids A list of all Primary Aurora cluster instance ids
primary_aurora_cluster_port Primary Aurora cluster endpoint port
primary_aurora_cluster_reader_endpoint Primary Aurora cluster reader endpoint
primary_aurora_cluster_resource_id The Cluster Resource ID of the Primary Aurora cluster
secondary_aurora_cluster_arn The ARN of the Secondary Aurora cluster
secondary_aurora_cluster_endpoint Secondary Aurora cluster endpoint
secondary_aurora_cluster_hosted_zone_id Route53 hosted zone id of the Secondary Aurora cluster
secondary_aurora_cluster_id The ID of the Secondary Aurora cluster
secondary_aurora_cluster_instance_endpoints A list of all Secondary Aurora cluster instance endpoints
secondary_aurora_cluster_instance_ids A list of all Secondary Aurora cluster instance ids
secondary_aurora_cluster_port Secondary Aurora cluster endpoint port
secondary_aurora_cluster_reader_endpoint Secondary Aurora cluster reader endpoint
secondary_aurora_cluster_resource_id The Cluster Resource ID of the Secondary Aurora cluster

terraform-aws-rds-aurora's People

Contributors

tonynv avatar censullo avatar catcharbind avatar aws-coutl avatar tbulding avatar dawright22 avatar drewmullen avatar andrew-glenn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.