Skip to content

CDK AWS Aurora PostgreSQL Limitless

Posted on:August 18, 2024Β atΒ 03:57 PM

image

Abstract

  • The Amazon Aurora PostgreSQL Limitless Database is now generally available, offering an advanced solution to scale your Aurora cluster seamlessly. This technology enables millions of write transactions per second and supports petabytes of data, all while maintaining the simplicity of operating a single database instance.
  • This post outlines a structured approach to creating an Amazon Aurora PostgreSQL Limitless Database using the AWS Cloud Development Kit (CDK) in TypeScript for demontration of Amazon Aurora PostgreSQL Limitless Database

Table Of Contents

Open Table Of Contents

πŸš€ Deploying Aurora PostgreSQL Limitless Database Using AWS CDK

  • The structure includes VPC, Aurora PostgreSQL Limitless Database with one shard group, secret manager for storing RDS credential, EC2 as bastion-host for access database in private network

  • Source code:

    src
    β”œβ”€β”€ bin
    β”‚   └── main.ts
    └── lib
        β”œβ”€β”€ cluster.ts
        └── shared
            β”œβ”€β”€ constants.ts
            β”œβ”€β”€ environment.ts
            β”œβ”€β”€ index.ts
            └── tagging.ts
  • Adjust CDK_DEFAULT_REGION and CDK_DEFAULT_ACCOUNT in src/lib/shared/constants to yours

  • Adjust the max

    serverlessV2MaxCapacity: 64, // Adjust this for your test.
    serverlessV2MinCapacity: 16, // Minimum allow is 16
  • Deploy

    βœ— cdk ls
    AuroraPostgresLimitlessClusterStack
    
    βœ— cdk deploy AuroraPostgresLimitlessClusterStack

πŸš€ Test

  • Cluster created

    alt text

  • Go to sample_sql

    cd sample_sql
  • Create E-Commerce sample schema’s standard tables

    \i create_standard_tables_ec_sample_schema.sql
  • Convert E-Commerce sample schema’s standard tables to limitless tables

    \i convert_standard_tables_to_limitless_ec_sample_schema.sql
  • Load data into the orders and orderdetails tables using pgbench

    pgbench  -n --client=500 --jobs=100 --progress=60 --transactions=2000  -f insert_orders_orderdetails_ec_sample_schema.sql

    alt text

πŸš€ Check workload and scaling

  • Performance insight

    alt text

  • Cloudwatch metrics

    alt text

  • Query limitless table

    alt text

  • Query database tables

    alt text

πŸš€ Cleanup

  • Destroy resources to avoid cost
    cdk destroy AuroraPostgresLimitlessClusterStack

πŸš€ Conclusion

  • Give Aurora PostgreSQL Limitless Database a try by using AWS CDK to provision cluster faster and in secure way
  • Remember to adjust the query size and time of running to avoid huge cost

References: