# DataSourceOptions

Optional configuration for data sources.

- Source: [`aws-appsync/lib/graphqlapi-base.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-appsync/lib/graphqlapi-base.ts#L31)
- Type last changed: v2.242.0 · 10 Mar 2026

## Example

```ts
const schema = new appsync.SchemaFile({ filePath: 'mySchemaFile' })
const api = new appsync.GraphqlApi(this, 'api', {
  name: 'myApi',
  definition: appsync.Definition.fromSchema(schema),
  enhancedMetricsConfig: {
    dataSourceLevelMetricsBehavior: appsync.DataSourceLevelMetricsBehavior.PER_DATA_SOURCE_METRICS,
    operationLevelMetricsConfig: appsync.OperationLevelMetricsConfig.ENABLED,
    resolverLevelMetricsBehavior: appsync.ResolverLevelMetricsBehavior.PER_RESOLVER_METRICS,
  },
});

const noneDS = api.addNoneDataSource('none', {
  metricsConfig: appsync.DataSourceMetricsConfig.ENABLED,
});

noneDS.createResolver('noneResolver', {
  typeName: 'Mutation',
  fieldName: 'addDemoMetricsConfig',
  metricsConfig: appsync.ResolverMetricsConfig.ENABLED,
});
```

## Properties

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

  **Default:** No description

- `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:** Enhance metrics are disabled

- `name`: string — The name of the data source, overrides the id given by cdk.

  **Default:** generated by cdk given the id
