class TableBaseV2
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.DynamoDB.TableBaseV2 |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsdynamodb#TableBaseV2 |
Java | software.amazon.awscdk.services.dynamodb.TableBaseV2 |
Python | aws_cdk.aws_dynamodb.TableBaseV2 |
TypeScript (source) | aws-cdk-lib » aws_dynamodb » TableBaseV2 |
Implements
IConstruct
, IDependable
, IResource
, ITable
, ITable
Extends
Resource
Implemented by
Table
Base class for a DynamoDB table.
Initializer
new TableBaseV2(scope: Construct, id: string, props?: ResourceProps)
Parameters
- scope
Construct
- id
string
- props
Resource
Props
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
has | boolean | |
node | Node | The tree node. |
region | string | |
stack | Stack | The stack in which this resource is defined. |
table | string | The ARN of the table. |
table | string | The name of the table. |
encryption | IKey | The KMS encryption key for the table. |
table | string | The ID of the table. |
table | string | The stream ARN of the table. |
env
Type:
Resource
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.
hasIndex
Type:
boolean
node
Type:
Node
The tree node.
region
Type:
string
stack
Type:
Stack
The stack in which this resource is defined.
tableArn
Type:
string
The ARN of the table.
tableName
Type:
string
The name of the table.
encryptionKey?
Type:
IKey
(optional)
The KMS encryption key for the table.
tableId?
Type:
string
(optional)
The ID of the table.
tableStreamArn?
Type:
string
(optional)
The stream ARN of the table.
Methods
Name | Description |
---|---|
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 an IAM principal to all DynamoDB operations ('dynamodb:*') on this table. |
grant | Permits an IAM principal all data read operations on this table. |
grant | Permits an IAM principal to all data read/write operations on this table. |
grant | Adds an IAM policy statement associated with this table to an IAM principal's policy. |
grant | Adds an IAM policy statement associated with this table to an IAM principal's policy. |
grant | Permits an IAM principal to list streams attached to this table. |
grant | Permits an IAM principal all data write operations on this table. |
metric(metricName, props?) | Return the given named metric for this table. |
metric | Metric for the conditional check failed requests for this table. |
metric | Metric for the consumed read capacity units for this table. |
metric | Metric for the consumed write capacity units for this table. |
metric | Metric for the successful request latency for this table. |
metric | Metric for the system errors this table. |
metric | Metric for the system errors for this table. This will sum errors across all possible operations. |
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. This will sum errors across all possible operations. |
metric | Metric for the user errors for this table. |
to | Returns a string representation of this construct. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
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', etc.).
Returns
Adds an IAM policy statement associated with this table to an IAM principal's policy.
Note: If encryptionKey
is present, appropriate grants to the key needs to be added
separately using the table.encryptionKey.grant*
methods.
FullAccess(grantee)
grantpublic grantFullAccess(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
— the principal to grant access to.
Returns
Permits an IAM principal to all DynamoDB operations ('dynamodb:*') on this table.
Note: Appropriate grants will also be added to the customer-managed KMS keys associated with this table if one was configured.
ReadData(grantee)
grantpublic grantReadData(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
— the principal to grant access to.
Returns
Permits an IAM principal all data read operations on this table.
Actions: BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan, DescribeTable.
Note: Appropriate grants will also be added to the customer-managed KMS keys associated with this table if one was configured.
ReadWriteData(grantee)
grantpublic grantReadWriteData(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
— the principal to grant access to.
Returns
Permits an IAM principal to all data read/write operations on this table.
Actions: BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan, BatchWriteItem, PutItem, UpdateItem, DeleteItem, DescribeTable.
Note: Appropriate grants will also be added to the customer-managed KMS keys associated with this table if one was configured.
Stream(grantee, ...actions)
grantpublic 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', etc.).
Returns
Adds an IAM policy statement associated with this table to an IAM principal's policy.
Note: If encryptionKey
is present, appropriate grants to the key needs to be added
separately using the table.encryptionKey.grant*
methods.
StreamRead(grantee)
grantpublic grantStreamRead(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
— the principal to grant access to.
Returns
Adds an IAM policy statement associated with this table to an IAM principal's policy.
Actions: DescribeStream, GetRecords, GetShardIterator, ListStreams.
Note: Appropriate grants will also be added to the customer-managed KMS keys associated with this table if one was configured.
TableListStreams(grantee)
grantpublic grantTableListStreams(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
— the principal to grant access to.
Returns
Permits an IAM principal to list streams attached to this table.
WriteData(grantee)
grantpublic grantWriteData(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
— the principal to grant access to.
Returns
Permits an IAM principal all data write operations on this table.
Actions: BatchWriteItem, PutItem, UpdateItem, DeleteItem, DescribeTable.
Note: Appropriate grants will also be added to the customer-managed KMS keys associated with this table if one was configured.
metric(metricName, props?)
public metric(metricName: string, props?: MetricOptions): Metric
Parameters
- metricName
string
- props
Metric
Options
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.
ConditionalCheckFailedRequests(props?)
metricpublic metricConditionalCheckFailedRequests(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the conditional check failed requests 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.
ConsumedReadCapacityUnits(props?)
metricpublic metricConsumedReadCapacityUnits(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the consumed read capacity units 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.
ConsumedWriteCapacityUnits(props?)
metricpublic metricConsumedWriteCapacityUnits(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the consumed write capacity units 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.
SuccessfulRequestLatency(props?)
metricpublic metricSuccessfulRequestLatency(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the successful request latency for 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.
SystemErrors(props?)
metricpublic metricSystemErrors(props?: MetricOptions): Metric
⚠️ Deprecated: use metricSystemErrorsForOperations
.
Parameters
- props
Metric
Options
Returns
Metric for the system errors this table.
SystemErrorsForOperations(props?)
metricpublic metricSystemErrorsForOperations(props?: SystemErrorsForOperationsMetricOptions): IMetric
Parameters
Returns
Metric for the system errors for this table. This will sum errors across all possible operations.
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.
ThrottledRequests(props?)
metricpublic metricThrottledRequests(props?: MetricOptions): Metric
⚠️ Deprecated: Do not use this function. It returns an invalid metric. Use metricThrottledRequestsForOperation
instead.
Parameters
- props
Metric
Options
Returns
How many requests are throttled on this table.
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.
ThrottledRequestsForOperation(operation, props?)
metricpublic metricThrottledRequestsForOperation(operation: string, props?: OperationsMetricOptions): IMetric
Parameters
- operation
string
- props
Operations
Metric Options
Returns
How many requests are throttled on this table for the given operation.
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.
ThrottledRequestsForOperations(props?)
metricpublic metricThrottledRequestsForOperations(props?: OperationsMetricOptions): IMetric
Parameters
- props
Operations
Metric Options
Returns
How many requests are throttled on this table. This will sum errors across all possible operations.
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.
UserErrors(props?)
metricpublic metricUserErrors(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the user errors for this table.
Note: 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.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.