Setting up PostgreSQL for Production in AWS Download Labs: http://tinyurl.com/pgconf2019-pgaws Scott Mead Database Engineer – Amazon RDS PGConf NY - April, 2019
Sr. Database Engineer, Postgres Engines Proctors Udayasimha Theepireddy Sridhar Ranganathan DB Cloud Architect Sr. Product Manager RDS Postgres theepi@amazon.com sridrang@amazon.com Scott Mead Sr. Database Engineer, Postgres Engines meads@amazon.com
Objectives AWS RDS Postgres offerings Best Practices Database configuration Deployment
Sign In to your Account If you don’t have one: aws.amazon.com/free
What is Amazon RDS? Relational Database Service AWS provides infrastructure Customer builds the application https://aws.amazon.com/rds/
RDS Postgres Managed PostgreSQL AWS manages the infrastructure High Availability – Automated Failover Automated Backups Multi Datacenter (Availability Zone) PostgreSQL running in an AWS Managed EC2 machine https://aws.amazon.com/rds/
Aurora Postgres Same Benefits as RDS PostgreSQL Amazon Aurora features a distributed, fault-tolerant, self-healing storage system that auto-scales up to 64TB per database instance. It delivers high performance and availability with up to 15 low-latency read replicas, point-in-time recovery, continuous backup to Amazon S3, and replication across three Availability Zones (AZs). https://aws.amazon.com/rds/
Aurora Postgres Data is replicated six times across three Availability Zones Continuous backup to Amazon S3 (built for 11 9s durability) Continuous monitoring of nodes and disks for repair Storage volume automatically grows up to 64 TB AZ 1 AZ 2 AZ 3 Amazon S3 R/W Database Node R/O Database Node Storage Monitoring Storage Node Storage Node Storage Node Storage Node Storage Node Storage Node
What is Amazon RDS? Relational Database Service AWS provides infrastructure Customer builds the application https://aws.amazon.com/rds/
AWS Shared Responsibility Model https://aws.amazon.com/compliance/shared-responsibility-model/
Managed PostgreSQL on RDS or Aurora Scaling High availability Database backups DB s/w patches DB s/w installs OS patches OS installation Server maintenance Rack and stack DB optimization Power, HVAC, net you
DBA responsibilities Security Provisioning Resiliency When to scale Data Model Indexing VACUUM
DBA responsibilities Security Provisioning Resiliency When to scale Data Model Indexing VACUUM https://www.usatoday.com/story/news/animalkind/2018/07/24/how-power-music-brought-peace-elephant/820320002/
Labs Provision RDS Postgres Provision Management host (EC2) Connectivity Monitoring H/A Backup / Recovery De-Provision RDS Postgres De-Provision EC2
An Elephant is still an Elephant Running on server (EC2) Storage EBS (RDS Postgres) Aurora Storage Memory CPU
Get Started! http://tinyurl.com/pgconf2019-pgaws
VPC Amazon VPC – Virtual Private Cloud Your network in the cloud Subnets, Routers, Route Tables Same rules apply as physical networks
VPC – Ingress & Egress Public / Private subnets Most databases fall into private subnets Use a management / bastion host to connect Customers can make VPN connections to their VPCs for simplified access
Security Groups Act as a firewall in the cloud Allow for specific control of network access Host -> Host Host -> Internet Internet -> Host Can be added and updated dynamically Be careful with rules
Security Groups
Monitoring CloudWatch Enhanced Monitoring Graphical interface for live and historical metrics CPU / IO / Network / Disk Metrics are available to download https://aws.amazon.com/premiumsupport/knowledge-center/cloudwatch-getmetricdata-api/ Enhanced Monitoring ‘top’ in a browser
Monitoring – Performance Insights Drill-down interface for interacting with Postgres runtime stats Live stats picked up every second Ties SQL Statements and wait_events together Allows for simplified trend monitoring https://postgresconf.org/conferences/2019/program/proposals/wait-what-s-going-on-inside-my-database-understanding-postgresql-wait-events Thursday 4:20 NY Ballroom West
Configuration RDS Postgres instances have a parameter group Some options are dynamic, some are not (as in standard postgres) By default, instances get the ‘default’ parameter group This group cannot be modified Create a new parameter group, change configuration there Assign the parameter group to your instance This requires downtime, for production, always create a parameter group for your instance before going live
Monitoring - Logs RDS presents the database logs via the web interface Many customers periodically download logs or archive them to S3 CLI / API job Export logs to AWS CloudWatch to enable alarms Tools like pgBadger provide in-depth reporting
Multi A-Z A region is a cluster of datacenters located in a geographical location Each region is made up of a logical group of datacenters known as an Availability one Multi A-Z (Availability Zone) in RDS provides resources in more than one Availability Zone for resiliency
Multi A-Z Multi AZ in RDS uses synchronous, storaged-based replication Zero Data Loss Fast failover to another Availability Zone Standby host is not addressable directly until after failover Use the ‘endpoint’ to automatically update the connection
Read Replicas Users can add Read Replicas, leveraging standard Postgres replication Modify an instance Add a ‘Read Replica’ Replicas can be connected to and read from Replicas can be promoted to writer
Learn more.. aws.amazon.com/rds aws.amazon.com/rds/aurora
Thank you!