# AppSyncDynamoDbDataSourceProps

Properties for an AppSync DynamoDB datasource.

Extends: [AppSyncBackedDataSourceProps](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.AppSyncBackedDataSourceProps.html)
Used as props by: [AppSyncDynamoDbDataSource](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.AppSyncDynamoDbDataSource.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#L236)
- 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_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 apiRef: interfaces_appsync.IApiRef;
declare const role: iam.Role;
declare const table: dynamodb.Table;
const appSyncDynamoDbDataSourceProps: appsync.AppSyncDynamoDbDataSourceProps = {
  api: apiRef,
  table: table,

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

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_dynamodb as dynamodb
from aws_cdk import aws_iam as iam
from aws_cdk.interfaces import aws_appsync as interfaces_appsync

# api_ref: interfaces_appsync.IApiRef
# role: iam.Role
# table: dynamodb.Table

app_sync_dynamo_db_data_source_props = appsync.AppSyncDynamoDbDataSourceProps(
    api=api_ref,
    table=table,

    # the properties below are optional
    description="description",
    name="name",
    read_only_access=False,
    service_role=role,
    use_caller_credentials=False
)
```

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.dynamodb.*;
import software.amazon.awscdk.services.iam.*;
import software.amazon.awscdk.interfaces.appsync.*;

IApiRef apiRef;
Role role;
Table table;

AppSyncDynamoDbDataSourceProps appSyncDynamoDbDataSourceProps = AppSyncDynamoDbDataSourceProps.builder()
        .api(apiRef)
        .table(table)

        // the properties below are optional
        .description("description")
        .name("name")
        .readOnlyAccess(false)
        .serviceRole(role)
        .useCallerCredentials(false)
        .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.DynamoDB;
using Amazon.CDK.AWS.IAM;
using Amazon.CDK.Interfaces.AppSync;

IApiRef apiRef;
Role role;
Table table;

var appSyncDynamoDbDataSourceProps = new AppSyncDynamoDbDataSourceProps {
    Api = apiRef,
    Table = table,

    // the properties below are optional
    Description = "description",
    Name = "name",
    ReadOnlyAccess = false,
    ServiceRole = role,
    UseCallerCredentials = false
};
```

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"

var apiRef IApiRef
var role Role
var table Table

appSyncDynamoDbDataSourceProps := &AppSyncDynamoDbDataSourceProps{
	Api: apiRef,
	Table: table,

	// the properties below are optional
	Description: jsii.String("description"),
	Name: jsii.String("name"),
	ReadOnlyAccess: jsii.Boolean(false),
	ServiceRole: role,
	UseCallerCredentials: jsii.Boolean(false),
}
```

## Properties

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

- `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.

- `readOnlyAccess`: boolean = false — Specify whether this Data Source 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.
