DEV Community

Cover image for CDK AWS Aurora PostgreSQL Limitless

CDK AWS Aurora PostgreSQL Limitless

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


๐Ÿš€ 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

alt text

  src
  โ”œโ”€โ”€ bin
  โ”‚   โ””โ”€โ”€ main.ts
  โ””โ”€โ”€ lib
      โ”œโ”€โ”€ cluster.ts
      โ””โ”€โ”€ shared
          โ”œโ”€โ”€ constants.ts
          โ”œโ”€โ”€ environment.ts
          โ”œโ”€โ”€ index.ts
          โ””โ”€โ”€ tagging.ts
Enter fullscreen mode Exit fullscreen mode
  • 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
Enter fullscreen mode Exit fullscreen mode
  • Deploy
  โœ— cdk ls
  AuroraPostgresLimitlessClusterStack

  โœ— cdk deploy AuroraPostgresLimitlessClusterStack
Enter fullscreen mode Exit fullscreen mode

๐Ÿš€ Test

  • Cluster created

alt text

  • Go to sample_sql
  cd sample_sql
Enter fullscreen mode Exit fullscreen mode
  • Create E-Commerce sample schema's standard tables
  \i create_standard_tables_ec_sample_schema.sql
Enter fullscreen mode Exit fullscreen mode
  • Convert E-Commerce sample schema's standard tables to limitless tables
  \i convert_standard_tables_to_limitless_ec_sample_schema.sql
Enter fullscreen mode Exit fullscreen mode
  • 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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

๐Ÿš€ 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:

Top comments (2)

Collapse
 
m0ltzart profile image
Roman

Thatโ€™s a bit like โ€˜the rest of the owlโ€™ meme. Do you have the code for CDK? I didnโ€™t even think there was CloudFormation support yet.

Collapse
 
vumdao profile image
๐Ÿš€ Vu Dao ๐Ÿš€