Skip to content

Repository files navigation

cfn-modules: RDS PostgreSQL

RDS PostgreSQL database with secure firewall configuration, encryption, multi AZ, backup enabled, and alerting.

Install

Install Node.js and npm first!

npm i @cfn-modules/rds-postgres

Usage

---
AWSTemplateFormatVersion: '2010-09-09'Description: 'cfn-modules example'Resources:
Database:
Type: 'AWS::CloudFormation::Stack'Properties:
Parameters:
VpcModule: !GetAtt 'Vpc.Outputs.StackName' # requiredClientSgModule: !GetAtt 'ClientSg.Outputs.StackName' # requiredAlertingModule: ''# optionalHostedZoneModule: ''# optionalBastionModule: ''# optionalKmsKeyModule: ''# optionalSecretModule: ''# optionalDBSnapshotIdentifier: ''# optionalDBAllocatedStorage: '5'# optionalDBInstanceClass: 'db.t4g.micro'# optionalDBName: ''# optionalDBBackupRetentionPeriod: '30'# optionalDBMasterUsername: 'master'# optionalDBMasterUserPassword: ''# required if neither DBSnapshotIdentifier nor SecretModule is setDBMultiAZ: 'true'# optionalSubDomainNameWithDot: 'postgres.'# optional# Set this to the version of PostgreSQL you want to use.# You can run the following command to get the list of PostgreSQL versions supported by AWS RDS:# aws rds describe-db-engine-versions --engine postgres --query "DBEngineVersions[].EngineVersion"EngineVersion: '14.12'EnableIAMDatabaseAuthentication: 'false'# optionalTemplateURL: './node_modules/@cfn-modules/rds-postgres/module.yml'

Examples

Related modules

Parameters

NameDescriptionDefaultRequired?Allowed values
VpcModuleStack name of vpc moduleyes
ClientSgModuleStack name of client-sg module where traffic is allowed from on port 5432 to the databaseyes
AlertingModuleStack name of alerting moduleno
HostedZoneModuleStack name of module implementing HostedZoneno
BastionModuleStack name of module implementing Bastionno
KmsKeyModuleStack name of kms-key moduleno
SecretModuleStack name of secret moduleno
DBSnapshotIdentifierName or Amazon Resource Name (ARN) of the DB snapshot from which you want to restore (leave blank to create an empty database)no
DBAllocatedStorageThe allocated storage size, specified in GB (ignored when DBSnapshotIdentifier is set, value used from snapshot)5no[5-16384]
DBInstanceClassThe instance type of the databasedb.t4g.microno
DBNameName of the database (ignored when DBSnapshotIdentifier is set, value used from snapshot)auto generated valueno
DBBackupRetentionPeriodThe number of days to keep snapshots of the database35no[0-35]
DBMasterUsernameThe master user name for the DB instance (ignored when DBSnapshotIdentifier is set, value used from snapshot)masterno
DBMasterUserPasswordThe master password for the DB instance (ignored when DBSnapshotIdentifier is set, value used from snapshot; also ignored if SecretModule is set).yes (no if DBSnapshotIdentifier is set)
DBMultiAZSpecifies if the database instance is deployed to multiple Availability Zones for HAtrueno[true, false]
SubDomainNameWithDotName 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!test.no
EngineVersionThe PostgreSQL version.yes Set this to the version of PostgreSQL you want to use. You can run the following command to get the list of PostgreSQL versions supported by AWS RDS:
aws rds describe-db-engine-versions --engine postgres --query "DBEngineVersions[].EngineVersion"
EnableIAMDatabaseAuthenticationEnable mapping of AWS Identity and Access Management (IAM) accounts to database accounts).falseno[true, false]

Limitations

  • Scalable: RDS instances capacity (CPU, RAM, network, ...) is limited by design
  • Monitoring: Network In+Out is not monitored according to capacity of instance type

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages