kummaradrishika / terraform-aws-rds-aurora

AWS RDS Aurora Module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 (dwright@hashicorp.com), Tony Vattahil (tonynv@amazon.com), Arabinda Pani (arabindp@amazon.com) and other contributors.

Requirements

Name Version
terraform >= 1.0.0
aws >= 4.9.0
random >= 2.2

Providers

Name Version
aws >= 4.9.0
aws.primary >= 4.9.0
aws.secondary >= 4.9.0
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 "5.7.mysql_aurora.2.10.2" no
engine_version_pg Aurora database engine version. string "13.6" 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 Instance type to use at replica instance string "db.r5.large" 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
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
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_arn The ARN of the Primary Aurora cluster
aurora_cluster_database_name Name for an automatically created database on Aurora cluster creation
aurora_cluster_endpoint Primary Aurora cluster endpoint
aurora_cluster_hosted_zone_id Route53 hosted zone id of the Primary Aurora cluster
aurora_cluster_id The ID of the Primary Aurora cluster
aurora_cluster_instance_endpoints A list of all Primary Aurora cluster instance endpoints
aurora_cluster_instance_ids A list of all Primary Aurora cluster instance ids
aurora_cluster_master_password Aurora master User password
aurora_cluster_master_username Aurora master username
aurora_cluster_port Primary Aurora cluster endpoint port
aurora_cluster_reader_endpoint Primary Aurora cluster reader endpoint
aurora_cluster_resource_id The Cluster Resource ID of the Primary Aurora cluster

About

AWS RDS Aurora Module


Languages

Language:HCL 100.0%