RDS Aurora Serverless PostgreSQL cluster with secure firewall configuration, encryption, multi AZ, auto scaling, backup enabled, and alerting.
Install Node.js and npm first!
npm i @cfn-modules/rds-aurora-serverless-postgres
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'cfn-modules example'
Resources:
AuroraServerlessCluster:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
VpcModule: !GetAtt 'Vpc.Outputs.StackName' # required
ClientSgModule: !GetAtt 'ClientSg.Outputs.StackName' # required
KmsKeyModule: !GetAtt 'Key.Outputs.StackName' # required
BastionModule: !GetAtt 'Bastion.Outputs.StackName' # optional
HostedZoneModule: !GetAtt 'HostedZone.Outputs.StackName' # optional
AlertingModule: !GetAtt 'Alerting.Outputs.StackName' # optional
SecretModule: !GetAtt 'Secret.Outputs.StackName' # optional
DBSnapshotIdentifier: '' # optional
DBName: 'test' # required (ignored when DBSnapshotIdentifier is set, value used from snapshot)
DBBackupRetentionPeriod: '30' # optional
DBMasterUsername: 'master' # optional
DBMasterUserPassword: 'SuP3rS3curE' # required (ignored when DBSnapshotIdentifier is set, value used from snapshot; also ignored if SecretModule is set)
DBClusterIdentifier: '' # optional
DBClusterParameterGroupName: '' # optional
SubDomainNameWithDot: '' # optional
PreferredBackupWindow: '09:54-10:24' # optional
PreferredMaintenanceWindow: 'sat:07:00-sat:07:30' # optional
AutoPause: 'true' # optional
SecondsUntilAutoPause: '300' # optional
MaxCapacity: '2' # optional
MinCapacity: '2' # optional
EngineVersion: '10.7' # optional
EnableDataApi: 'true' # optional
TemplateURL: './node_modules/@cfn-modules/rds-aurora-serverless-postgres/module.yml'
none
Name | Description | Default | Required? | Allowed values |
---|---|---|---|---|
VpcModule | Stack name of vpc module | yes | ||
ClientSgModule | Stack name of client-sg module where traffic is allowed from on port 5432 to the database | yes | ||
KmsKeyModule | Stack name of kms-key module (only works in combination with Access := [Private, PublicRead]) | yes | ||
BastionModule | Stack name of module implementing Bastion | no | ||
HostedZoneModule | Stack name of module implementing HostedZone | no | ||
AlertingModule | Stack name of alerting module | no | ||
SecretModule | Stack name of secret module | no | ||
DBSnapshotIdentifier | Identifier for the DB cluster snapshot from which you want to restore (leave blank to create an empty cluster) | no | ||
DBName | Name of the database (ignored when DBSnapshotIdentifier is set, value used from snapshot) | depends | ||
DBBackupRetentionPeriod | The number of days to keep snapshots of the cluster | 30 | no | [1-35] |
DBMasterUsername | The master user name for the DB instance (ignored when DBSnapshotIdentifier is set, value used from snapshot) | master | no | |
DBMasterUserPassword | The master password for the DB instance (ignored when DBSnapshotIdentifier is set, value used from snapshot; also ignored if SecretModule is set) | depends | ||
DBClusterIdentifier | Name used to identify the DB Cluster. | no | ||
DBClusterParameterGroupName | Name of Cluster Parameter Group that should be used by the DB Cluster. If blank, a dedicated group will be generated by the template. The group must use the `aurora-postgresql` family. | no | ||
SubDomainNameWithDot | Name that is used to create the DNS entry with trailing dot, e.g. §{SubDomainNameWithDot}§{HostedZoneName}. Leave blank for naked (or apex and bare) domain. Requires HostedZoneModule parameter! | aurora. | no | |
PreferredBackupWindow | IGNORED BECAUSE OF A BUG IN CLOUDFORMATION! VALUE WILL APPLY IN THE FUTURE! The daily time range in UTC during which you want to create automated backups | 09:54-10:24 | no | |
PreferredMaintenanceWindow | IGNORED BECAUSE OF A BUG IN CLOUDFORMATION! VALUE WILL APPLY IN THE FUTURE! The weekly time range (in UTC) during which system maintenance can occur | sat:07:00-sat:07:30 | no | |
AutoPause | Enable automatic pause for a Serverless Aurora cluster. A cluster can be paused only when it has no connections. If a cluster is paused for more than seven days, the cluster might be backed up with a snapshot. In this case, the cluster is restored when there is a request to connect to it. | true | no | [true, false] |
SecondsUntilAutoPause | The time, in seconds, before a Serverless Aurora cluster is paused | 300 | no | [1-86400] |
MaxCapacity | The maximum capacity units for a Serverless Aurora cluster | 2 | no | [2, 4, 8, 16, 32, 64, 192, 384] |
MinCapacity | The minimum capacity units for a Serverless Aurora cluster | 2 | no | [2, 4, 8, 16, 32, 64, 192, 384] |
EngineVersion | Aurora Serverless PostgreSQL version | 10.7 | no | ['10.7'] |
EnableDataApi | Enable the [Data API](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html). | true | no | [true, false] |