Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Aurora Postgresql Serverless Example #54

Closed
daveyu opened this issue Jul 12, 2019 · 3 comments
Closed

Add Aurora Postgresql Serverless Example #54

daveyu opened this issue Jul 12, 2019 · 3 comments
Assignees

Comments

@daveyu
Copy link

daveyu commented Jul 12, 2019

This config worked for me:

module "aurora_postgres_serverless" {
  source                   = "git::https://github.com/cloudposse/terraform-aws-rds-cluster.git?ref=tags/0.15.0"
  namespace                = "${var.namespace}"
  stage                    = "${var.stage}"
  name                     = "${var.postgres_name}"
  engine                   = "aurora-postgresql"
  engine_mode              = "serverless"
  engine_version           = "10.7"
  cluster_family           = "aurora-postgresql10"
  cluster_size             = "0"
  admin_user               = "${local.postgres_admin_user}"
  admin_password           = "${local.postgres_admin_password}"
  db_name                  = "${local.postgres_db_name}"
  db_port                  = "5432"
  vpc_id                   = "${data.terraform_remote_state.backing_services.vpc_id}"
  subnets                  = ["${data.terraform_remote_state.backing_services.public_subnet_ids}"]
  zone_id                  = "${local.zone_id}"
  publicly_accessible      = "true"
  allowed_cidr_blocks      = ["0.0.0.0/0"]
  enabled                  = "${var.postgres_cluster_enabled}"

  scaling_configuration = [
    {
      auto_pause               = true
      max_capacity             = "384"
      min_capacity             = "8"
      seconds_until_auto_pause = 300
    }
  ]
}

Valid capacity units for Postgres are 8, 16, 32, 64, 192, and 384, per https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.create.html

@osterman
Copy link
Member

Thanks @daveyu ! This is great.

@daveyu
Copy link
Author

daveyu commented Jul 12, 2019

Oh, there was an error with applying the module though:

* module.aurora_postgres.module.dns_replicas.aws_route53_record.default: 1 error(s) occurred:

* aws_route53_record.default: [ERR]: Error building changeset: InvalidChangeBatch: [Invalid Resource Record: FATAL problem: DomainNameEmpty (Domain name is empty) encountered with '', Unparseable CNAME encountered]
	status code: 400, request id: 67f88f1e-d3b5-4c8b-bc79-4c72a48a7e27

EDIT: I see this is fixed in 0.16.0.

@bionicles
Copy link

bionicles commented Feb 3, 2020

@osterman @aknysh @goruha hey all -- can we add this Serverless PostgreSQL to the readme and include the enable_http_endpoint parameter so we can use the Data API? I was gonna use this for a startup and make a little script to do schema / ddl migrations with Data API. Postgres is in style these days

Then you could close #54 and #51

