# AppSyncRdsDataSourceProps

Properties for an AppSync RDS datasource Aurora Serverless V1.

Extends: [AppSyncBackedDataSourceProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.AppSyncBackedDataSourceProps.html)
Used as props by: [AppSyncRdsDataSource](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.AppSyncRdsDataSource.html)

- Source: [`aws-appsync/lib/data-source-common.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-appsync/lib/data-source-common.ts#L411)
- Type last changed: v2.193.0 · 30 Apr 2025

## Example

TypeScript:

```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_iam as iam } from 'aws-cdk-lib';
import { aws_rds as rds } from 'aws-cdk-lib';
import { aws_secretsmanager as secretsmanager } from 'aws-cdk-lib';
import { aws_appsync as interfaces_appsync } from 'aws-cdk-lib/interfaces';

declare const apiRef: interfaces_appsync.IApiRef;
declare const role: iam.Role;
declare const secret: secretsmanager.Secret;
declare const serverlessCluster: rds.ServerlessCluster;
const appSyncRdsDataSourceProps: appsync.AppSyncRdsDataSourceProps = {
  api: apiRef,
  secretStore: secret,
  serverlessCluster: serverlessCluster,

  // the properties below are optional
  databaseName: 'databaseName',
  description: 'description',
  name: 'name',
  serviceRole: role,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_appsync as appsync
from aws_cdk import aws_iam as iam
from aws_cdk import aws_rds as rds
from aws_cdk import aws_secretsmanager as secretsmanager
from aws_cdk.interfaces import aws_appsync as interfaces_appsync

# api_ref: interfaces_appsync.IApiRef
# role: iam.Role
# secret: secretsmanager.Secret
# serverless_cluster: rds.ServerlessCluster

app_sync_rds_data_source_props = appsync.AppSyncRdsDataSourceProps(
    api=api_ref,
    secret_store=secret,
    serverless_cluster=serverless_cluster,

    # the properties below are optional
    database_name="databaseName",
    description="description",
    name="name",
    service_role=role
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.appsync.*;
import software.amazon.awscdk.services.iam.*;
import software.amazon.awscdk.services.rds.*;
import software.amazon.awscdk.services.secretsmanager.*;
import software.amazon.awscdk.interfaces.appsync.*;

IApiRef apiRef;
Role role;
Secret secret;
ServerlessCluster serverlessCluster;

AppSyncRdsDataSourceProps appSyncRdsDataSourceProps = AppSyncRdsDataSourceProps.builder()
        .api(apiRef)
        .secretStore(secret)
        .serverlessCluster(serverlessCluster)

        // the properties below are optional
        .databaseName("databaseName")
        .description("description")
        .name("name")
        .serviceRole(role)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AppSync;
using Amazon.CDK.AWS.IAM;
using Amazon.CDK.AWS.RDS;
using Amazon.CDK.AWS.SecretsManager;
using Amazon.CDK.Interfaces.AppSync;

IApiRef apiRef;
Role role;
Secret secret;
ServerlessCluster serverlessCluster;

var appSyncRdsDataSourceProps = new AppSyncRdsDataSourceProps {
    Api = apiRef,
    SecretStore = secret,
    ServerlessCluster = serverlessCluster,

    // the properties below are optional
    DatabaseName = "databaseName",
    Description = "description",
    Name = "name",
    ServiceRole = role
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var apiRef IApiRef
var role Role
var secret Secret
var serverlessCluster ServerlessCluster

appSyncRdsDataSourceProps := &AppSyncRdsDataSourceProps{
	Api: apiRef,
	SecretStore: secret,
	ServerlessCluster: serverlessCluster,

	// the properties below are optional
	DatabaseName: jsii.String("databaseName"),
	Description: jsii.String("description"),
	Name: jsii.String("name"),
	ServiceRole: role,
}
```

## Properties

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

- `databaseName`: string = None — The name of the database to use within the cluster.

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

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

  **Default:** id of data source

  The only allowed pattern is: {[_A-Za-z][_0-9A-Za-z]*}.
  Any invalid characters will be automatically removed.

- `secretStore`: [ISecret](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.ISecret.html) (required) — The secret containing the credentials for the database.

- `serverlessCluster`: [IServerlessCluster](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.IServerlessCluster.html) (required) — The serverless cluster to call to interact with this data source.

- `serviceRole`: [IRole](https://docs.aws.amazon.com/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
