# Database Service V1 Reference

**Kind**: `db_service`<br />**Version**: `v1`

The `db_service` resource represents an instance of the Teleport Database Service. When the Database Service starts, it registers a `db_service` resource. You can query this resource to see a list of Database Service instances and the dynamic resource matchers they are configured to use in order to proxy databases configured via the dynamic `db` resource.

To learn more about using the `db_service` and `db` resources, see [Dynamic Database Registration](https://goteleport.com/docs/ver/19.x/enroll-resources/database-access/guides/dynamic-registration.md).

Read the [reference guide](https://goteleport.com/docs/ver/19.x/reference/infrastructure-as-code/teleport-resources/database-v3.md) for the `db` resource.

## Top-level fields

Example:

```
kind: "string"
sub_kind: "string"
version: "string"
metadata: # [...]
spec: # [...]

```

| Field Name | Description                                                                                                                                                                                                                 | Type                                                  |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| kind       | A resource kind                                                                                                                                                                                                             | string                                                |
| metadata   | Resource metadata                                                                                                                                                                                                           | [Metadata](#metadata)                                 |
| spec       | The resource spec.                                                                                                                                                                                                          | [Database Service Spec V1](#database-service-spec-v1) |
| sub\_kind  | An optional resource sub kind, used in some resources                                                                                                                                                                       | string                                                |
| version    | The API version used to create the resource. It must be specified. Based on this version, Teleport will apply different defaults on resource creation or deletion. It must be an integer prefixed by "v". For example: `v1` | string                                                |

## Database Resource Matcher

A set of properties that is used to match on resources.

Example:

```
labels: # [...]
aws: # [...]

```

| Field Name | Description | Type                                          |
| ---------- | ----------- | --------------------------------------------- |
| aws        |             | [Resource Matcher AWS](#resource-matcher-aws) |
| labels     |             | [Labels](#labels)                             |

## Database Service Spec V1

The DatabaseService Spec.

Example:

```
resources: 
  - # [...]
  - # [...]
  - # [...]
hostname: "string"

```

| Field Name | Description                                  | Type                                                       |
| ---------- | -------------------------------------------- | ---------------------------------------------------------- |
| hostname   | The hostname where this service is running.  | string                                                     |
| resources  | The configured match for Database resources. | \[][Database Resource Matcher](#database-resource-matcher) |

## Labels

A wrapper around map that can marshal and unmarshal itself from scalar and list values

## Metadata

Resource metadata

Example:

```
name: "string"
description: "string"
labels: 
  "string": "string"
  "string": "string"
  "string": "string"
expires: # See description
revision: "string"

```

| Field Name  | Description                                                                                                                                                                      | Type               |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| description | Object description                                                                                                                                                               | string             |
| expires     | A global expiry time header can be set on any resource in the system.                                                                                                            |                    |
| labels      | A set of labels                                                                                                                                                                  | map\[string]string |
| name        | An object name                                                                                                                                                                   | string             |
| revision    | An opaque identifier which tracks the versions of a resource over time. Clients should ignore and not alter its value but must return the revision in any updates of a resource. | string             |

## Resource Matcher AWS

Contains AWS specific settings for resource matcher.

Example:

```
assume_role_arn: "string"
external_id: "string"

```

| Field Name        | Description                                                                      | Type   |
| ----------------- | -------------------------------------------------------------------------------- | ------ |
| assume\_role\_arn | An optional AWS role ARN to assume when accessing a database.                    | string |
| external\_id      | An optional AWS external ID used to enable assuming an AWS role across accounts. | string |