osterman pushed a commit that referenced this issue Jun 14, 2020
… aurora serverless engine (#69)

* feat(enable_http_endpoint): added new option
for aurora serverless

related to: #54 #51

* feat(enable_http_endpoint): corrected default value
in docs

related to: #54 #51

* feat: reverted back README.md changes

* feat: reverted back README.md changes

* feat: generated README.md
rverma-jm added a commit to jupiterops/terraform-aws-rds-cluster that referenced this issue Dec 5, 2020
* Adding timeout for rds cluster resources and defaulting to TF default to 120m (cloudposse#64)

Co-authored-by: PePe (Jose) Amengual <[email protected]>

* Allow setting `copy_tags_to_snapshot` variable (cloudposse#62)

Allow copy_tags_to_snapshot to be set to true via terraform.

Signed-off-by: Jon Whitcraft <[email protected]>

Co-authored-by: Maxim Mironenko <[email protected]>

* Bugfix timeouts (cloudposse#65)

* Adding timeout for rds cluster resources and defaulting to TF default to 120m

* Fixing bug in timeout config

Co-authored-by: PePe (Jose) Amengual <[email protected]>

* Allow creation of a cluster without creation of a database (cloudposse#66)

* fix(cloudposse#63): instance_count should be independent of autoscaling_min_capacity (cloudposse#67)

Co-authored-by: Sumeet Shukla <[email protected]>

* Migrate to ChatOps (cloudposse#70)

* feat(enable_http_endpoint): added new enable_http_endpoint option for aurora serverless engine (cloudposse#69)

* feat(enable_http_endpoint): added new option
for aurora serverless

related to: cloudposse#54 cloudposse#51

* feat(enable_http_endpoint): corrected default value
in docs

related to: cloudposse#54 cloudposse#51

* feat: reverted back README.md changes

* feat: reverted back README.md changes

* feat: generated README.md

* Allow user to pass in cluster_identifier (cloudposse#72)

* cluster_identifier: Provide ability to supply your own cluster_identifier

Change-Id: I63ee15c74e2aa632e0c1cc11fc30ff9d013af4d2

* cluster_identifier: Sort out naming for final snapshot

Change-Id: I9f3b103c81b96662f35451d973640fc4d80b8236

* Updated README.md

Co-authored-by: Andy Hibbert <[email protected]>
Co-authored-by: actions-bot <[email protected]>

* 73: Add auto_minor_version_upgrade flag variable (cloudposse#74)

* 73: Add auto_minor_version_upgrade flag variable

Default to true as per provider.

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster_instance#auto_minor_version_upgrade

* Updated README.md

Co-authored-by: actions-bot <[email protected]>

* [AUTOMATED] Update Version Pinning for Terraform to support 0.13 (cloudposse#75)

## What

1. Update Version Pinning for Terraform to support 0.13

## Why

1. This is a relatively minor update that the CloudPosse module already likely supports.
1. This allows module consumers to not individually update our Terraform module to support Terraform 0.13.

* [AUTOMATED] Update terraform-null-label versions to support Terraform 0.13 (cloudposse#76)

* Support terraform 0.13 (cloudposse#77)

* Update to `context.tf`. Add `primary` and `secondary` cluster resources (cloudposse#79)

* Update to `context.tf`

* Update to `context.tf`

* Update to `context.tf`

* Update to `context.tf`

* Fix outputs when `enabled=false`. Change Security Group rules from inline to resources (cloudposse#80)

* Add IAM role for enhanced monitoring (cloudposse#82)

* Update examples

* Add IAM role for enhanced monitoring

* Add percona xtrabackup import from S3 (cloudposse#84)

* Update main.tf

* Update variables.tf

* Updated README.md

* Update variables.tf

* Updated README.md

* Update variables.tf

* Updated README.md

* Update variables.tf

* Updated README.md

* Update main.tf

* Update main.tf

Co-authored-by: actions-bot <[email protected]>

* Fixes DNS prepending var.name to local.cluster_dns_name (cloudposse#88)

## what
* DNS was changing when it shouldn't have been, it was the value of:

```
${var.name}-${local.cluster_dns_name}
```

I think this may have changed in https://github.com/cloudposse/terraform-aws-route53-cluster-hostname/releases/tag/0.6.0

This changes the parameter to `dns_name` and upgrades the version to get a stable DNS record

## why

* Fix broken DNS

* Serverless: Aurora 2.07.1 MySQL 5.7 and encrypted_storage parameter fix (cloudposse#91)

* Aurora serverless is encrypted by default

Follow upstream documentation and don't set `storage_encrypted` at all.

* Include Aurora 2.07.1 MySQL  5.7 example

Also fix minor missing new item in 5.6 example.

https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Updates.serverless_2_07_01.html

* Add suport for cluster cloning (cloudposse#92)

* Fixing incompatibility with snashot_identifier

* using upstream names instead

Co-authored-by: PePe Amengual <[email protected]>
Co-authored-by: PePe (Jose) Amengual <[email protected]>
Co-authored-by: Jon Whitcraft <[email protected]>
Co-authored-by: Maxim Mironenko <[email protected]>
Co-authored-by: Nuru <[email protected]>
Co-authored-by: Sumeet Shukla <[email protected]>
Co-authored-by: Sumeet Shukla <[email protected]>
Co-authored-by: Erik Osterman <[email protected]>
Co-authored-by: Mariusz Rajczakowski <[email protected]>
Co-authored-by: Andrew Hibbert <[email protected]>
Co-authored-by: Andy Hibbert <[email protected]>
Co-authored-by: actions-bot <[email protected]>
Co-authored-by: Karl <[email protected]>
Co-authored-by: Matt Gowie <[email protected]>
Co-authored-by: Andriy Knysh <[email protected]>
Co-authored-by: nitro <[email protected]>
Co-authored-by: Mikael Fridh <[email protected]>
rverma-jm added a commit to jupiterops/terraform-aws-rds-cluster that referenced this issue Dec 9, 2020
* Adding timeout for rds cluster resources and defaulting to TF default to 120m (cloudposse#64)

Co-authored-by: PePe (Jose) Amengual <[email protected]>

* Allow setting `copy_tags_to_snapshot` variable (cloudposse#62)

Allow copy_tags_to_snapshot to be set to true via terraform.

Signed-off-by: Jon Whitcraft <[email protected]>

Co-authored-by: Maxim Mironenko <[email protected]>

* Bugfix timeouts (cloudposse#65)

* Adding timeout for rds cluster resources and defaulting to TF default to 120m

* Fixing bug in timeout config

Co-authored-by: PePe (Jose) Amengual <[email protected]>

* Allow creation of a cluster without creation of a database (cloudposse#66)

* fix(cloudposse#63): instance_count should be independent of autoscaling_min_capacity (cloudposse#67)

Co-authored-by: Sumeet Shukla <[email protected]>

* Migrate to ChatOps (cloudposse#70)

* feat(enable_http_endpoint): added new enable_http_endpoint option for aurora serverless engine (cloudposse#69)

* feat(enable_http_endpoint): added new option
for aurora serverless

related to: cloudposse#54 cloudposse#51

* feat(enable_http_endpoint): corrected default value
in docs

related to: cloudposse#54 cloudposse#51

* feat: reverted back README.md changes

* feat: reverted back README.md changes

* feat: generated README.md

* Allow user to pass in cluster_identifier (cloudposse#72)

* cluster_identifier: Provide ability to supply your own cluster_identifier

Change-Id: I63ee15c74e2aa632e0c1cc11fc30ff9d013af4d2

* cluster_identifier: Sort out naming for final snapshot

Change-Id: I9f3b103c81b96662f35451d973640fc4d80b8236

* Updated README.md

Co-authored-by: Andy Hibbert <[email protected]>
Co-authored-by: actions-bot <[email protected]>

* 73: Add auto_minor_version_upgrade flag variable (cloudposse#74)

* 73: Add auto_minor_version_upgrade flag variable

Default to true as per provider.

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster_instance#auto_minor_version_upgrade

* Updated README.md

Co-authored-by: actions-bot <[email protected]>

* [AUTOMATED] Update Version Pinning for Terraform to support 0.13 (cloudposse#75)

## What

1. Update Version Pinning for Terraform to support 0.13

## Why

1. This is a relatively minor update that the CloudPosse module already likely supports.
1. This allows module consumers to not individually update our Terraform module to support Terraform 0.13.

* [AUTOMATED] Update terraform-null-label versions to support Terraform 0.13 (cloudposse#76)

* Support terraform 0.13 (cloudposse#77)

* Update to `context.tf`. Add `primary` and `secondary` cluster resources (cloudposse#79)

* Update to `context.tf`

* Update to `context.tf`

* Update to `context.tf`

* Update to `context.tf`

* Fix outputs when `enabled=false`. Change Security Group rules from inline to resources (cloudposse#80)

* Add IAM role for enhanced monitoring (cloudposse#82)

* Update examples

* Add IAM role for enhanced monitoring

* Add percona xtrabackup import from S3 (cloudposse#84)

* Update main.tf

* Update variables.tf

* Updated README.md

* Update variables.tf

* Updated README.md

* Update variables.tf

* Updated README.md

* Update variables.tf

* Updated README.md

* Update main.tf

* Update main.tf

Co-authored-by: actions-bot <[email protected]>

* Fixes DNS prepending var.name to local.cluster_dns_name (cloudposse#88)

## what
* DNS was changing when it shouldn't have been, it was the value of:

```
${var.name}-${local.cluster_dns_name}
```

I think this may have changed in https://github.com/cloudposse/terraform-aws-route53-cluster-hostname/releases/tag/0.6.0

This changes the parameter to `dns_name` and upgrades the version to get a stable DNS record

## why

* Fix broken DNS

* Serverless: Aurora 2.07.1 MySQL 5.7 and encrypted_storage parameter fix (cloudposse#91)

* Aurora serverless is encrypted by default

Follow upstream documentation and don't set `storage_encrypted` at all.

* Include Aurora 2.07.1 MySQL  5.7 example

Also fix minor missing new item in 5.6 example.

https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Updates.serverless_2_07_01.html

* Add suport for cluster cloning (cloudposse#92)

* Fixing incompatibility with snashot_identifier

* using upstream names instead

* remove module with db_name

* remove module with db_name

* remove module with db_name

Co-authored-by: PePe Amengual <[email protected]>
Co-authored-by: PePe (Jose) Amengual <[email protected]>
Co-authored-by: Jon Whitcraft <[email protected]>
Co-authored-by: Maxim Mironenko <[email protected]>
Co-authored-by: Nuru <[email protected]>
Co-authored-by: Sumeet Shukla <[email protected]>
Co-authored-by: Sumeet Shukla <[email protected]>
Co-authored-by: Erik Osterman <[email protected]>
Co-authored-by: Mariusz Rajczakowski <[email protected]>
Co-authored-by: Andrew Hibbert <[email protected]>
Co-authored-by: Andy Hibbert <[email protected]>
Co-authored-by: actions-bot <[email protected]>
Co-authored-by: Karl <[email protected]>
Co-authored-by: Matt Gowie <[email protected]>
Co-authored-by: Andriy Knysh <[email protected]>
Co-authored-by: nitro <[email protected]>
Co-authored-by: Mikael Fridh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants