Skip to content

Commit b6e57b6

Browse files
committed
Slightly less punchy, for less controversy
1 parent 432607c commit b6e57b6

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

practices/cloud-databases.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
- [Cloud databases](#cloud-databases)
44
- [Context](#context)
55
- [Details](#details)
6-
- [Choosing the type of database you need](#choosing-the-type-of-database-you-need)
76
- [Infrastructure](#infrastructure)
87

98
## Context
@@ -14,16 +13,10 @@
1413

1514
## Details
1615

17-
### Choosing the type of database you need
18-
19-
Do not reflexively reach for a specific database product without considering whether it matches your use case. In general you should prefer relational stores because of their feature set and design choices which make them broadly applicable. Choose a non-relational store only if the trade-off makes sense for your application. An example would be needing extremely high write rates (in the range of millions of operations per minute) where eventual consistency is tolerable: in that case DynamoDB or equivalent may be appropriate.
20-
21-
Prefer to learn how to use the right tool for the job over picking the tool a team happens to be familiar with.
22-
2316
### Infrastructure
2417

2518
Successfully operating relational databases in a cloud environment, especially a serverless one, requires attention to the specific qualities of the database products as implemented by the cloud platforms.
2619

27-
- Do use a small number of long-lived server instances. Do not create new servers per application environment. Database servers can be very slow to instantiate, which means that tools like `terraform` can time out waiting for them to start. Instead separate your infrastructure code so that your servers are configured once per AWS account. The `terraform` code that configures an application instance should provision its resources by calling into the already-provisioned server in the account to create environment-specific databases.
28-
- Do manage your database migrations. Use a tool like `alembic`, or an alternative. If building a serverless application, deploy your migrations into a cloud function that will be called by your `terraform` deployment.
20+
- Do use a small number of long-lived server instances. Do not create new servers per application environment. Database servers can be very slow to instantiate, which means that tools like `terraform` can time out waiting for them to start. Instead separate your infrastructure code between configuration for the application and configuration for the account, so that your servers are configured once per AWS account. The `terraform` code that configures an application instance should provision its resources by calling into the already-provisioned server in the account to create environment-specific databases.
21+
- Do manage your database migrations. If you are using a web framework like Django, or Rails, you will have tooling built in to do this. Otherwise, use a tool like `alembic` if several people are likely to be working on features which change the database structure at the same time. If your needs are simpler, you may find a more straightforward approach - storing SQL scripts and sequentially running them, for instance - works just as well with fewer dependencies. If building a serverless application, deploy your migrations into a cloud function to be called by your `terraform` deployment.
2922
- Learn how to refactor database schemas safely. Several coupled migrations and code changes may be needed to successfully change the schema with no downtime.

0 commit comments

Comments
 (0)