SlideShare a Scribd company logo
Provisioning and Automating High
Availability Postgres on AWS EC2
Payal Singh
DBA@OmniTI
1
Who am I?
DBA@OmniTI
Github: payals
Blog: http://penningpence.blogspot.com
Twitter: @pallureshu
Email: payal@omniti.com
2
Agenda
RDS vs EC2
Design
Provisioning Tools
Automate
3
Why EC2 over RDS?
Control
•Debugging
•Third party tools
•Resources
Flexibility
•Migration - globals
•Compatibility with non-AWS resources
•Monitoring
4
If you’re going from RDS to EC2...
More administration
Less handholding
Security
Basic monitoring
5
Automation Tools
6
Popular Automation Tools
7
Types of Tools
8
What is Terraform?
Tool for building, changing and versioning infrastructure
Specializes in cloud infrastructure management
9
10
Why I chose Ansible
Simple
Learning curve
Galaxy and modules
Push - more convenient
Clarity - YAML
11
Design
12
What to Design?
EC2 Setup
Installs and reinstalls, dependencies
Tuning and customization
Replication
Backups
Monitoring
Failover
13
14
Is there any such thing as a
In Postgres automation?
15
YES
16
17
18
19
20
Setup
and
Initialization
21
EC2 Setup - variables
22
EC2 Setup - main.tf
23
EC2 Setup - main.tf optionals
24
Terraform apply
Terraform applied!
Installation
Main YAML File
Installs
Get the repository:
Installing postgres and supporting packages:
postgresql_version: "9.6" 29
Re-installs
30
Customization
and Tuning
Customization
$PGDATA
Extensions
32
Tuning - postgresql.conf
Template files:
Attributes:
33
Tuning - pg_hba.conf
Template:
34
Tuning pg_hba.conf
Values:
File:
35
Ansible-playbook main.yml
Provisioning and automating high availability postgres on aws ec2 (1)
Provisioning and automating high availability postgres on aws ec2 (1)
Replication
Replication
40
Replication – recovery.conf
Ansible and replication
Groups:
42
Pgpass file
43
Provisioning and automating high availability postgres on aws ec2 (1)
Provisioning and automating high availability postgres on aws ec2 (1)
Slave Rebuild
Switch
Base backup
46
pg_rewind
Synchronize a PostgreSQL cluster with another copy of the same cluster,
after the clusters' timelines have diverged
9.5 and above
Superuser access
wal_log_hints = 'on' or enable data checksums
47
Backups
Backups and restores - Setup
PITR:
S3:
49
Backups
50
Restores
51
Configure PITR
52
WAL-e dependencies
53
Cronjobs
54
Monitoring
and
Alerts
Custom Monitoring
http://docs.ansible.com/ansible/list_of_monitoring_modules.html
CloudWatch Monitoring
Failover
Failover
Boolean parameter:
promote_slave: False
59
Provisioning and automating high availability postgres on aws ec2 (1)
PgPool
and
Completely Automated Failover
62
Pgpool
PgPool
Watchdog
Watchdog
PgPool + Watchdog
Virtual IPs
Elastic IP in AWS:
68
Avoid
a Disaster
Useful Links
https://github.com/payals/postgresql_automation
https://galaxy.ansible.com/
http://docs.ansible.com/
https://www.terraform.io/docs/
70
Questions?
71

More Related Content

PDF
Understand your system like never before with OpenTelemetry, Grafana, and Pro...
PDF
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021
PPTX
Data Federation with Apache Spark
PDF
Using ClickHouse for Experimentation
PDF
Introduction to kubernetes
PDF
Kubernetes Deployment Strategies
PPTX
Service Discovery In Kubernetes
PPTX
Interop 2018 - Understanding Kubernetes - Brian Gracely
Understand your system like never before with OpenTelemetry, Grafana, and Pro...
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021
Data Federation with Apache Spark
Using ClickHouse for Experimentation
Introduction to kubernetes
Kubernetes Deployment Strategies
Service Discovery In Kubernetes
Interop 2018 - Understanding Kubernetes - Brian Gracely

What's hot (20)

