Skip to content

Use this project for proofs-of-concept where you need to emulate an application sending regular database transactions or for stress testing existing PostgreSQL installations.

Notifications You must be signed in to change notification settings

ivanomarot/rds_postgres_quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Postgres (RDS) Quickstart

Overview

This project contains an AWS Cloud Development Kit (CDK) based solution that provisions a database using Amazon RDS for PostgreSQL and an EC2 based bastion host that uses pgbench to send transactions periodically to the database.

You can use this project for proofs-of-concept where you need to emulate an application sending regular database transactions or for stress testing existing PostgreSQL installations.

Default specifications

  • PostgreSQL version 11.8 with a single SMALL instance.

  • Logical replication enabled (useful to enable CDC replication)

  • EC2 bastion host of instance size t3.micro accessible through SSM

  • Pgbench runs every minute, during periods of 30 seconds (-T 30), and simulates transactions from 10 clients (-c 10). This is performed with a sequence of SQL statements running against for 4 tables:

    • pgbench_branches
    • pgbench_tellers
    • pgbench_accounts
    • pgbench_history

How to deploy?

Prerequisites:

Deployment steps:

  1. Clone this repository

  2. Install dependencies

    sudo pip3 install -r requirements.txt
  3. Boootstrap CDK

    cdk bootstrap
  4. Deploy all the stacks

    cdk deploy --require-approval never "*" 

Changing specifications

If you want to customize the parameters that control the workload generated by pgbench, you can use AWS System Manager Session Manager to log into the instance. The pgbench utility is configured in the operative system scheduler as shown below.

sudo cat /etc/cron.d/pgbench_cron
*/2 * * * * root pgbench -c 10 -T 30 -h your_rds.rds.amazonaws.com -p 5432 -U postgres test

Clean up

Remove your AWS resources:

cdk destroy "*"

About

Use this project for proofs-of-concept where you need to emulate an application sending regular database transactions or for stress testing existing PostgreSQL installations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published