# StreamGrants

A set of permissions to grant on a Table Stream.

- Source: [`aws-dynamodb/lib/stream-grants.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-dynamodb/lib/stream-grants.ts#L36)
- Type last changed: v2.227.0 · 21 Nov 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_dynamodb as dynamodb } from 'aws-cdk-lib';
import { aws_kms as kms } from 'aws-cdk-lib';
import { aws_dynamodb as interfaces_dynamodb } from 'aws-cdk-lib/interfaces';

declare const key: kms.Key;
declare const tableRef: interfaces_dynamodb.ITableRef;
const streamGrants = new dynamodb.StreamGrants({
  tableStreamArn: 'tableStreamArn',

  // the properties below are optional
  encryptionKey: key,
  table: tableRef,
});
```

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_kms as kms
from aws_cdk.interfaces import aws_dynamodb as interfaces_dynamodb

# key: kms.Key
# table_ref: interfaces_dynamodb.ITableRef

stream_grants = dynamodb.StreamGrants(
    table_stream_arn="tableStreamArn",

    # the properties below are optional
    encryption_key=key,
    table=table_ref
)
```

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

Key key;
ITableRef tableRef;

StreamGrants streamGrants = StreamGrants.Builder.create()
        .tableStreamArn("tableStreamArn")

        // the properties below are optional
        .encryptionKey(key)
        .table(tableRef)
        .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.KMS;
using Amazon.CDK.Interfaces.DynamoDB;

Key key;
ITableRef tableRef;

var streamGrants = new StreamGrants(new StreamGrantsProps {
    TableStreamArn = "tableStreamArn",

    // the properties below are optional
    EncryptionKey = key,
    Table = tableRef
});
```

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 key Key
var tableRef ITableRef

streamGrants := awscdk.Aws_dynamodb.NewStreamGrants(&StreamGrantsProps{
	TableStreamArn: jsii.String("tableStreamArn"),

	// the properties below are optional
	EncryptionKey: key,
	Table: tableRef,
})
```

## Initializer

TypeScript:

```ts
new StreamGrants(props: StreamGrantsProps)
```

Python:

```python
StreamGrants(props: StreamGrantsProps)
```

Java:

```java
new StreamGrants(StreamGrantsProps props)
```

C# / .NET:

```csharp
new StreamGrants(StreamGrantsProps props)
```

Golang:

```go
NewStreamGrants(Props StreamGrantsProps)
```

## Methods

- `actions(grantee: IGrantable, ...actions: string[]): Grant` — Adds an IAM policy statement associated with this table's stream 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:DescribeStream", "dynamodb:GetRecords", ...).

- `list(grantee: IGrantable): Grant` — Permits an IAM Principal to list streams attached to current dynamodb table.

  **Parameters**

  - `grantee` — The principal (no-op if undefined).

- `read(grantee: IGrantable): Grant` — Permits an IAM principal all stream data read operations for this table's stream: DescribeStream, GetRecords, GetShardIterator, ListStreams.

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

  **Parameters**

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