RDS Aurora Serverless MySQL 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
---
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)
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: '5.6.10a' # optional
EnableDataApi: 'true' # optional
TemplateURL: './node_modules/@cfn-modules/rds-aurora-serverless/module.yml'
none
- Be warned, switching from
1.x.x
to2.x.x
will replace the database cluster. AWS is sunsetting Aurora Serverless v1. To upgrade to version 2, we recommend to take a snapshot of your current database cluster and use theDBSnapshotIdentifier
to create a new Aurora cluster with serverless v2.
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)/td> | 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 | ||
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 | [1, 2, 4, 8, 16, 32, 64, 128, 256] |
MinCapacity | The minimum capacity units for a Serverless Aurora cluster | 2 | no | [1, 2, 4, 8, 16, 32, 64, 128, 256] |
EngineVersion | Aurora Serverless MySQL version | 5.6.10a | no | ['5.6.10a'] |
EnableDataApi | Enable the [Data API](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html). | true | no | [true, false] |