Databases are no doubt a critical piece of the infrastructure and architecture puzzle. FlexStack makes it easy to integrate with your favorite database, whether it's on RDS or hosted by a third-party.
Amazon Relational Database Service (RDS)
AWS RDS is a managed database service with support for several relational database engines. It's an attractive option for a few reasons:
- IaC: As with FlexStack, these resources are easily integrated into IaC workflows like Terraform, CloudFormation, and CDK. FlexStack itself uses CloudFormation to manage your resources.
- Fully managed: Amazon RDS is a fully managed service, meaning AWS handles routine database tasks like backups, patch management, and scaling. Like FlexStack itself, this allows you to focus more on your application development and less on maintenance.
- Seamless Integration: Permitting your FlexStack services to use your RDS database is easy.
- High Availability: RDS provides built-in high availability and failover support with Multi-AZ deployments, ensuring that your applications have minimal downtime and data loss in the case of failures.
- Automated Backups: RDS automatically performs backups and allows for point-in-time recovery.
Integrate with FlexStack
We've made it simple to integrate RDS and other AWS managed database solutions with your FlexStack services.
- Create your RDS database in your environment VPC. To do this, find the VPC matching
FlexStack-Environment-[ENVIRONMENT_ID]
. Your environment ID can be found on the Environment > Settings page.
- In Security Groups, select the group matching
FlexStack-Database-[ENVIRONMENT_ID]
. You can search for this using the input in their dropdown. This security group authorizes all of the services in your environment to access the database over the network.
- Create a long, unguessable password for your RDS instance. You can do this in your local terminal with the openssl utility.
- Once your database has been created, add the hostname, username, password, and port number to FlexStack secrets. You can then provide these credentials to a database client using environment variables in your application code.
Amazon DynamoDB
AWS DynamoDB is a NoSQL key/value database designed to provide fast and predictable performance with seamless scalability. It is used heavily for building sophisticated, serverless architectures and data pipelines. It is a nice option for teams looking for a database that is:
- Schema-less: It can handle a variety of data types and structures, including key-value pairs, documents, and graphs making it suitable for a wide range of applications.
- Transactional: DynamoDB supports ACID (Atomicity, Consistency, Isolation, Durability) transactions.
- Integrated with other AWS services: Integrates seamlessly with services like Lambda, S3, Kinesis, and Redshift.
- Streamable: Streams capture data modification events in DynamoDB tables, allowing you to set up triggers that perform actions based on these changes.
- Serverless: AWS abstracts away the underlying infrastructure management.
Integrate with FlexStack
The simplest way to integrate DynamoDB into FlexStack services is using resource RBAC. That is, you can add magic tags to your DynamoDB tables which permit services managed by FlexStack to access the table.
To allow access from an entire project, add these tags to a table. Replace PROJECT_ID with your project's ID.
Key | Value | Description |
---|---|---|
FlexStack:ProjectID:PROJECT_ID:Role | FullAccess | Allow full access to a table |
FlexStack:ProjectID:PROJECT_ID:Role | ReadOnlyAccess | Allow read-only access to a table |
To allow access from an entire environment, add these tags to a table. Replace ENVIRONMENT_ID with your environment's ID.
Key | Value | Description |
---|---|---|
FlexStack:EnvironmentID:ENVIRONMENT_ID:Role | FullAccess | Allow full access to a table |
FlexStack:EnvironmentID:ENVIRONMENT_ID:PROJECT_ID:Role | ReadOnlyAccess | Allow read-only access to a table |
To allow access from a specific component, add these tags to a table. Replace COMPONENT_ID with your component's ID.
Key | Value | Description |
---|---|---|
FlexStack:ComponentID:COMPONENT_ID:Role | FullAccess | Allow full access to a table |
FlexStack:ComponentID:COMPONENT_ID:PROJECT_ID:Role | ReadOnlyAccess | Allow read-only access to a table |
Example DynamoDB table with tags:
When a service has ReadOnlyAccess it can perform the following actions on a DynamoDB table:
dynamodb:BatchGet*
dynamodb:Describe*
dynamodb:Get*
dynamodb:List*
dynamodb:PartiQLSelect
dynamodb:Query
dynamodb:Scan
Third-party recommendations
Below is a list of third-party database solutions we love due to their proximity to/availability in AWS regions, in addition to their scalable pricing models. Of course, you can opt to use any third-party provider you'd like, but these are the ones we'd choose.
ClickHouse (OLAP)
ClickHouse is a columnar database for online analytical processing (OLAP). Developed by Yandex, it is designed to handle large volumes of data quickly and efficiently, making it suitable for real-time analytics. ClickHouse Cloud is currently in use by a wide variety of companies including Sony, Lyft, Cisco, GitLab.
ClickHouse Cloud operates in 10 out of the 12 regions that FlexStack deploys environments to, making it an excellent choice for companies looking for an OLAP data solution.
To integrate with FlexStack, create a ClickHouse database in the same region you're hosting your environment. Then, use secrets to securely add your database credentials to your app's environment variables. Read the environment variables in your application code and provide them to one of ClickHouse's client integrations.
Supabase (Postgres)
Supabase is a popular open source Firebase alternative and Postgres database that includes a wide range of client APIs for things like authentication, storage, and real-time multiplayer. It's an attractive solution due to the huge number of application problems it solves and it's expansive, growing community/ecosystem.
We love it because it helps teams move faster, it's self-hostable, and it operates in 9 out of 12 regions that FlexStack environments deploy to.
To integrate with FlexStack, create a Supabase project in the same region you're hosting your environment.
Create a long, unguessable password for your Supabase database. You can do this in your local terminal with the openssl utility.
Then, use secrets to securely add your Supabase key and URL to your app's environment variables. Read the environment variables in your application code and provide the Supabase key and Supabase URL to one of their client libraries.
PlanetScale (MySQL)
PlanetScale is a database platform built on top of a horizontally scalable, MySQL-compatible database clustering system called Vitess which originally created by YouTube. It is as powerful as managed database solutions get, offering a wide range of benefits including reliability, performance, version upgrades, database branches, and much more. They are also well-known for zero-downtime migrations of databases as large as 250TB.
We love it because it is actually fully-managed and operates in 10 out of 12 AWS regions that FlexStack environments deploy to.
To integrate with FlexStack, create a PlanetScale database in the same region you're hosting your environment. Then, use secrets to securely add your database credentials to your app's environment variables. Read the environment variables in your application code and provide them to a MySQL-compatible database client of your choice.
Turso (SQLite)
Turso is a SQLite-compatible database built on libSQL. You can scale to hundreds of thousands of databases per organization while supporting replication to any location for microsecond-latency access. Turso is cool because you can feasibly offer each user of your application their own database and place it near that specific user's location.
We love it because of it's wide range of regions which cover or are in the vicinity of all of the regions that FlexStack deploys to.
To integrate with FlexStack, create a Turso database near the region you're hosting your environment. Generate a token for your database and use secrets to securely provide it and your Turso database URL to your app's environment variables. Read the environment variables in your application code and provide them to a Turso client library.
MongoDB Atlas (Document)
MongoDB Atlas is a fully managed cloud database service provided by MongoDB. MongoDB has a wide range of use cases in AI, IoT, personalization, content management, analytics, and more. MongoDB Atlas has a serverless offering with a generous free tier.
We love it because it has instances available in every AWS region you can deploy FlexStack environments to.
To integrate with FlexStack, create a MongoDB Atlas instance in the same AWS region your environment is hosted in. Then, use secrets to securely add your MongoDB credentials (cluster name, username, password) to your app's environment variables. Read the environment variables in your application code and provide them to the MongoDB driver for your programming language.