TableV2
- class aws_cdk.aws_dynamodb.TableV2(scope, id, *, partition_key, billing=None, dynamo_stream=None, encryption=None, global_secondary_indexes=None, local_secondary_indexes=None, removal_policy=None, replicas=None, sort_key=None, table_name=None, time_to_live_attribute=None, warm_throughput=None, contributor_insights=None, deletion_protection=None, kinesis_stream=None, point_in_time_recovery=None, point_in_time_recovery_specification=None, resource_policy=None, table_class=None, tags=None)
Bases:
TableBaseV2
A DynamoDB Table.
- ExampleMetadata:
infused
Example:
import aws_cdk as cdk app = cdk.App() stack = cdk.Stack(app, "Stack", env=cdk.Environment(region="us-west-2")) global_table = dynamodb.TableV2(stack, "GlobalTable", partition_key=dynamodb.Attribute(name="pk", type=dynamodb.AttributeType.STRING), # applies to all replicas, i.e., us-west-2, us-east-1, us-east-2 removal_policy=cdk.RemovalPolicy.DESTROY, replicas=[dynamodb.ReplicaTableProps(region="us-east-1"), dynamodb.ReplicaTableProps(region="us-east-2") ] )
- Parameters:
scope (
Construct
) –id (
str
) –partition_key (
Union
[Attribute
,Dict
[str
,Any
]]) – Partition key attribute definition.billing (
Optional
[Billing
]) – The billing mode and capacity settings to apply to the table. Default: Billing.onDemand()dynamo_stream (
Optional
[StreamViewType
]) – When an item in the table is modified, StreamViewType determines what information is written to the stream. Default: - streams are disabled if replicas are not configured and this property is not specified. If this property is not specified when replicas are configured, then NEW_AND_OLD_IMAGES will be the StreamViewType for all replicasencryption (
Optional
[TableEncryptionV2
]) – The server-side encryption. Default: TableEncryptionV2.dynamoOwnedKey()global_secondary_indexes (
Optional
[Sequence
[Union
[GlobalSecondaryIndexPropsV2
,Dict
[str
,Any
]]]]) – Global secondary indexes. Note: You can provide a maximum of 20 global secondary indexes. Default: - no global secondary indexeslocal_secondary_indexes (
Optional
[Sequence
[Union
[LocalSecondaryIndexProps
,Dict
[str
,Any
]]]]) – Local secondary indexes. Note: You can only provide a maximum of 5 local secondary indexes. Default: - no local secondary indexesremoval_policy (
Optional
[RemovalPolicy
]) – The removal policy applied to the table. Default: RemovalPolicy.RETAINreplicas (
Optional
[Sequence
[Union
[ReplicaTableProps
,Dict
[str
,Any
]]]]) – Replica tables to deploy with the primary table. Note: Adding replica tables allows you to use your table as a global table. You cannot specify a replica table in the region that the primary table will be deployed to. Replica tables will only be supported if the stack deployment region is defined. Default: - no replica tablessort_key (
Union
[Attribute
,Dict
[str
,Any
],None
]) – Sort key attribute definition. Default: - no sort keytable_name (
Optional
[str
]) – The name of the table. Default: - generated by CloudFormationtime_to_live_attribute (
Optional
[str
]) – The name of the TTL attribute. Default: - TTL is disabledwarm_throughput (
Union
[WarmThroughput
,Dict
[str
,Any
],None
]) – The warm throughput configuration for the table. Default: - no warm throughput is configuredcontributor_insights (
Optional
[bool
]) – Whether CloudWatch contributor insights is enabled. Default: falsedeletion_protection (
Optional
[bool
]) – Whether deletion protection is enabled. Default: falsekinesis_stream (
Optional
[IStream
]) – Kinesis Data Stream to capture item level changes. Default: - no Kinesis Data Streampoint_in_time_recovery (
Optional
[bool
]) – (deprecated) Whether point-in-time recovery is enabled. Default: false - point in time recovery is not enabled.point_in_time_recovery_specification (
Union
[PointInTimeRecoverySpecification
,Dict
[str
,Any
],None
]) – Whether point-in-time recovery is enabled and recoveryPeriodInDays is set. Default: - point in time recovery is not enabled.resource_policy (
Optional
[PolicyDocument
]) – Resource policy to assign to DynamoDB Table. Default: - No resource policy statements are added to the created table.table_class (
Optional
[TableClass
]) – The table class. Default: TableClass.STANDARDtags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – Tags to be applied to the primary table (default replica table). Default: - no tags
Methods
- add_global_secondary_index(*, partition_key, max_read_request_units=None, max_write_request_units=None, read_capacity=None, sort_key=None, warm_throughput=None, write_capacity=None, index_name, non_key_attributes=None, projection_type=None)
Add a global secondary index to the table.
Note: Global secondary indexes will be inherited by all replica tables.
- Parameters:
partition_key (
Union
[Attribute
,Dict
[str
,Any
]]) – Partition key attribute definition.max_read_request_units (
Union
[int
,float
,None
]) – The maximum read request units. Note: This can only be configured if the primary table billing is PAY_PER_REQUEST. Default: - inherited from the primary table.max_write_request_units (
Union
[int
,float
,None
]) – The maximum write request units. Note: This can only be configured if the primary table billing is PAY_PER_REQUEST. Default: - inherited from the primary table.read_capacity (
Optional
[Capacity
]) – The read capacity. Note: This can only be configured if the primary table billing is provisioned. Default: - inherited from the primary table.sort_key (
Union
[Attribute
,Dict
[str
,Any
],None
]) – Sort key attribute definition. Default: - no sort keywarm_throughput (
Union
[WarmThroughput
,Dict
[str
,Any
],None
]) – The warm throughput configuration for the global secondary index. Default: - no warm throughput is configuredwrite_capacity (
Optional
[Capacity
]) – The write capacity. Note: This can only be configured if the primary table billing is provisioned. Default: - inherited from the primary table.index_name (
str
) – The name of the secondary index.non_key_attributes (
Optional
[Sequence
[str
]]) – The non-key attributes that are projected into the secondary index. Default: - No additional attributesprojection_type (
Optional
[ProjectionType
]) – The set of attributes that are projected into the secondary index. Default: ALL
- Return type:
None
- add_local_secondary_index(*, sort_key, index_name, non_key_attributes=None, projection_type=None)
Add a local secondary index to the table.
Note: Local secondary indexes will be inherited by all replica tables.
- Parameters:
sort_key (
Union
[Attribute
,Dict
[str
,Any
]]) – The attribute of a sort key for the local secondary index.index_name (
str
) – The name of the secondary index.non_key_attributes (
Optional
[Sequence
[str
]]) – The non-key attributes that are projected into the secondary index. Default: - No additional attributesprojection_type (
Optional
[ProjectionType
]) – The set of attributes that are projected into the secondary index. Default: ALL
- Return type:
None
- add_replica(*, region, global_secondary_index_options=None, max_read_request_units=None, read_capacity=None, contributor_insights=None, deletion_protection=None, kinesis_stream=None, point_in_time_recovery=None, point_in_time_recovery_specification=None, resource_policy=None, table_class=None, tags=None)
Add a replica table.
Note: Adding a replica table will allow you to use your table as a global table.
- Parameters:
region (
str
) – The region that the replica table will be created in.global_secondary_index_options (
Optional
[Mapping
[str
,Union
[ReplicaGlobalSecondaryIndexOptions
,Dict
[str
,Any
]]]]) – Options used to configure global secondary index properties. Default: - inherited from the primary tablemax_read_request_units (
Union
[int
,float
,None
]) – The maximum read request units. Note: This can only be configured if the primary table billing is PAY_PER_REQUEST. Default: - inherited from the primary tableread_capacity (
Optional
[Capacity
]) – The read capacity. Note: This can only be configured if the primary table billing is provisioned. Default: - inherited from the primary tablecontributor_insights (
Optional
[bool
]) – Whether CloudWatch contributor insights is enabled. Default: falsedeletion_protection (
Optional
[bool
]) – Whether deletion protection is enabled. Default: falsekinesis_stream (
Optional
[IStream
]) – Kinesis Data Stream to capture item level changes. Default: - no Kinesis Data Streampoint_in_time_recovery (
Optional
[bool
]) – (deprecated) Whether point-in-time recovery is enabled. Default: false - point in time recovery is not enabled.point_in_time_recovery_specification (
Union
[PointInTimeRecoverySpecification
,Dict
[str
,Any
],None
]) – Whether point-in-time recovery is enabled and recoveryPeriodInDays is set. Default: - point in time recovery is not enabled.resource_policy (
Optional
[PolicyDocument
]) – Resource policy to assign to DynamoDB Table. Default: - No resource policy statements are added to the created table.table_class (
Optional
[TableClass
]) – The table class. Default: TableClass.STANDARDtags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – Tags to be applied to the primary table (default replica table). Default: - no tags
- Return type:
None
- add_to_resource_policy(statement)
Adds a statement to the resource policy associated with this file system.
A resource policy will be automatically created upon the first call to
addToResourcePolicy
.Note that this does not work with imported file systems.
- Parameters:
statement (
PolicyStatement
) – The policy statement to add.- Return type:
- apply_removal_policy(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
).- Parameters:
policy (
RemovalPolicy
) –- Return type:
None
- grant(grantee, *actions)
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 thetable.encryptionKey.grant*
methods.- Parameters:
grantee (
IGrantable
) – the principal (no-op if undefined).actions (
str
) – the set of actions to allow (i.e., ‘dynamodb:PutItem’, ‘dynamodb:GetItem’, etc.).
- Return type:
- grant_full_access(grantee)
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.
- Parameters:
grantee (
IGrantable
) – the principal to grant access to.- Return type:
- grant_read_data(grantee)
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.
- Parameters:
grantee (
IGrantable
) – the principal to grant access to.- Return type:
- grant_read_write_data(grantee)
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.
- Parameters:
grantee (
IGrantable
) – the principal to grant access to.- Return type:
- grant_stream(grantee, *actions)
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 thetable.encryptionKey.grant*
methods.- Parameters:
grantee (
IGrantable
) – the principal (no-op if undefined).actions (
str
) – the set of actions to allow (i.e., ‘dynamodb:DescribeStream’, ‘dynamodb:GetRecords’, etc.).
- Return type:
- grant_stream_read(grantee)
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.
- Parameters:
grantee (
IGrantable
) – the principal to grant access to.- Return type:
- grant_table_list_streams(grantee)
Permits an IAM principal to list streams attached to this table.
- Parameters:
grantee (
IGrantable
) – the principal to grant access to.- Return type:
- grant_write_data(grantee)
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.
- Parameters:
grantee (
IGrantable
) – the principal to grant access to.- Return type:
- metric(metric_name, *, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, stack_account=None, stack_region=None, statistic=None, unit=None)
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
andperiod
properties.- Parameters:
metric_name (
str
) –account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) – Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No labelperiod (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.stack_account (
Optional
[str
]) – Account of the stack this metric is attached to. Default: - Deployment account.stack_region (
Optional
[str
]) – Region of the stack this metric is attached to. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- metric_conditional_check_failed_requests(*, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, stack_account=None, stack_region=None, statistic=None, unit=None)
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
andperiod
properties.- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.stack_account (
Optional
[str
]) – Account of the stack this metric is attached to. Default: - Deployment account.stack_region (
Optional
[str
]) – Region of the stack this metric is attached to. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- metric_consumed_read_capacity_units(*, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, stack_account=None, stack_region=None, statistic=None, unit=None)
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
andperiod
properties.- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.stack_account (
Optional
[str
]) – Account of the stack this metric is attached to. Default: - Deployment account.stack_region (
Optional
[str
]) – Region of the stack this metric is attached to. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- metric_consumed_write_capacity_units(*, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, stack_account=None, stack_region=None, statistic=None, unit=None)
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
andperiod
properties.- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.stack_account (
Optional
[str
]) – Account of the stack this metric is attached to. Default: - Deployment account.stack_region (
Optional
[str
]) – Region of the stack this metric is attached to. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- metric_successful_request_latency(*, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, stack_account=None, stack_region=None, statistic=None, unit=None)
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
andperiod
properties.- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.stack_account (
Optional
[str
]) – Account of the stack this metric is attached to. Default: - Deployment account.stack_region (
Optional
[str
]) – Region of the stack this metric is attached to. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- metric_system_errors(*, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, stack_account=None, stack_region=None, statistic=None, unit=None)
(deprecated) Metric for the system errors this table.
- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.stack_account (
Optional
[str
]) – Account of the stack this metric is attached to. Default: - Deployment account.stack_region (
Optional
[str
]) – Region of the stack this metric is attached to. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Deprecated:
use
metricSystemErrorsForOperations
.- Stability:
deprecated
- Return type:
- metric_system_errors_for_operations(*, operations=None, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, stack_account=None, stack_region=None, statistic=None, unit=None)
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
andperiod
properties.- Parameters:
operations (
Optional
[Sequence
[Operation
]]) – The operations to apply the metric to. Default: - All operations available by DynamoDB tables will be considered.account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.stack_account (
Optional
[str
]) – Account of the stack this metric is attached to. Default: - Deployment account.stack_region (
Optional
[str
]) – Region of the stack this metric is attached to. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- metric_throttled_requests(*, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, stack_account=None, stack_region=None, statistic=None, unit=None)
(deprecated) 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
andperiod
properties.- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.stack_account (
Optional
[str
]) – Account of the stack this metric is attached to. Default: - Deployment account.stack_region (
Optional
[str
]) – Region of the stack this metric is attached to. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Deprecated:
Do not use this function. It returns an invalid metric. Use
metricThrottledRequestsForOperation
instead.- Stability:
deprecated
- Return type:
- metric_throttled_requests_for_operation(operation, *, operations=None, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, stack_account=None, stack_region=None, statistic=None, unit=None)
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
andperiod
properties.- Parameters:
operation (
str
) –operations (
Optional
[Sequence
[Operation
]]) – The operations to apply the metric to. Default: - All operations available by DynamoDB tables will be considered.account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.stack_account (
Optional
[str
]) – Account of the stack this metric is attached to. Default: - Deployment account.stack_region (
Optional
[str
]) – Region of the stack this metric is attached to. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- metric_throttled_requests_for_operations(*, operations=None, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, stack_account=None, stack_region=None, statistic=None, unit=None)
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
andperiod
properties.- Parameters:
operations (
Optional
[Sequence
[Operation
]]) – The operations to apply the metric to. Default: - All operations available by DynamoDB tables will be considered.account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.stack_account (
Optional
[str
]) – Account of the stack this metric is attached to. Default: - Deployment account.stack_region (
Optional
[str
]) – Region of the stack this metric is attached to. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- metric_user_errors(*, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, stack_account=None, stack_region=None, statistic=None, unit=None)
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
andperiod
properties.- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.stack_account (
Optional
[str
]) – Account of the stack this metric is attached to. Default: - Deployment account.stack_region (
Optional
[str
]) – Region of the stack this metric is attached to. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- replica(region)
Retrieve a replica table.
Note: Replica tables are not supported in a region agnostic stack.
- Parameters:
region (
str
) – the region of the replica table.- Return type:
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- encryption_key
The KMS encryption key for the table.
- env
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
The tree node.
- resource_policy
The resource policy for the table.
- Attribute:
true
- stack
The stack in which this resource is defined.
- table_arn
The ARN of the table.
- Attribute:
true
- table_id
The ID of the table.
- Attribute:
true
- table_name
The name of the table.
- Attribute:
true
- table_stream_arn
The stream ARN of the table.
- Attribute:
true
Static Methods
- classmethod from_table_arn(scope, id, table_arn)
Creates a Table construct that represents an external table via table ARN.
- classmethod from_table_attributes(scope, id, *, encryption_key=None, global_indexes=None, grant_index_permissions=None, local_indexes=None, table_arn=None, table_id=None, table_name=None, table_stream_arn=None)
Creates a Table construct that represents an external table.
- Parameters:
scope (
Construct
) – the parent creating construct (usuallythis
).id (
str
) – the construct’s name.encryption_key (
Optional
[IKey
]) – KMS encryption key for the table. Default: - no KMS encryption keyglobal_indexes (
Optional
[Sequence
[str
]]) – The name of the global indexes set for the table. Note: You must set either this property orlocalIndexes
if you want permissions to be granted for indexes as well as the table itself. Default: - no global indexesgrant_index_permissions (
Optional
[bool
]) – Whether or not to grant permissions for all indexes of the table. Note: If false, permissions will only be granted to indexes whenglobalIndexes
orlocalIndexes
is specified. Default: falselocal_indexes (
Optional
[Sequence
[str
]]) – The name of the local indexes set for the table. Note: You must set either this property orglobalIndexes
if you want permissions to be granted for indexes as well as the table itself. Default: - no local indexestable_arn (
Optional
[str
]) – The ARN of the table. Note: You must specify this or thetableName
. Default: - table arn generated usingtableName
and region of stacktable_id (
Optional
[str
]) – The ID of the table. Default: - no table idtable_name (
Optional
[str
]) – The name of the table. Note: You must specify this or thetableArn
. Default: - table name retrieved from providedtableArn
table_stream_arn (
Optional
[str
]) – The stream ARN of the table. Default: - no table stream ARN
- Return type:
- classmethod from_table_name(scope, id, table_name)
Creates a Table construct that represents an external table via table name.
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
- classmethod is_owned_resource(construct)
Returns true if the construct was created by CDK, and false otherwise.
- Parameters:
construct (
IConstruct
) –- Return type:
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters:
construct (
IConstruct
) –- Return type:
bool