AWS RDS Postgres

AWS RDS for PostgreSQL. PostgreSQL has become the preferred open source relational database for many enterprise developers and start-ups, powering leading business and mobile applications. Amazon RDS makes it easy to set up, operate, and scale PostgreSQL deployments in the cloud. With Amazon RDS, you can deploy scalable PostgreSQL deployments in minutes with cost-efficient and resizable hardware capacity.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Made by

Massdriver

Official

Yes

AWS RDS PostgreSQL

Amazon Relational Database Service (RDS) for PostgreSQL is a managed relational database service that makes it easy to set up, operate, and scale PostgreSQL deployments in the cloud. With Amazon RDS, you can deploy and scale PostgreSQL databases in minutes with cost-efficient and resizable hardware capacity. This service handles time-consuming database administration tasks such as backups, software patching, monitoring, scaling, and replication, thereby freeing you up to focus on application development.

Design Decisions

  • Engine Selection: This module is designed specifically for PostgreSQL, ensuring that all configurations and optimizations are tailored for this database engine.
  • Security: The module includes configurations for VPC security groups to control access, and uses AWS KMS for encryption at rest.
  • Monitoring: Enhanced monitoring and CloudWatch alarms are enabled to provide detailed insights and alerting capabilities.
  • Backup and Recovery: Configurations for automated backups with customizable retention periods and settings for final snapshots during deletion are included to facilitate data protection and disaster recovery.
  • Parameter Group Management: Parameter groups allow for one-click database parameter settings based on best practices.

Runbook

Instance Connection Issues

Unable to connect to your RDS PostgreSQL instance.

Use the AWS CLI to describe the DB instance and check for issues such as incorrect security groups, availability, and endpoint status.

aws rds describe-db-instances --db-instance-identifier your-db-instance-identifier

Ensure the Endpoint information is correct. The response information should include the endpoint address and port.

High CPU Utilization

When your RDS instance experiences high CPU utilization.

Check CloudWatch metrics to monitor CPUUtilization.

aws cloudwatch get-metric-statistics --namespace AWS/RDS --metric-name CPUUtilization --dimensions Name=DBInstanceIdentifier,Value=your-db-instance-identifier --start-time 2022-01-01T23:18:00 --end-time 2022-01-01T23:23:00 --period 60 --statistics Average

Consider actions such as upgrading your DB instance class or optimizing your queries.

Low Free Storage Space

When free storage space is low.

Check CloudWatch metrics for FreeStorageSpace.

aws cloudwatch get-metric-statistics --namespace AWS/RDS --metric-name FreeStorageSpace --dimensions Name=DBInstanceIdentifier,Value=your-db-instance-identifier --start-time 2022-01-01T23:18:00 --end-time 2022-01-01T23:23:00 --period 60 --statistics Average

Consider actions such as increasing your allocated storage or cleaning up old data.

Postgres Connection Slowness

If connections to your PostgreSQL database seem slow.

Log into your PostgreSQL instance and run diagnostic queries.

SELECT * FROM pg_stat_activity;

This query will show currently active connections. Look for any unexpected long-running transactions or high connection counts.

EXPLAIN ANALYZE SELECT * FROM your_table WHERE your_condition;

The EXPLAIN ANALYZE command helps you examine query plans and identify potential inefficiencies.

Error in Parameter Group Application

Issues applying new parameters through the parameter group.

Review applied parameters and their statuses.

SELECT name, setting, source FROM pg_settings;

Validate that the parameters configured match your expected settings and adjust as necessary.

If changes are not immediate, remember some parameters may require an instance restart to take effect.

VariableTypeDescription
backup.delete_automated_backupsbooleanSpecifies whether to remove automated backups immediately after the DB instance is deleted.
backup.retention_periodintegerThe days to retain backups for. Must be between 0 and 35. Must be greater than 0 if the database is used as a source for a Read Replica.
backup.skip_final_snapshotbooleanDetermines whether a final DB snapshot is created before the DB cluster is deleted. If true is specified, no DB snapshot is created.
database.deletion_protectionbooleanIf the DB instance should have deletion protection enabled.
database.engine_versionstringVersion of PostgreSQL to use.
database.instance_classstringThe instance type of the RDS instance.
database.parameters[].apply_methodstringNo description
database.parameters[].namestringNo description
database.parameters[].valuestringNo description
database.usernamestringUsername for the 'root' DB user.
networking.subnet_typestringDeploy the database to internal subnets (cannot reach the internet) or private subnets (internet egress traffic allowed)
observability.enabled_cloudwatch_logs_exports[]array(string)No description
observability.enhanced_monitoring_intervalintegerMonitoring interval for operating system metrics of your DB instance in real time. When you want to see how different processes or threads use the CPU, Enhanced Monitoring metrics are useful.
observability.performance_insights_retention_periodintegerPerformance Insights is a database performance tuning and monitoring feature that helps you quickly assess the load on your database, and determine when and where to take action. Performance Insights allows non-experts to detect performance problems with an easy-to-understand dashboard that visualizes database load.
storage.allocatedintegerThe allocated storage in GiB.
storage.max_allocatedintegerThe max allocated storage in GiB that RDS will autoscale to. Not supported on all instance types. Set to greater than allocated_storage to enable.
storage.typestringOne of 'standard' (magnetic), 'gp2' (general purpose SSD), or 'io1' (provisioned IOPS SSD). The default is 'io1' if iops is specified, 'gp2' if not.