-
Notifications
You must be signed in to change notification settings - Fork 139
Expand file tree
/
Copy pathdatabases_create_cluster.yml
More file actions
123 lines (102 loc) · 3.98 KB
/
databases_create_cluster.yml
File metadata and controls
123 lines (102 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
operationId: databases_create_cluster
summary: Create a New Database Cluster
description: >-
To create a database cluster, send a POST request to `/v2/databases`. To see a list
of options for each engine, such as available regions, size slugs, and versions,
send a GET request to the `/v2/databases/options` endpoint. The available sizes for
the `storage_size_mib` field depends on the cluster's size. To see a list of available
sizes, see [Managed Database Pricing](https://www.digitalocean.com/pricing/managed-databases).
The create response returns a JSON object with a key called `database`. The value of this
is an object that contains the standard attributes associated with a database
cluster. The initial value of the database cluster's `status` attribute is
`creating`. When the cluster is ready to receive traffic, this changes to
`online`.
The embedded `connection` and `private_connection` objects contains the
information needed to access the database cluster. For multi-node clusters, the
`standby_connection` and `standby_private_connection` objects contain the information
needed to connect to the cluster's standby node(s).
DigitalOcean managed PostgreSQL and MySQL database clusters take automated daily backups.
To create a new database cluster based on a backup of an existing cluster, send a POST
request to `/v2/databases`. In addition to the standard database cluster attributes, the
JSON body must include a key named `backup_restore` with the name of the original
database cluster and the timestamp of the backup to be restored. Creating a database
from a backup is the same as forking a database in the control panel.
Note: Redis cluster creates are no longer supported as of 2025-04-30T00:00:00Z.
Backups are also not supported for Redis or Valkey clusters.
tags:
- Databases
requestBody:
required: true
content:
application/json:
schema:
allOf:
- $ref: "models/database_cluster.yml"
- type: object
properties:
backup_restore:
$ref: "models/database_backup.yml"
examples:
Create a New Database Cluster:
value:
name: backend
engine: pg
version: "14"
region: nyc3
size: db-s-2vcpu-4gb
storage_size_mib: 61440
num_nodes: 2
tags:
- production
Create a New Database Cluster with trusted sources:
value:
name: backend
engine: pg
version: "14"
region: nyc3
size: db-s-2vcpu-4gb
num_nodes: 2
storage_size_mib: 61440
tags:
- production
rules:
- type: ip_addr
value: "192.168.1.1"
description: "my home IP address"
- type: k8s
value: ff2a6c52-5a44-4b63-b99c-0e98e7a63d61
- type: droplet
value: "163973392"
- type: tag
value: test
Restore from a Database Cluster Backup:
value:
name: backend-restored
backup_restore:
database_name: backend
backup_created_at: "2019-01-31T19:25:22Z"
engine: pg
version: "14"
region: nyc3
size: db-s-2vcpu-4gb
num_nodes: 2
responses:
"201":
$ref: "responses/database_cluster.yml"
"401":
$ref: "../../shared/responses/unauthorized.yml"
"404":
$ref: "../../shared/responses/not_found.yml"
"429":
$ref: "../../shared/responses/too_many_requests.yml"
"500":
$ref: "../../shared/responses/server_error.yml"
default:
$ref: "../../shared/responses/unexpected_error.yml"
x-codeSamples:
- $ref: "examples/curl/databases_create_cluster.yml"
- $ref: "examples/go/databases_create_cluster.yml"
- $ref: "examples/python/databases_create_cluster.yml"
security:
- bearer_auth:
- "database:create"