# Managed cloud databases > How to create and run managed databases and caches (RDS, Aurora, ElastiCache and DigitalOcean databases) in your cloud account from the panel. A managed database is created and maintained by the cloud: backups, updates, disk and high availability are its job. Ployter creates the database in **your** AWS or DigitalOcean account, stores the connection details and hands the variables to services. The charges show up on your cloud invoice. To start quickly with no extra cost, you can also run the database in a container. See [Databases as a service](https://ployter.com/en/docs/databases/databases/). ## What you can create | Type | AWS | DigitalOcean | | --- | --- | --- | | MySQL | RDS or Aurora (MySQL 8.4 and 8.0) | Managed MySQL 8 | | PostgreSQL | RDS or Aurora (17, 16 and 15) | Managed PostgreSQL (17, 16 and 15) | | Redis | ElastiCache (Redis 7.1) | Managed Valkey 8, Redis compatible | | Bucket | S3 | Spaces | Buckets have their own page: [Buckets (S3 and Spaces)](https://ployter.com/en/docs/databases/buckets/). ## Before you start - Connect a cloud: [AWS](https://ployter.com/en/docs/integrations/aws/) or [DigitalOcean](https://ployter.com/en/docs/integrations/digitalocean/). Your own server can't create managed databases. - The plan limits how many managed databases, caches and buckets the team can have (**Managed databases, caches and buckets** limit). Read replicas count. - Your role needs the **Create managed databases and caches** permission (owner and admin, by default). ## Create a database or cache 1. Open the project and click **Database or bucket**. 2. In **Type**, pick **MySQL**, **PostgreSQL** or **Redis**. 3. Fill in the **Name** and pick the cloud **Account**. 4. Pick the **Region** and the **Network**. Create the database on the network of the servers that will use it: they connect over the private network. If there's no network in the region, the panel creates one (**Automatic network**). 5. On AWS, pick the **Format**: **RDS (instance)**, with a fixed disk and the cheapest way to start, or **Aurora**, with a disk that grows by itself, replicas that take over in seconds and a Serverless option. 6. Pick the **Size**. For Aurora Serverless, enter the **Minimum capacity (ACU)** and **Maximum capacity (ACU)**. 7. For RDS, pick the **Disk (GB)** and the **Automatic backup** (1 to 35 days). 8. Open **Advanced** if you need to change the **Version**, the **Database name**, the **Replicas** (cache), high availability, **Disk autoscaling** or **Public access**. 9. Click **Create database** (or **Create cache**). ![Managed resource modal with PostgreSQL on AWS](https://ployter.com/assets/docs/en/managed-create-modal.webp) The database takes 5 to 15 minutes to be ready. The resource screen refreshes by itself. > [!WARNING] > **Public access** can only be chosen at creation: the cloud doesn't change it later. Turn it on only if you need to connect from outside the cloud (DBeaver on your computer, a server at another provider). The cache (Redis/Valkey) never has public access. ### High availability - **AWS RDS**: **Multi-AZ (high availability)** keeps a standby copy in another zone, which takes over by itself if the primary goes down. It doubles the machine cost. - **Aurora**: after creating, add a replica. It sits in another zone and becomes the primary in seconds. - **ElastiCache**: Multi-AZ requires at least 1 replica. - **DigitalOcean**: **Standby node (high availability)**. The smallest size (1 GB) doesn't support it. ## Connect services Services use the database by reference. In a service variable, type `${{` and pick the database: the value is built at the deploy of the service using it and follows password changes, replicas and the pool. ```env DATABASE_URL=${{postgres-principal.DATABASE_URL}} ``` Variables the database provides: | Database | Variables | | --- | --- | | MySQL and PostgreSQL | `DATABASE_URL`, `DB_HOST`, `DB_PORT`, `DB_USER`, `DB_PASSWORD`, `DB_NAME`, `DB_SSL` | | With read replicas | `DATABASE_READ_URL`, `DATABASE_READ_URLS`, `DB_READ_HOST`, `DB_READ_HOSTS` | | With a connection pool | `DATABASE_DIRECT_URL` (and `DATABASE_URL` starts pointing to the pool) | | Redis/Valkey | `REDIS_URL`, `REDIS_HOST`, `REDIS_PORT`, `REDIS_PASSWORD`, `REDIS_TLS` | The connection is always encrypted (TLS). For Redis use `rediss://` (two "s"); with ioredis, `REDIS_URL` already handles it. In the resource's **Overview**, the **Variables** card shows each reference with a copy button, and **Used by** lists the services already using the database. ![Overview of a managed database with connection and variables](https://ployter.com/assets/docs/en/managed-overview.webp) > [!NOTE] > Older projects may have **Legacy links**: the service received the variables without them showing up in it. They keep working. **Convert to variables** creates the variables with references in the service, with the same names and values. ## Database sections The resource screen has the **Overview**, **Access**, **Replicas**, **Settings**, **Backups**, **Metrics and alerts**, **Logs** and **Maintenance** sections. Some only appear when the provider offers the feature. ### Access - **Databases and users** (MySQL and PostgreSQL): create databases and users with **Full** or **Read-only** access, as in the [container database](https://ployter.com/en/docs/databases/databases/). - **Connection pool**: see below. - Allowed IPs (databases with public access): the IPs that connect from outside the cloud. The change takes effect immediately. Prefer allowing specific IPs over opening to the whole internet. ### Connection pool The pool shares a few database connections among many clients (service replicas, workers, functions). - **AWS**: RDS Proxy, for MySQL and PostgreSQL. Pick the percentage of the database's connections it uses. It only accepts servers on the database's network and, for now, only the admin user. It takes 5 to 15 minutes and is billed separately by AWS. - **DigitalOcean**: PostgreSQL only, at no extra cost. Pick the **Mode** and the connections. With the pool, `DATABASE_URL` and `DB_*` point to it. Use `DATABASE_DIRECT_URL` for migrations and `LISTEN/NOTIFY` (in Prisma, `directUrl`). Click **Create pool** and deploy the services. ### Read replicas Replicas are read-only copies, updated from the primary within seconds. They take heavy queries (reports, listings, searches) off the primary. 1. In the **Replicas** section, click **Add replica**. 2. Pick the size and, on AWS, whether the replica will have Multi-AZ. 3. Click **Create replica**. The panel creates up to 5 replicas per database. In your code, use `DATABASE_READ_URL` only for reads (for example, Prisma's `readReplicas` extension): writing to the replica fails. A read right after a write may not find the data yet. On the replica's screen, **Promote to primary** turns off replication and it becomes an independent database. In Aurora, promotion swaps roles: the replica becomes the cluster's writer instance. > [!NOTE] > This section is about database replicas. To run your application on several servers, see [Replicas and load balancer](https://ployter.com/en/docs/scaling/replicas/). ### Settings - **Size**: changing it restarts the machine (with high availability, almost without interruption). - **Disk (GB)**: only grows. AWS accepts one disk change every 6 hours. On DigitalOcean, the disk comes with the size. - **Deletion protection**: the panel refuses to delete while it's on. On AWS it also applies in the AWS console. - **Database configuration**: database parameters. On AWS, it's a parameter group for this database only; some require a restart (**Restart now**). On DigitalOcean, it takes effect immediately. ### Metrics and alerts On AWS, the section shows CPU, memory, disk, connections and, for replicas, the lag behind the primary, from CloudWatch. In **Alerts**, set the threshold and how long each metric can stay above it. See [Notifications and alerts](https://ployter.com/en/docs/observability/notifications/#alertas-dos-bancos-gerenciados). DigitalOcean doesn't provide metrics through its API: follow them in its dashboard. ### Logs For MySQL and PostgreSQL, the **Logs** section has three tabs: - **Slow queries**: each query that went over the time limit. **Turn on slow query log** sets a 1 s limit. - **Errors**: errors and warnings from the database server. - **Heaviest**: the queries that keep the database busiest, adding up all executions. A good starting point for creating indexes. Click **Enable collection** if it isn't on yet. On DigitalOcean PostgreSQL, only the **Heaviest** tab works. ### Maintenance - Maintenance window (day and time in UTC) and, on AWS, the **Daily backup** time. - **Version**: update for fixes or to a major version. A major version can't be rolled back (only by restoring a backup): test it on a copy first. - **Pending updates**: apply now with **Apply now** or leave them for the window. ## Change the password 1. Open the database and click **More actions → Generate new password**. 2. Confirm with **Generate**. 3. Deploy the services that use the database. The current password stops working within moments, and services lose their connection until the deploy. For the AWS cache, the old password is still accepted until the next change. DigitalOcean Valkey can't change its password through the panel. ## Delete 1. Turn off **Deletion protection**, if it's on. 2. Remove the read replicas and the pool, and turn off legacy links, if any. Also remove references to the database from the services' variables. 3. Click **More actions → Delete**. On AWS, check **Keep a final snapshot** so you can restore later. DigitalOcean doesn't keep a final snapshot: the data is lost. ## Differences between AWS and DigitalOcean | | AWS | DigitalOcean | | --- | --- | --- | | Automatic backup | You choose 1 to 35 days | Daily, 7 days (fixed) | | Manual snapshot | Yes | No | | Metrics and alerts | Yes (CloudWatch) | No | | Connection pool | RDS Proxy (MySQL and PostgreSQL) | PostgreSQL only | | Final snapshot on delete | Yes | No | | Cache | ElastiCache (Redis) | Valkey, with no backup through the API and no password change | Backups and restore are covered in [Backups and restore](https://ployter.com/en/docs/databases/backups/#bancos-gerenciados).