Click here to Skip to main content
15,880,608 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am very new into AWS and Terraform.

Here am trying to create an Aurora (PostgreSQL compatible) database in AWS using Terraform code.

I could be able to create a database using a basic terraform script but need to create a serverless Aurora database. I cannot find any option or parameter in Terraform Docs, to mark the database as serverless.

What I have tried:

I have created a database using simple Terraform script as given below:

provider "aws" {
  profile = "default"
  region = "us-west-2"
  shared_credentials_file = "/Users/firstname.lastname/.aws/creds"
}

resource "aws_rds_cluster" "postgresql" {
  cluster_identifier      = "aurora-cluster"
  db_subnet_group_name    = "<subnet group="" name="">"
  engine                  = "aurora-postgresql"
  availability_zones      = ["us-west-2a", "us-west-2b", "us-west-2c"]
  database_name           = "myTestdb"
  master_username         = "********"
  master_password         = "********"
  backup_retention_period = 5
  preferred_backup_window = "07:00-09:00"
}
Posted
Updated 10-Mar-22 8:10am
v2
Comments
Richard MacCutchan 29-Jul-20 4:37am    
What is a serverless database? If there is no server then how can it work?
Member 11072126 29-Jul-20 5:05am    
Actually serverless is a concept. When I was creating a Aurora DB using AWS Console UI, I saw while setting endpoints, there are two options, one of them was "Serverless".

It means, AWS will autoscale and auto shut down or start the DB as and when required. We don't need to manage it explicitly.

1 solution

Hi,

You need to specify the following specification in your aws_rds_cluster resource terraform code.

engine_mode = "serverless"
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900