# DynamoDbDataSourceProps

Properties for an AppSync DynamoDB datasource.

Extends: DynamoDbDataSourceProps
Extends: BackedDataSourceProps
Used as props by: DynamoDbDataSource

- Source: [`aws-appsync/lib/data-source.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-appsync/lib/data-source.ts#L246)
- Type last changed: v2.60.0 · 12 Jan 2023

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appsync as appsync } from 'aws-cdk-lib';
import { aws_dynamodb as dynamodb } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_appsync as interfaces_appsync } from 'aws-cdk-lib/interfaces';

declare const graphQLApiRef: interfaces_appsync.IGraphQLApiRef;
declare const role: iam.Role;
declare const table: dynamodb.Table;
const dynamoDbDataSourceProps: appsync.DynamoDbDataSourceProps = {
  api: graphQLApiRef,
  table: table,

  // the properties below are optional
  description: 'description',
  metricsConfig: appsync.DataSourceMetricsConfig.ENABLED,
  name: 'name',
  readOnlyAccess: false,
  serviceRole: role,
  useCallerCredentials: false,
};
```

## Properties

- `api`: [IGraphQLApiRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_appsync.IGraphQLApiRef.html) (required) — The API to attach this data source to.

- `description`: string = None — the description of the data source.

- `metricsConfig`: [DataSourceMetricsConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.DataSourceMetricsConfig.html) — Whether to enable enhanced metrics of the data source Value will be ignored, if `enhancedMetricsConfig.dataSourceLevelMetricsBehavior` on AppSync GraphqlApi construct is set to `FULL_REQUEST_DATA_SOURCE_METRICS`.

  **Default:** no metrics configuration

- `name`: string — The name of the data source.

  **Default:** id of data source

- `readOnlyAccess`: boolean = false — Specify whether this DS is read only or has read and write permissions to the DynamoDB table.

- `serviceRole`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — The IAM service role to be assumed by AppSync to interact with the data source.

  **Default:** Create a new role

- `table`: [ITable](/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.ITable.html) (required) — The DynamoDB table backing this data source.

- `useCallerCredentials`: boolean = false — use credentials of caller to access DynamoDB.
