# TableGrants

A set of permissions to grant on a Table.

Obtainable from: TableGrants.fromTable

- Source: [`aws-dynamodb/lib/table-grants.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-dynamodb/lib/table-grants.ts#L57)
- Type last changed: v2.239.0 · 19 Feb 2026

## Example

TypeScript:

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

declare const encryptedResource: iam.IEncryptedResource;
declare const resourceWithPolicyV2: iam.IResourceWithPolicyV2;
declare const tableRef: interfaces_dynamodb.ITableRef;
const tableGrants = new dynamodb.TableGrants({
  table: tableRef,

  // the properties below are optional
  encryptedResource: encryptedResource,
  hasIndex: false,
  policyResource: resourceWithPolicyV2,
  regions: ['regions'],
});
```

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

# encrypted_resource: iam.IEncryptedResource
# resource_with_policy_v2: iam.IResourceWithPolicyV2
# table_ref: interfaces_dynamodb.ITableRef

table_grants = dynamodb.TableGrants(
    table=table_ref,

    # the properties below are optional
    encrypted_resource=encrypted_resource,
    has_index=False,
    policy_resource=resource_with_policy_v2,
    regions=["regions"]
)
```

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

IEncryptedResource encryptedResource;
IResourceWithPolicyV2 resourceWithPolicyV2;
ITableRef tableRef;

TableGrants tableGrants = TableGrants.Builder.create()
        .table(tableRef)

        // the properties below are optional
        .encryptedResource(encryptedResource)
        .hasIndex(false)
        .policyResource(resourceWithPolicyV2)
        .regions(List.of("regions"))
        .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.DynamoDB;
using Amazon.CDK.AWS.IAM;
using Amazon.CDK.Interfaces.DynamoDB;

IEncryptedResource encryptedResource;
IResourceWithPolicyV2 resourceWithPolicyV2;
ITableRef tableRef;

var tableGrants = new TableGrants(new TableGrantsProps {
    Table = tableRef,

    // the properties below are optional
    EncryptedResource = encryptedResource,
    HasIndex = false,
    PolicyResource = resourceWithPolicyV2,
    Regions = new [] { "regions" }
});
```

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"

var encryptedResource IEncryptedResource
var resourceWithPolicyV2 IResourceWithPolicyV2
var tableRef ITableRef

tableGrants := awscdk.Aws_dynamodb.NewTableGrants(&TableGrantsProps{
	Table: tableRef,

	// the properties below are optional
	EncryptedResource: encryptedResource,
	HasIndex: jsii.Boolean(false),
	PolicyResource: resourceWithPolicyV2,
	Regions: []*string{
		jsii.String("regions"),
	},
})
```

## Initializer

TypeScript:

```ts
new TableGrants(props: TableGrantsProps)
```

Python:

```python
TableGrants(props: TableGrantsProps)
```

Java:

```java
new TableGrants(TableGrantsProps props)
```

C# / .NET:

```csharp
new TableGrants(TableGrantsProps props)
```

Golang:

```go
NewTableGrants(Props TableGrantsProps)
```

## Methods

- `actions(grantee: IGrantable, ...actions: string[]): Grant` — Adds an IAM policy statement associated with this table to an IAM principal's policy.

  If `encryptionKey` is present, appropriate grants to the key needs to be added
  separately using the `table.encryptionKey.grant*` methods.

  **Parameters**

  - `grantee` — The principal (no-op if undefined).
  - `actions` — The set of actions to allow (i.e. "dynamodb:PutItem", "dynamodb:GetItem", ...).

- `fromTable(table: ITableRef, regions?: string[], hasIndex?: boolean): TableGrants // chainable` (static) — Creates a TableGrants object for a given table.

- `fullAccess(grantee: IGrantable): Grant` — Permits all DynamoDB operations ("dynamodb:*") to an IAM principal.

  Appropriate grants will also be added to the customer-managed KMS key
  if one was configured.

  **Parameters**

  - `grantee` — The principal to grant access to.

- `multiAccountReplicationFrom(sourceReplicaArn: string): void` — Grants permissions for this table to act as a destination for multi-account global table replication.

  **Parameters**

  - `sourceReplicaArn` — The ARN of the source replica table in the other account.

- `multiAccountReplicationTo(destinationReplicaArn: string): void` — Grants permissions for this table to act as a source for multi-account global table replication.

  **Parameters**

  - `destinationReplicaArn` — The ARN of the destination replica table in the other account.

- `readData(grantee: IGrantable): Grant` — Permits an IAM principal all data read operations from this table: BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan, DescribeTable.

  Appropriate grants will also be added to the customer-managed KMS key
  if one was configured.

  **Parameters**

  - `grantee` — The principal to grant access to.

- `readWriteData(grantee: IGrantable): Grant` — Permits an IAM principal to all data read/write operations to this table.

  BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan,
  BatchWriteItem, PutItem, UpdateItem, DeleteItem, DescribeTable

  Appropriate grants will also be added to the customer-managed KMS key
  if one was configured.

  **Parameters**

  - `grantee` — The principal to grant access to.

- `writeData(grantee: IGrantable): Grant` — Permits an IAM principal all data write operations to this table: BatchWriteItem, PutItem, UpdateItem, DeleteItem, DescribeTable.

  Appropriate grants will also be added to the customer-managed KMS key
  if one was configured.

  **Parameters**

  - `grantee` — The principal to grant access to.
