Cluster endpoint: The endpoint for the whole cluster. You should always use this URL for writes, as it points to
the primary.
Instance endpoints: A comma-separated list of all DB instance URLs in the cluster, including the primary and all
read replicas. Use these URLs for reads (see "How do you scale this DB?" below).
Port: The port to use to connect to the endpoints above.
You can programmatically extract these variables in your Terraform templates and pass them to other resources (e.g.
pass them to User Data in your EC2 instances). You'll also see the variables at the end of each terraform apply call
or if you run terraform output.
How do you scale this database?
Storage: Aurora manages storage for you, automatically growing cluster volume in 10GB increments up to 64TB.
Vertical scaling: To scale vertically (i.e. bigger DB instances with more CPU and RAM), use the instance_type
input variable. For a list of AWS RDS server types, see Aurora Pricing.
Horizontal scaling: To scale horizontally, you can add more replicas using the instance_count input variable,
and Aurora will automatically deploy the new instances, sync them to the master, and make them available as read
replicas.
This module allows you to configure a number of parameters, such as backup windows, maintenance window, port number,
and encryption. For a list of all available variables and their descriptions, see vars.tf.
Known Issues
Requires terraform provider version 1.32 or newer due to the serverless options
DBInstance not found
As of August 29, 2017, Terraform 0.10.x has an issue where when you apply an RDS Aurora Instance for the first time, you may sometimes receive the following error:
aws_rds_cluster.cluster_with_encryption: Error modifying DB Instance aurora-test: DBInstanceNotFound: DBInstance not found: aurora-test
status code: 404, request id: 040094aa-8c62-11e7-baa6-0d7ac77494f1
This error occurs because Terraform first creates the database cluster, then creates one or more database instances, and then queries the AWS API for the IDs of those database instances. But Terraform does not wait long enough for the AWS API to propagate these instances to all AWS API endpoints, so AWS initially replies that the given database instance name was not found.
Fortunately, this issue has a simple fix. After waiting a few seconds, the AWS API will not return the database instances that we expect, so simply re-run terraform apply and the operation should complete successfully.
Questions? Ask away.
We're here to talk about our services, answer any questions, give advice, or just to chat.
{"treedata":{"name":"root","toggled":true,"children":[{"name":".circleci","children":[{"name":"config.yml","path":".circleci/config.yml","sha":"c3cbb3eb78791fbd6c701afb0f06125367ef162c"}]},{"name":".gitignore","path":".gitignore","sha":"13b2bbfb93f58d19fe66d274069b96f32ca5901e"},{"name":".pre-commit-config.yaml","path":".pre-commit-config.yaml","sha":"dd17d910687309b3ad64bae6e967df72e5417357"},{"name":"CODEOWNERS","path":"CODEOWNERS","sha":"f6e0666fa0dee5df6743291167734a2bcfbb359b"},{"name":"LICENSE.txt","path":"LICENSE.txt","sha":"f4e3d9bd4717a044ed31ad847a300eee74371a78"},{"name":"README.adoc","path":"README.adoc","sha":"3febc0568334062c8b19707fc4dbcb3d6ab5450b"},{"name":"_docs","children":[{"name":"aurora-serverless.png","path":"_docs/aurora-serverless.png","sha":"5a53145be56705c76f7f7aa6a25aa0ddee78e4a3"},{"name":"aurora.png","path":"_docs/aurora.png","sha":"fc218831bfa34097a56f1b0e47fe05521bdb4a8a"},{"name":"data-backup-architecture.png","path":"_docs/data-backup-architecture.png","sha":"fcc7ce8753e28c19af87ea5cea96e6ded648d429"},{"name":"data-backup.png","path":"_docs/data-backup.png","sha":"116b10f231073f8c52255ca98e48cc228c48a2c3"},{"name":"mariadb.png","path":"_docs/mariadb.png","sha":"d540d3d3ff8797c4a4c3a62c65e7d3f63621568f"},{"name":"mysql.png","path":"_docs/mysql.png","sha":"73b55bd0d517dcba53c878712544abf96be3a66e"},{"name":"oracle.png","path":"_docs/oracle.png","sha":"b5f1ca801f5af4a30f1b812eea17cec516c1fe6c"},{"name":"postgresql.png","path":"_docs/postgresql.png","sha":"fd9c7ec282aef38a5813e8542d92227b96bd5be8"},{"name":"rds-architecture.png","path":"_docs/rds-architecture.png","sha":"8f2b1b5b4015a5777032c6aa64627ceee24330fc"},{"name":"sqlserver.png","path":"_docs/sqlserver.png","sha":"a800d188398262593f4f89f27c8f3ce2ce1e76a4"}]},{"name":"examples","children":[{"name":"aurora-global-cluster","children":[{"name":"README.md","path":"examples/aurora-global-cluster/README.md","sha":"7d62dc3c8cd0e96131ee4e31a4b54829fa052166"},{"name":"main.tf","path":"examples/aurora-global-cluster/main.tf","sha":"86f00cb270ff79546ce995fb6c2e204016745d28"},{"name":"outputs.tf","path":"examples/aurora-global-cluster/outputs.tf","sha":"105d706d41684b4c7be092ebd43bf6ba8ebf6f80"},{"name":"vars.tf","path":"examples/aurora-global-cluster/vars.tf","sha":"29b33911054fde667cd778658a7bc63f3a61bedd"}]},{"name":"aurora","children":[{"name":"README.md","path":"examples/aurora/README.md","sha":"5113121e2255b63fa7609fe25dfb9b2555715655"},{"name":"main.tf","path":"examples/aurora/main.tf","sha":"787286c5e4167d802e5c856a51ba47490f8c1f35"},{"name":"outputs.tf","path":"examples/aurora/outputs.tf","sha":"142569b7d9772c741ee28846de617f5a4b7f0d84"},{"name":"vars.tf","path":"examples/aurora/vars.tf","sha":"f3aa6ab272a9609d375debf73af3a5f49af22bf4"}]},{"name":"lambda-rds-snapshot","children":[{"name":"README.md","path":"examples/lambda-rds-snapshot/README.md","sha":"d7422ca3a039c7e1056c17fc73fbbddfddce6741"},{"name":"main.tf","path":"examples/lambda-rds-snapshot/main.tf","sha":"26a6137e66ba6b712bdf6177cd5ba37bdccaaf38"},{"name":"outputs.tf","path":"examples/lambda-rds-snapshot/outputs.tf","sha":"375c8bb979dd4133c3675d9e6263e1138c448973"},{"name":"vars.tf","path":"examples/lambda-rds-snapshot/vars.tf","sha":"7719435a118a83273f733398c1b579d916a76c9c"}]},{"name":"rds-mariadb","children":[{"name":"README.md","path":"examples/rds-mariadb/README.md","sha":"6540229dddcb38071d37b6697762d27a54e28cc8"},{"name":"main.tf","path":"examples/rds-mariadb/main.tf","sha":"6e057cc1d3dee3f67c075d7094132c4b341bcbe8"},{"name":"outputs.tf","path":"examples/rds-mariadb/outputs.tf","sha":"bd45b0035943021763d0365da3fe0d1e9f9b16b9"},{"name":"vars.tf","path":"examples/rds-mariadb/vars.tf","sha":"6a8212a3c4e8d4bbd1fe6f000bb699b9f5ecf1e0"}]},{"name":"rds-mysql","children":[{"name":"README.md","path":"examples/rds-mysql/README.md","sha":"6a7fb5d5560cc42ec9a6ac830358aa7ab7ca502d"},{"name":"main.tf","path":"examples/rds-mysql/main.tf","sha":"0d75918ebe89cdb708fa459db9c1938a9dc598eb"},{"name":"outputs.tf","path":"examples/rds-mysql/outputs.tf","sha":"e2ae2afdbcc0d27baa5d50be333f9d0a717e1a33"},{"name":"vars.tf","path":"examples/rds-mysql/vars.tf","sha":"a54ce8449d94444f4d0d122e267fe1b3039ac6f8"}]},{"name":"rds-postgres","children":[{"name":"README.md","path":"examples/rds-postgres/README.md","sha":"ab4e18c200fc749a54ee700223d27261c731e436"},{"name":"main.tf","path":"examples/rds-postgres/main.tf","sha":"c0290c5ed183e848900bff33c75816799755019e"},{"name":"outputs.tf","path":"examples/rds-postgres/outputs.tf","sha":"5371c2284c0ea3d4de5790077ba45d9d445c2965"},{"name":"vars.tf","path":"examples/rds-postgres/vars.tf","sha":"ad285f33a53435e2039d5c0c88ba49a214335093"}]},{"name":"rds-sqlserver","children":[{"name":"README.md","path":"examples/rds-sqlserver/README.md","sha":"26bf52d347c247e5f63bc113476e87d75375ba84"},{"name":"main.tf","path":"examples/rds-sqlserver/main.tf","sha":"376fd7e96798604d81c1a8526f204114500ff835"},{"name":"outputs.tf","path":"examples/rds-sqlserver/outputs.tf","sha":"a1726fd73528af38b436c053128f24a17da740c3"},{"name":"vars.tf","path":"examples/rds-sqlserver/vars.tf","sha":"dabccb3da2548b8a9e302ed5e9be01b18c275ca9"}]},{"name":"rds-with-replicas","children":[{"name":"README.md","path":"examples/rds-with-replicas/README.md","sha":"327357a98e9b2bbf650d91a207bd96fc4a6f452f"},{"name":"main.tf","path":"examples/rds-with-replicas/main.tf","sha":"482c9f4c0fef0d1fcdb601a04fd0c1ab47489124"},{"name":"outputs.tf","path":"examples/rds-with-replicas/outputs.tf","sha":"991d5436a635194fec1ad1476eb7be6616032c7a"},{"name":"vars.tf","path":"examples/rds-with-replicas/vars.tf","sha":"a1ab0eaadeaee910d4b81265ba28524917926e6c"}]}]},{"name":"modules","children":[{"name":"aurora","children":[{"name":"README-Aurora-Serverless.adoc","path":"modules/aurora/README-Aurora-Serverless.adoc","sha":"7a28bba029bd95affa541548ac19cb5c49a07e27"},{"name":"README-Aurora.adoc","path":"modules/aurora/README-Aurora.adoc","sha":"89ebb7a7c5aa8632a930c34993fc6c4cebe7efb4"},{"name":"README.adoc","path":"modules/aurora/README.adoc","sha":"f1717f1c088760357ec7b87edce843360aef6924"},{"name":"core-concepts.md","path":"modules/aurora/core-concepts.md","sha":"a3bdce9f1bb2a1d8b68c61856073cc01944d0b81","toggled":true},{"name":"main.tf","path":"modules/aurora/main.tf","sha":"8f2de1f4a9c305b690e8423aef2484cfe5f46b50"},{"name":"outputs.tf","path":"modules/aurora/outputs.tf","sha":"60b68848bb307c9b2cb8ed5138c5e4703fbfcffb"},{"name":"vars.tf","path":"modules/aurora/vars.tf","sha":"2cfe87d0751b3f1f9a1627a7ada766974a0b5f28"}],"toggled":true},{"name":"lambda-cleanup-snapshots","children":[{"name":"README.md","path":"modules/lambda-cleanup-snapshots/README.md","sha":"2c491aeca99fac0536e6c86ef850e00146ac7259"},{"name":"cleanup-rds-snapshots","children":[{"name":"index.py","path":"modules/lambda-cleanup-snapshots/cleanup-rds-snapshots/index.py","sha":"69a65b5022465ddf7e95579ead7a68ab64483b95"}]},{"name":"main.tf","path":"modules/lambda-cleanup-snapshots/main.tf","sha":"953df7fe7e9a29f3090ab293e59357c1a8010e9c"},{"name":"outputs.tf","path":"modules/lambda-cleanup-snapshots/outputs.tf","sha":"a99c0265d859dd0c87a6eba62aaf2b013e224873"},{"name":"vars.tf","path":"modules/lambda-cleanup-snapshots/vars.tf","sha":"5f6b12e00a66aa7a0d5d6717cd73496cbde7a25a"}]},{"name":"lambda-copy-shared-snapshot","children":[{"name":"README.md","path":"modules/lambda-copy-shared-snapshot/README.md","sha":"9953dc7e2429ffa95751d868b725018fedc03a4e"},{"name":"copy-shared-rds-snapshot","children":[{"name":"index.py","path":"modules/lambda-copy-shared-snapshot/copy-shared-rds-snapshot/index.py","sha":"63194eb6ad0325e8b130d83858aec34d861fbab3"}]},{"name":"main.tf","path":"modules/lambda-copy-shared-snapshot/main.tf","sha":"63f8c01c58edf40b604038e926222be354280f68"},{"name":"outputs.tf","path":"modules/lambda-copy-shared-snapshot/outputs.tf","sha":"f4833d96fa6d47190b9d2c3af243142aefc59d59"},{"name":"vars.tf","path":"modules/lambda-copy-shared-snapshot/vars.tf","sha":"dd4a28dc1ca42d9fcc649f49999156559839c808"}]},{"name":"lambda-create-snapshot","children":[{"name":"README.adoc","path":"modules/lambda-create-snapshot/README.adoc","sha":"4c6a9c7fa49b66aeeeae492b895bb98d97ab3062"},{"name":"core-concepts.md","path":"modules/lambda-create-snapshot/core-concepts.md","sha":"de6c470a727247b33c032b3b1b0cc63cf0e945f4"},{"name":"create-rds-snapshot","children":[{"name":"index.py","path":"modules/lambda-create-snapshot/create-rds-snapshot/index.py","sha":"454ef5211ea590dba7e8a891f95ce2bcf4e1d6dd"}]},{"name":"main.tf","path":"modules/lambda-create-snapshot/main.tf","sha":"4435c68aa884342554543bc9a62a9ef549a40c79"},{"name":"outputs.tf","path":"modules/lambda-create-snapshot/outputs.tf","sha":"a0f5ffafa8ef11d00b72f1858b81e182ab2471dd"},{"name":"vars.tf","path":"modules/lambda-create-snapshot/vars.tf","sha":"81d9f4ed54a0361e25ea25318240a5ee5c56f51a"}]},{"name":"lambda-share-snapshot","children":[{"name":"README.md","path":"modules/lambda-share-snapshot/README.md","sha":"f00a0ab9745632e85d5f4c8e7a9389e1a8608b6b"},{"name":"main.tf","path":"modules/lambda-share-snapshot/main.tf","sha":"4431dc6165139d4c2eb9d3d148f44e10a1c69bd2"},{"name":"outputs.tf","path":"modules/lambda-share-snapshot/outputs.tf","sha":"c0d2854f967a6c963662c660d6ae96d8cabe471a"},{"name":"share-rds-snapshot","children":[{"name":"index.py","path":"modules/lambda-share-snapshot/share-rds-snapshot/index.py","sha":"a72d6191cf23e451ff2b8cd3789100827fd782df"}]},{"name":"vars.tf","path":"modules/lambda-share-snapshot/vars.tf","sha":"e90d02ff7f2915dda7d1b1cb6401efb53de4cea8"}]},{"name":"rds","children":[{"name":"README-MariaDb.adoc","path":"modules/rds/README-MariaDb.adoc","sha":"52c88eedb3410b14c6ccc4db8ea3eaa484b7c13a"},{"name":"README-MySQL.adoc","path":"modules/rds/README-MySQL.adoc","sha":"75a2e92b04368988ffe7fb405a99155881f2c4f7"},{"name":"README-Oracle.adoc","path":"modules/rds/README-Oracle.adoc","sha":"a9f084cfbd084413bbcc818fd9f438a4faee367b"},{"name":"README-PostgreSQL.adoc","path":"modules/rds/README-PostgreSQL.adoc","sha":"2486401acaa724eba2f0a8814ef9dfa19c510ae0"},{"name":"README-SqlServer.adoc","path":"modules/rds/README-SqlServer.adoc","sha":"76d7220a727d84567e819102617bd01a3bda0cb2"},{"name":"README.adoc","path":"modules/rds/README.adoc","sha":"fa2c8270106116804fa8ee61a7b5885ab8a4833f"},{"name":"core-concepts.md","path":"modules/rds/core-concepts.md","sha":"11bfb303642008e506c4e822089b284e10626275"},{"name":"main.tf","path":"modules/rds/main.tf","sha":"194b642bc9835cf67ca19714ee3dafbafc7ad97b"},{"name":"outputs.tf","path":"modules/rds/outputs.tf","sha":"f86cf8efcb26ce2338b04502fb192879e2722b5b"},{"name":"vars.tf","path":"modules/rds/vars.tf","sha":"aa093a0b74048a97a4f73282198185988d0fc2f8"}]}],"toggled":true},{"name":"test","children":[{"name":"Gopkg.lock","path":"test/Gopkg.lock","sha":"c8664629f9a0cbabca39e5ab84530f4764d1d763"},{"name":"Gopkg.toml","path":"test/Gopkg.toml","sha":"b41f04dc6b8d3fd5e03771dd2648a74cb1119f83"},{"name":"README.md","path":"test/README.md","sha":"ebcf2313b7664113168ca7e73d01acbd232d8f39"},{"name":"example_aurora_global_test.go","path":"test/example_aurora_global_test.go","sha":"f45e0eeaf9a7f6646a523cb4d1006bd41509b284"},{"name":"example_aurora_test.go","path":"test/example_aurora_test.go","sha":"43e1e37be5917d20c67f3c407508da33377f56de"},{"name":"example_lambda_rds_snapshot_test.go","path":"test/example_lambda_rds_snapshot_test.go","sha":"3aa5cc64122f7ce0d8edb42976b203de86a14b27"},{"name":"example_rds_mariadb_test.go","path":"test/example_rds_mariadb_test.go","sha":"bb26730828a0ccb71f524647be35e9f93876638b"},{"name":"example_rds_mysql_test.go","path":"test/example_rds_mysql_test.go","sha":"7a08ee04fb8b57790d4dd791ff46b62c452142da"},{"name":"example_rds_postgres_test.go","path":"test/example_rds_postgres_test.go","sha":"4758166580a255344ee07a332e31e6f63e60a880"},{"name":"example_rds_sqlserver_test.go","path":"test/example_rds_sqlserver_test.go","sha":"29a4f9ef76683c024623e44f2f54c2560d2690cf"},{"name":"example_rds_with_replicas_test.go","path":"test/example_rds_with_replicas_test.go","sha":"5744e4b8454f538720e472069f12ef7e1ee0195d"},{"name":"util.go","path":"test/util.go","sha":"12abab86511af62a50eebe68c0a329848e9543c2"}]}]},"detailsContent":"<h1 class=\"preview__body--title\" id=\"core-aurora-concepts\">Core Aurora Concepts</h1><div class=\"preview__body--border\"></div><h2 class=\"preview__body--subtitle\" id=\"how-do-you-connect-to-the-database\">How do you connect to the database?</h2>\n<p>This module provides the connection details as <a href=\"https://www.terraform.io/intro/getting-started/outputs.html\" class=\"preview__body--description--blue\" target=\"_blank\">Terraform output\nvariables</a>:</p>\n<ol>\n<li><strong>Cluster endpoint</strong>: The endpoint for the whole cluster. You should always use this URL for writes, as it points to\nthe primary.</li>\n<li><strong>Instance endpoints</strong>: A comma-separated list of all DB instance URLs in the cluster, including the primary and all\nread replicas. Use these URLs for reads (see "How do you scale this DB?" below).</li>\n<li><strong>Port</strong>: The port to use to connect to the endpoints above.</li>\n</ol>\n<p>For more info, see <a href=\"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Aurora.html#Aurora.Overview.Endpoints\" class=\"preview__body--description--blue\" target=\"_blank\">Aurora\nendpoints</a>.</p>\n<p>You can programmatically extract these variables in your Terraform templates and pass them to other resources (e.g.\npass them to User Data in your EC2 instances). You'll also see the variables at the end of each <code>terraform apply</code> call\nor if you run <code>terraform output</code>.</p>\n<h2 class=\"preview__body--subtitle\" id=\"how-do-you-scale-this-database\">How do you scale this database?</h2>\n<ul>\n<li><strong>Storage</strong>: Aurora manages storage for you, automatically growing cluster volume in 10GB increments up to 64TB.</li>\n<li><strong>Vertical scaling</strong>: To scale vertically (i.e. bigger DB instances with more CPU and RAM), use the <code>instance_type</code>\ninput variable. For a list of AWS RDS server types, see <a href=\"http://aws.amazon.com/rds/aurora/pricing/\" class=\"preview__body--description--blue\" target=\"_blank\">Aurora Pricing</a>.</li>\n<li><strong>Horizontal scaling</strong>: To scale horizontally, you can add more replicas using the <code>instance_count</code> input variable,\nand Aurora will automatically deploy the new instances, sync them to the master, and make them available as read\nreplicas.</li>\n</ul>\n<p>For more info, see <a href=\"http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Aurora.Managing.html\" class=\"preview__body--description--blue\" target=\"_blank\">Managing an Amazon Aurora DB\nCluster</a>.</p>\n<h2 class=\"preview__body--subtitle\" id=\"how-do-you-configure-this-module\">How do you configure this module?</h2>\n<p>This module allows you to configure a number of parameters, such as backup windows, maintenance window, port number,\nand encryption. For a list of all available variables and their descriptions, see <a href=\"/repos/v0.12.9/module-data-storage/modules/aurora/vars.tf\" class=\"preview__body--description--blue\">vars.tf</a>.</p>\n<h2 class=\"preview__body--subtitle\" id=\"known-issues\">Known Issues</h2>\n<p>Requires terraform provider version 1.32 or newer due to the serverless options</p>\n<h3 class=\"preview__body--subtitle\" id=\"db-instance-not-found\">DBInstance not found</h3>\n<p>As of August 29, 2017, Terraform 0.10.x has an issue where when you apply an RDS Aurora Instance for the first time, you may sometimes receive the following error:</p>\n<pre>aws_rds_cluster.cluster_with_encryption: <span class=\"hljs-builtin-name\">Error</span> modifying DB<span class=\"hljs-built_in\"> Instance </span>aurora-test: DBInstanceNotFound: DBInstance <span class=\"hljs-keyword\">not</span> found: aurora-test\nstatus code: 404, request id: 040094aa-8c62-11e7-baa6-0d7ac77494f1\n</pre>\n<p>This error occurs because Terraform first creates the database cluster, then creates one or more database instances, and then queries the AWS API for the IDs of those database instances. But Terraform does not wait long enough for the AWS API to propagate these instances to all AWS API endpoints, so AWS initially replies that the given database instance name was not found.</p>\n<p>Fortunately, this issue has a simple fix. After waiting a few seconds, the AWS API will not return the database instances that we expect, so simply re-run <code>terraform apply</code> and the operation should complete successfully.</p>\n","repoName":"module-data-storage","repoRef":"v0.12.3","serviceDescriptor":{"serviceName":"Aurora","serviceRepoName":"module-data-storage","serviceRepoOrg":"gruntwork-io","serviceMainReadmePath":"/modules/aurora/README-Aurora.adoc","cloudProviders":["aws"],"description":"Run Aurora, Amazon’s MySQL and PostgreSQL compatible cloud DB. Supports read replicas, multi-zone automatic failover, and automatic backup.","imageUrl":"aurora.png","licenseType":"subscriber","technologies":["Terraform","Bash"],"compliance":[],"tags":[""]},"serviceCategoryName":"Database","fileName":"core-concepts.md","filePath":"/modules/aurora/core-concepts.md","title":"Repo Browser: Aurora","description":"Browse the repos in the Gruntwork Infrastructure as Code Library."}