# BaseResolverProps

Basic properties for an AppSync resolver.

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

## Example

```ts
// Create username and password secret for DB Cluster
const secret = new rds.DatabaseSecret(this, 'AuroraSecret', {
  username: 'clusteradmin',
});

// The VPC to place the cluster in
const vpc = new ec2.Vpc(this, 'AuroraVpc');

// Create the serverless cluster, provide all values needed to customise the database.
const cluster = new rds.ServerlessCluster(this, 'AuroraCluster', {
  engine: rds.DatabaseClusterEngine.AURORA_MYSQL,
  vpc,
  credentials: { username: 'clusteradmin' },
  clusterIdentifier: 'db-endpoint-test',
  defaultDatabaseName: 'demos',
});

// Build a data source for AppSync to access the database.
declare const api: appsync.GraphqlApi;
const rdsDS = api.addRdsDataSource('rds', cluster, secret, 'demos');

// Set up a resolver for an RDS query.
rdsDS.createResolver('QueryGetDemosRdsResolver', {
  typeName: 'Query',
  fieldName: 'getDemosRds',
  requestMappingTemplate: appsync.MappingTemplate.fromString(`
  {
    "version": "2018-05-29",
    "statements": [
      "SELECT * FROM demos"
    ]
  }
  `),
  responseMappingTemplate: appsync.MappingTemplate.fromString(`
    $utils.toJson($utils.rds.toJsonObject($ctx.result)[0])
  `),
});

// Set up a resolver for an RDS mutation.
rdsDS.createResolver('MutationAddDemoRdsResolver', {
  typeName: 'Mutation',
  fieldName: 'addDemoRds',
  requestMappingTemplate: appsync.MappingTemplate.fromString(`
  {
    "version": "2018-05-29",
    "statements": [
      "INSERT INTO demos VALUES (:id, :version)",
      "SELECT * WHERE id = :id"
    ],
    "variableMap": {
      ":id": $util.toJson($util.autoId()),
      ":version": $util.toJson($ctx.args.version)
    }
  }
  `),
  responseMappingTemplate: appsync.MappingTemplate.fromString(`
    $utils.toJson($utils.rds.toJsonObject($ctx.result)[1][0])
  `),
});
```

## Properties

- `cachingConfig`: [CachingConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.CachingConfig.html) = No caching configuration — The caching configuration for this resolver.

- `code`: [Code](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.Code.html) = no code is used — The function code.

- `fieldName`: string (required) — name of the GraphQL field in the given type this resolver is attached to.

- `maxBatchSize`: number = No max batch size — The maximum number of elements per batch, when using batch invoke.

- `metricsConfig`: [ResolverMetricsConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.ResolverMetricsConfig.html) = no metrics configuration — Whether to enable enhanced metrics Value will be ignored, if `enhancedMetricsConfig.resolverLevelMetricsBehavior` on AppSync GraphqlApi construct is set to `FULL_REQUEST_RESOLVER_METRICS`.

- `pipelineConfig`: [IFunctionConfigurationRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_appsync.IFunctionConfigurationRef.html)[] = no pipeline resolver configuration An empty array | undefined sets resolver to be of kind, unit — configuration of the pipeline resolver.

  **Default:** no pipeline resolver configuration An empty array \| undefined sets resolver to be of kind, unit

- `requestMappingTemplate`: [MappingTemplate](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.MappingTemplate.html) = No mapping template — The request mapping template for this resolver.

- `responseMappingTemplate`: [MappingTemplate](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.MappingTemplate.html) = No mapping template — The response mapping template for this resolver.

- `runtime`: [FunctionRuntime](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.FunctionRuntime.html) = no function runtime, VTL mapping templates used — The functions runtime.

  **Default:** no function runtime, VTL mapping templates used

- `typeName`: string (required) — name of the GraphQL type this resolver is attached to.