PDF
Istio service mesh introduction
PPT
Red hat linux 9 ppt2003
PPTX
Docker introduction
PDF
Advanced Deployment Strategies with Kubernetes and Istio
PPTX
SRE 101 (Site Reliability Engineering)
PDF
Patroni: Kubernetes-native PostgreSQL companion
PDF
Lyft data Platform - 2019 slides
PPTX
Kubernetes fundamentals
PDF
Intro to GitOps & Flux.pdf
ODP
Kubernetes Architecture
PDF
Gartner 2021 Magic Quadrant for Cloud Database Management Systems.pdf
PDF
Monoliths to microservices workshop
PDF
Fully automated kubernetes deployment and management
PPTX
Data Onboarding Breakout Session
PDF
Monitoring with Prometheus
PDF
What CloudStackers Need To Know About LINSTOR/DRBD
PDF
OpenShift 4, the smarter Kubernetes platform
PDF
Deep dive into Kubernetes Networking
PDF
Open shift 4 infra deep dive
PDF
Cloud-native Semantic Layer on Data Lake
Istio service mesh introduction
Red hat linux 9 ppt2003
Docker introduction
Advanced Deployment Strategies with Kubernetes and Istio
SRE 101 (Site Reliability Engineering)
Patroni: Kubernetes-native PostgreSQL companion
Lyft data Platform - 2019 slides
Kubernetes fundamentals
Intro to GitOps & Flux.pdf
Kubernetes Architecture
Gartner 2021 Magic Quadrant for Cloud Database Management Systems.pdf
Monoliths to microservices workshop
Fully automated kubernetes deployment and management
Data Onboarding Breakout Session
Monitoring with Prometheus
What CloudStackers Need To Know About LINSTOR/DRBD
OpenShift 4, the smarter Kubernetes platform
Deep dive into Kubernetes Networking
Open shift 4 infra deep dive
Cloud-native Semantic Layer on Data Lake
Ad

Similar to Provisioning and automating high availability postgres on aws ec2 (1) (20)

PDF
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
PPTX
Automating a PostgreSQL High Availability Architecture with Ansible
 
PDF
Postgres in Amazon RDS
PPTX
Deep dive into the Rds PostgreSQL Universe Austin 2017
PDF
Deploying postgre sql on amazon ec2
PPTX
How to Design for Database High Availability
 
PDF
Reducing the Risks of Migrating Off Oracle
 
PDF
10/ EnterpriseDB @ OPEN'16
PPTX
Postgres for Digital Transformation: NoSQL Features, Replication, FDW & More
PDF
Elephants in the Cloud
PDF
Postgres & Red Hat Cluster Suite
 
PDF
Codified PostgreSQL Schema
PDF
PostgreSQL High Availability in a Containerized World
PDF
Oracle Cloud - Infrastruktura jako kód
PDF
Oracle Databases on AWS - Getting the Best Out of RDS and EC2
PDF
Best Practices & Lessons Learned from Deployment of PostgreSQL
 
PPTX
Deploy, move and manage Postgres across cloud platforms
PDF
Reducing Database Pain & Costs with Postgres
 
PDF
Postgres Deployment Automation with Terraform and Ansible
 
PPTX
Automating the Entire PostgreSQL Lifecycle
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
Automating a PostgreSQL High Availability Architecture with Ansible
 
Postgres in Amazon RDS
Deep dive into the Rds PostgreSQL Universe Austin 2017
Deploying postgre sql on amazon ec2
How to Design for Database High Availability
 
Reducing the Risks of Migrating Off Oracle
 
10/ EnterpriseDB @ OPEN'16
Postgres for Digital Transformation: NoSQL Features, Replication, FDW & More
Elephants in the Cloud
Postgres & Red Hat Cluster Suite
 
Codified PostgreSQL Schema
PostgreSQL High Availability in a Containerized World
Oracle Cloud - Infrastruktura jako kód
Oracle Databases on AWS - Getting the Best Out of RDS and EC2
Best Practices & Lessons Learned from Deployment of PostgreSQL
 
Deploy, move and manage Postgres across cloud platforms
Reducing Database Pain & Costs with Postgres
 
Postgres Deployment Automation with Terraform and Ansible
 
Automating the Entire PostgreSQL Lifecycle
Ad

Recently uploaded (20)

PPT
Introduction Database Management System for Course Database
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
AI in Product Development-omnex systems
PPTX
Online Work Permit System for Fast Permit Processing
PDF
System and Network Administraation Chapter 3
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Introduction to Artificial Intelligence
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Digital Strategies for Manufacturing Companies
PPTX
Transform Your Business with a Software ERP System
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
System and Network Administration Chapter 2
Introduction Database Management System for Course Database
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Understanding Forklifts - TECH EHS Solution
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Design an Analysis of Algorithms I-SECS-1021-03
How to Choose the Right IT Partner for Your Business in Malaysia
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
AI in Product Development-omnex systems
Online Work Permit System for Fast Permit Processing
System and Network Administraation Chapter 3
CHAPTER 2 - PM Management and IT Context
Operating system designcfffgfgggggggvggggggggg
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Introduction to Artificial Intelligence
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Digital Strategies for Manufacturing Companies
Transform Your Business with a Software ERP System
Upgrade and Innovation Strategies for SAP ERP Customers
System and Network Administration Chapter 2

Provisioning and automating high availability postgres on aws ec2 (1)