class TableBase
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.DynamoDB.TableBase |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsdynamodb#TableBase |
Java | software.amazon.awscdk.services.dynamodb.TableBase |
Python | aws_cdk.aws_dynamodb.TableBase |
TypeScript (source) | aws-cdk-lib » aws_dynamodb » TableBase |
Implements
IConstruct, IDependable, IResource, IEnvironment, ITable, ITable, IResource, IResource, IEncrypted
Extends
Resource
Implemented by
Table
Initializer
new TableBase(scope: Construct, id: string, props?: ResourceProps)
Parameters
- scope
Construct - id
string - props
ResourceProps
Properties
| Name | Type | Description |
|---|---|---|
| env | Resource | The environment this resource belongs to. |
| grants | Table | Grant a predefined set of permissions on this Table. |
| has | boolean | |
| node | Node | The tree node. |
| regional | string[] | |
| stack | Stack | The stack in which this resource is defined. |
| stream | Stream | Grant a predefined set of permissions on this Table's Stream, if present. |
| table | string | Arn of the dynamodb table. |
| table | string | Table name of the dynamodb table. |
| table | Table | A reference to a Table resource. |
| encryption | IKey | KMS encryption key, if this table uses a customer-managed encryption key. |
| regions? | string[] | Additional regions other than the main one that this table is replicated to. |
| resource | Policy | Resource policy to assign to table. |
| table | string | ARN of the table's stream, if there is one. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
grants
Type:
Table
Grant a predefined set of permissions on this Table.
hasIndex
Type:
boolean
node
Type:
Node
The tree node.
regionalArns
⚠️ Deprecated: This member is still filled but it is not read
Type:
string[]
stack
Type:
Stack
The stack in which this resource is defined.
streamGrants
Type:
Stream
Grant a predefined set of permissions on this Table's Stream, if present.
Will throw if the Table has not been configured for streaming.
tableArn
Type:
string
Arn of the dynamodb table.
tableName
Type:
string
Table name of the dynamodb table.
tableRef
Type:
Table
A reference to a Table resource.
encryptionKey?
Type:
IKey
(optional)
KMS encryption key, if this table uses a customer-managed encryption key.
regions?
Type:
string[]
(optional)
Additional regions other than the main one that this table is replicated to.
resourcePolicy?
Type:
Policy
(optional)
Resource policy to assign to table.
tableStreamArn?
Type:
string
(optional)
ARN of the table's stream, if there is one.
Methods
| Name | Description |
|---|---|
| add | Adds a statement to the resource policy associated with this table. |
| apply | 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. |
| grant | Permits all DynamoDB operations ("dynamodb:*") to an IAM principal. |
| grant | Gives permissions to a grantable entity to perform actions on the encryption key. |
| grant | Permits an IAM principal all data read operations from this table: BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan, DescribeTable. |
| grant | Permits an IAM principal to all data read/write operations to this table. |
| grant | Adds an IAM policy statement associated with this table's stream to an IAM principal's policy. |
| grant | Permits an IAM principal all stream data read operations for this table's stream: DescribeStream, GetRecords, GetShardIterator, ListStreams. |
| grant | Permits an IAM Principal to list streams attached to current dynamodb table. |
| grant | Permits an IAM principal all data write operations to this table: BatchWriteItem, PutItem, UpdateItem, DeleteItem, DescribeTable. |
| metric(metricName, props?) | Return the given named metric for this Table. |
| metric | Metric for the conditional check failed requests this table. |
| metric | Metric for the consumed read capacity units this table. |
| metric | Metric for the consumed write capacity units this table. |
| metric | Metric for the successful request latency this table. |
| metric | Metric for the system errors this table. |
| metric | Metric for the system errors this table. |
| metric | How many requests are throttled on this table. |
| metric | How many requests are throttled on this table, for the given operation. |
| metric | How many requests are throttled on this table. |
| metric | Metric for the user errors. |
| to | Returns a string representation of this construct. |
addToResourcePolicy(statement)
public addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult
Parameters
- statement
PolicyStatement
Returns
Adds a statement to the resource policy associated with this table.
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
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
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.
grantOnKey(grantee, ...actions)
public grantOnKey(grantee: IGrantable, ...actions: string[]): GrantOnKeyResult
Parameters
- grantee
IGrantable - actions
string
Returns
Gives permissions to a grantable entity to perform actions on the encryption key.
grantReadData(grantee)
public grantReadData(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable— The principal to grant access to.
Returns
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.
grantReadWriteData(grantee)
public grantReadWriteData(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable— The principal to grant access to.
Returns
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.
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
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
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
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
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.
metric(metricName, props?)
public metric(metricName: string, props?: MetricOptions): Metric
Parameters
- metricName
string - props
MetricOptions
Returns
Return the given named metric for this Table.
By default, the metric will be calculated as a sum over a period of 5 minutes.
You can customize this by using the statistic and period properties.
metricConditionalCheckFailedRequests(props?)
public metricConditionalCheckFailedRequests(props?: MetricOptions): Metric
Parameters
- props
MetricOptions
Returns
Metric for the conditional check failed requests this table.
By default, the metric will be calculated as a sum over a period of 5 minutes.
You can customize this by using the statistic and period properties.
metricConsumedReadCapacityUnits(props?)
public metricConsumedReadCapacityUnits(props?: MetricOptions): Metric
Parameters
- props
MetricOptions
Returns
Metric for the consumed read capacity units this table.
By default, the metric will be calculated as a sum over a period of 5 minutes.
You can customize this by using the statistic and period properties.
metricConsumedWriteCapacityUnits(props?)
public metricConsumedWriteCapacityUnits(props?: MetricOptions): Metric
Parameters
- props
MetricOptions
Returns
Metric for the consumed write capacity units this table.
By default, the metric will be calculated as a sum over a period of 5 minutes.
You can customize this by using the statistic and period properties.
metricSuccessfulRequestLatency(props?)
public metricSuccessfulRequestLatency(props?: MetricOptions): Metric
Parameters
- props
MetricOptions
Returns
Metric for the successful request latency this table.
By default, the metric will be calculated as an average over a period of 5 minutes.
You can customize this by using the statistic and period properties.
metricSystemErrors(props?)
public metricSystemErrors(props?: MetricOptions): Metric
⚠️ Deprecated: use metricSystemErrorsForOperations.
Parameters
- props
MetricOptions
Returns
Metric for the system errors this table.
metricSystemErrorsForOperations(props?)
public metricSystemErrorsForOperations(props?: SystemErrorsForOperationsMetricOptions): IMetric
Parameters
Returns
Metric for the system errors this table.
This will sum errors across all possible operations.
Note that by default, each individual metric will be calculated as a sum over a period of 5 minutes.
You can customize this by using the statistic and period properties.
metricThrottledRequests(props?)
public metricThrottledRequests(props?: MetricOptions): Metric
⚠️ Deprecated: Do not use this function. It returns an invalid metric. Use metricThrottledRequestsForOperation instead.
Parameters
- props
MetricOptions
Returns
How many requests are throttled on this table.
Default: sum over 5 minutes
metricThrottledRequestsForOperation(operation, props?)
public metricThrottledRequestsForOperation(operation: string, props?: MetricOptions): Metric
Parameters
- operation
string - props
MetricOptions
Returns
How many requests are throttled on this table, for the given operation.
Default: sum over 5 minutes
metricThrottledRequestsForOperations(props?)
public metricThrottledRequestsForOperations(props?: OperationsMetricOptions): IMetric
Parameters
- props
OperationsMetric Options
Returns
How many requests are throttled on this table.
This will sum errors across all possible operations.
Note that by default, each individual metric will be calculated as a sum over a period of 5 minutes.
You can customize this by using the statistic and period properties.
metricUserErrors(props?)
public metricUserErrors(props?: MetricOptions): Metric
Parameters
- props
MetricOptions
Returns
Metric for the user errors.
Note that this metric reports user errors across all the tables in the account and region the table resides in.
By default, the metric will be calculated as a sum over a period of 5 minutes.
You can customize this by using the statistic and period properties.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.

.NET
Go
Java
Python
TypeScript (