> For the complete documentation index, see [llms.txt](https://docs.stackmate.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackmate.io/configuration/database-services.md).

# Database services

Stackmate offers infrastructure deployment for major managed database services (like AWS RDS for example)

### What you get when introducing this service to your configuration

* A managed database instance with sane defaults

### Required attributes

* `type` - **string** - It should be either `mysql`, `postgresql` or `mariadb`

### Optional attributes

* `provider` - **string** - by default is set to `aws`
* `size` - **string** - The instance size. Should be one of the instances the cloud provider has available
* `version` - **string** - The database version to use. These are dictated by the cloud provider (eg. AWS) and it's one of the versions they currently support.
* `storage` - **number** - The size of the storage space in Gigabytes
* `database` - **string** - The name of the database to deploy
* `port` - **number** - The port to use. By default, `3306` is assigned to `mysql` and `mariadb` and `5432` for `postgresql`
* `monitoring` - **object** - Any monitoring options available for the service. Example configuration is shown below

The typical [Common Service Options](/configuration/configuration-file/environments.md#common-service-options) apply here too.

### Credentials for the root user:

The password for the root user associated with the database, is stored as a secret on your provider, you can link directly to it through your provider's secret manager (eg. AWS secrets manager)

### Example configuration

```yaml
# ... the rest of the configuration ...
environments:
  production:
    # ... more services ...
    my-database:
      type: mysql
      provider: aws         # optional when your provider's set to aws
      region: eu-central-1  # optional if you have a region set for the project
      size: db.t2.micro
      storage: 30
      version: 8.0
      database: my-database
      profile: default      # this is the default
      monitoring:
        urls:
          - https://a-webhook-to-get-alerted-by.com
        emails:
          - database-alerts@mywebsite.com
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stackmate.io/configuration/database-services.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
