aws-cdk-lib.aws_dynamodb.ITable

interface ITable

LanguageType name
.NETAmazon.CDK.AWS.DynamoDB.ITable
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsdynamodb#ITable
Javasoftware.amazon.awscdk.services.dynamodb.ITable
Pythonaws_cdk.aws_dynamodb.ITable
TypeScript (source)aws-cdk-lib » aws_dynamodb » ITable

Implemented by Table

Obtainable from Table.fromTableArn(), Table.fromTableAttributes(), Table.fromTableName()

An interface that represents a DynamoDB Table - either created with the CDK, or an existing one.

Properties

NameTypeDescription
envResourceEnvironmentThe environment this resource belongs to.
nodeNodeThe tree node.
stackStackThe stack in which this resource is defined.
tableArnstringArn of the dynamodb table.
tableNamestringTable name of the dynamodb table.
encryptionKey?IKeyOptional KMS encryption key associated with this table.
tableStreamArn?stringARN of the table's stream, if there is one.

env

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


node

Type: Node

The tree node.


stack

Type: Stack

The stack in which this resource is defined.


tableArn

Type: string

Arn of the dynamodb table.


tableName

Type: string

Table name of the dynamodb table.


encryptionKey?

Type: IKey (optional)

Optional KMS encryption key associated with this table.


tableStreamArn?

Type: string (optional)

ARN of the table's stream, if there is one.

Methods

NameDescription
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
grant(grantee, ...actions)Adds an IAM policy statement associated with this table to an IAM principal's policy.
grantFullAccess(grantee)Permits all DynamoDB operations ("dynamodb:*") to an IAM principal.
grantReadData(grantee)Permits an IAM principal all data read operations from this table: BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan.
grantReadWriteData(grantee)Permits an IAM principal to all data read/write operations to this table.
grantStream(grantee, ...actions)Adds an IAM policy statement associated with this table's stream to an IAM principal's policy.
grantStreamRead(grantee)Permits an IAM principal all stream data read operations for this table's stream: DescribeStream, GetRecords, GetShardIterator, ListStreams.
grantTableListStreams(grantee)Permits an IAM Principal to list streams attached to current dynamodb table.
grantWriteData(grantee)Permits an IAM principal all data write operations to this table: BatchWriteItem, PutItem, UpdateItem, DeleteItem.
metric(metricName, props?)Metric for the number of Errors executing all Lambdas.
metricConditionalCheckFailedRequests(props?)Metric for the conditional check failed requests.
metricConsumedReadCapacityUnits(props?)Metric for the consumed read capacity units.
metricConsumedWriteCapacityUnits(props?)Metric for the consumed write capacity units.
metricSuccessfulRequestLatency(props?)Metric for the successful request latency.
metricSystemErrorsForOperations(props?)Metric for the system errors this table.
metricThrottledRequests(props?)⚠️Metric for throttled requests.
metricThrottledRequestsForOperations(props?)Metric for throttled requests.
metricUserErrors(props?)Metric for the user errors.

applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


grant(grantee, ...actions)

public grant(grantee: IGrantable, ...actions: string[]): Grant

Parameters

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

Returns

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


grantFullAccess(grantee)

public grantFullAccess(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable — The principal to grant access to.

Returns

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


grantReadData(grantee)

public grantReadData(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable — The principal to grant access to.

Returns

  • Grant

Permits an IAM principal all data read operations from this table: BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan.

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


grantReadWriteData(grantee)

public grantReadWriteData(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable — The principal to grant access to.

Returns

  • Grant

Permits an IAM principal to all data read/write operations to this table.

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

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


grantStream(grantee, ...actions)

public grantStream(grantee: IGrantable, ...actions: string[]): Grant

Parameters

  • grantee IGrantable — The principal (no-op if undefined).
  • actions string — The set of actions to allow (i.e. "dynamodb:DescribeStream", "dynamodb:GetRecords", ...).

Returns

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


grantStreamRead(grantee)

public grantStreamRead(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable — The principal to grant access to.

Returns

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


grantTableListStreams(grantee)

public grantTableListStreams(grantee: IGrantable): Grant

Parameters

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

Returns

  • Grant

Permits an IAM Principal to list streams attached to current dynamodb table.


grantWriteData(grantee)

public grantWriteData(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable — The principal to grant access to.

Returns

  • Grant

Permits an IAM principal all data write operations to this table: BatchWriteItem, PutItem, UpdateItem, DeleteItem.

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


metric(metricName, props?)

public metric(metricName: string, props?: MetricOptions): Metric

Parameters

  • metricName string
  • props MetricOptions

Returns

  • Metric

Metric for the number of Errors executing all Lambdas.


metricConditionalCheckFailedRequests(props?)

public metricConditionalCheckFailedRequests(props?: MetricOptions): Metric

Parameters

  • props MetricOptions — properties of a metric.

Returns

  • Metric

Metric for the conditional check failed requests.


metricConsumedReadCapacityUnits(props?)

public metricConsumedReadCapacityUnits(props?: MetricOptions): Metric

Parameters

  • props MetricOptions — properties of a metric.

Returns

  • Metric

Metric for the consumed read capacity units.


metricConsumedWriteCapacityUnits(props?)

public metricConsumedWriteCapacityUnits(props?: MetricOptions): Metric

Parameters

  • props MetricOptions — properties of a metric.

Returns

  • Metric

Metric for the consumed write capacity units.


metricSuccessfulRequestLatency(props?)

public metricSuccessfulRequestLatency(props?: MetricOptions): Metric

Parameters

  • props MetricOptions — properties of a metric.

Returns

  • Metric

Metric for the successful request latency.


metricSystemErrorsForOperations(props?)

public metricSystemErrorsForOperations(props?: SystemErrorsForOperationsMetricOptions): IMetric

Parameters

  • props SystemErrorsForOperationsMetricOptions — properties of a metric.

Returns

  • IMetric

Metric for the system errors this table.


metricThrottledRequests(props?)⚠️

public metricThrottledRequests(props?: MetricOptions): Metric

⚠️ Deprecated: use metricThrottledRequestsForOperations

Parameters

  • props MetricOptions — properties of a metric.

Returns

  • Metric

Metric for throttled requests.


metricThrottledRequestsForOperations(props?)

public metricThrottledRequestsForOperations(props?: OperationsMetricOptions): IMetric

Parameters

  • props OperationsMetricOptions — properties of a metric.

Returns

  • IMetric

Metric for throttled requests.


metricUserErrors(props?)

public metricUserErrors(props?: MetricOptions): Metric

Parameters

  • props MetricOptions — properties of a metric.

Returns

  • Metric

Metric for the user errors.