Class Table
- All Implemented Interfaces:
IConstruct,IDependable,IResource,ITable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct
Example:
Table globalTable = Table.Builder.create(this, "Table")
.partitionKey(Attribute.builder().name("id").type(AttributeType.STRING).build())
.replicationRegions(List.of("us-east-1", "us-east-2", "us-west-2"))
.billingMode(BillingMode.PROVISIONED)
.build();
globalTable.autoScaleWriteCapacity(EnableScalingProps.builder()
.minCapacity(1)
.maxCapacity(10)
.build()).scaleOnUtilization(UtilizationScalingProps.builder().targetUtilizationPercent(75).build());
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.core.IResource
IResource.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.dynamodb.ITable
ITable.Jsii$Default, ITable.Jsii$Proxy -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTable(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedTable(software.amazon.jsii.JsiiObjectRef objRef) Table(software.constructs.Construct scope, String id, TableProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a global secondary index of table.voidAdd a local secondary index of table.autoScaleGlobalSecondaryIndexReadCapacity(String indexName, EnableScalingProps props) Enable read capacity scaling for the given GSI.autoScaleGlobalSecondaryIndexWriteCapacity(String indexName, EnableScalingProps props) Enable write capacity scaling for the given GSI.Enable read capacity scaling for this table.Enable write capacity scaling for this table.static ITablefromTableArn(software.constructs.Construct scope, String id, String tableArn) Creates a Table construct that represents an external table via table arn.static ITablefromTableAttributes(software.constructs.Construct scope, String id, TableAttributes attrs) Creates a Table construct that represents an external table.static ITablefromTableName(software.constructs.Construct scope, String id, String tableName) Creates a Table construct that represents an external table via table name.KMS encryption key, if this table uses a customer-managed encryption key.protected BooleanWhether this table has indexes.Arn of the dynamodb table.Table name of the dynamodb table.ARN of the table's stream, if there is one.grant(IGrantable grantee, @NotNull String... actions) Adds an IAM policy statement associated with this table to an IAM principal's policy.grantFullAccess(IGrantable grantee) Permits all DynamoDB operations ("dynamodb:*") to an IAM principal.static GrantgrantListStreams(IGrantable grantee) Deprecated.grantReadData(IGrantable grantee) Permits an IAM principal all data read operations from this table: BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan, DescribeTable.grantReadWriteData(IGrantable grantee) Permits an IAM principal to all data read/write operations to this table.grantStream(IGrantable grantee, @NotNull String... actions) Adds an IAM policy statement associated with this table's stream to an IAM principal's policy.grantStreamRead(IGrantable grantee) Permits an IAM principal all stream data read operations for this table's stream: DescribeStream, GetRecords, GetShardIterator, ListStreams.grantTableListStreams(IGrantable grantee) Permits an IAM Principal to list streams attached to current dynamodb table.grantWriteData(IGrantable grantee) Permits an IAM principal all data write operations to this table: BatchWriteItem, PutItem, UpdateItem, DeleteItem, DescribeTable.Return the given named metric for this Table.metric(String metricName, MetricOptions props) Return the given named metric for this Table.Metric for the conditional check failed requests this table.Metric for the conditional check failed requests this table.Metric for the consumed read capacity units this table.Metric for the consumed read capacity units this table.Metric for the consumed write capacity units this table.Metric for the consumed write capacity units this table.Metric for the successful request latency this table.Metric for the successful request latency this table.Deprecated.usemetricSystemErrorsForOperations.metricSystemErrors(MetricOptions props) Deprecated.usemetricSystemErrorsForOperations.Metric for the system errors this table.Metric for the system errors this table.Deprecated.Do not use this function.Deprecated.Do not use this function.metricThrottledRequestsForOperation(String operation) How many requests are throttled on this table, for the given operation.metricThrottledRequestsForOperation(String operation, MetricOptions props) How many requests are throttled on this table, for the given operation.Metric for the user errors.metricUserErrors(MetricOptions props) Metric for the user errors.schema()Get schema attributes of table or index.Get schema attributes of table or index.validate()Validate the table construct.Methods inherited from class software.amazon.awscdk.core.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResourceMethods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesizeMethods inherited from class software.constructs.Construct
toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.awscdk.core.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.core.IResource
applyRemovalPolicy, getEnv, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
Table
protected Table(software.amazon.jsii.JsiiObjectRef objRef) -
Table
protected Table(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Table
@Stability(Stable) public Table(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull TableProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromTableArn
@Stability(Stable) @NotNull public static ITable fromTableArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String tableArn) Creates a Table construct that represents an external table via table arn.- Parameters:
scope- The parent creating construct (usuallythis). This parameter is required.id- The construct's name. This parameter is required.tableArn- The table's ARN. This parameter is required.
-
fromTableAttributes
@Stability(Stable) @NotNull public static ITable fromTableAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull TableAttributes attrs) Creates a Table construct that represents an external table.- Parameters:
scope- The parent creating construct (usuallythis). This parameter is required.id- The construct's name. This parameter is required.attrs- ATableAttributesobject. This parameter is required.
-
fromTableName
@Stability(Stable) @NotNull public static ITable fromTableName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String tableName) Creates a Table construct that represents an external table via table name.- Parameters:
scope- The parent creating construct (usuallythis). This parameter is required.id- The construct's name. This parameter is required.tableName- The table's name. This parameter is required.
-
grantListStreams
@Stability(Deprecated) @Deprecated @NotNull public static Grant grantListStreams(@NotNull IGrantable grantee) Deprecated.UsegrantTableListStreams(software.amazon.awscdk.services.iam.IGrantable)for more granular permission(deprecated) Permits an IAM Principal to list all DynamoDB Streams.- Parameters:
grantee- The principal (no-op if undefined). This parameter is required.
-
addGlobalSecondaryIndex
Add a global secondary index of table.- Parameters:
props- the property of global secondary index. This parameter is required.
-
addLocalSecondaryIndex
Add a local secondary index of table.- Parameters:
props- the property of local secondary index. This parameter is required.
-
autoScaleGlobalSecondaryIndexReadCapacity
@Stability(Stable) @NotNull public IScalableTableAttribute autoScaleGlobalSecondaryIndexReadCapacity(@NotNull String indexName, @NotNull EnableScalingProps props) Enable read capacity scaling for the given GSI.- Parameters:
indexName- This parameter is required.props- This parameter is required.- Returns:
- An object to configure additional AutoScaling settings for this attribute
-
autoScaleGlobalSecondaryIndexWriteCapacity
@Stability(Stable) @NotNull public IScalableTableAttribute autoScaleGlobalSecondaryIndexWriteCapacity(@NotNull String indexName, @NotNull EnableScalingProps props) Enable write capacity scaling for the given GSI.- Parameters:
indexName- This parameter is required.props- This parameter is required.- Returns:
- An object to configure additional AutoScaling settings for this attribute
-
autoScaleReadCapacity
@Stability(Stable) @NotNull public IScalableTableAttribute autoScaleReadCapacity(@NotNull EnableScalingProps props) Enable read capacity scaling for this table.- Parameters:
props- This parameter is required.- Returns:
- An object to configure additional AutoScaling settings
-
autoScaleWriteCapacity
@Stability(Stable) @NotNull public IScalableTableAttribute autoScaleWriteCapacity(@NotNull EnableScalingProps props) Enable write capacity scaling for this table.- Parameters:
props- This parameter is required.- Returns:
- An object to configure additional AutoScaling settings for this attribute
-
grant
@Stability(Stable) @NotNull public Grant grant(@NotNull IGrantable grantee, @NotNull @NotNull String... actions) Adds an IAM policy statement associated with this table to an IAM principal's policy.If
encryptionKeyis present, appropriate grants to the key needs to be added separately using thetable.encryptionKey.grant*methods. -
grantFullAccess
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.
- Specified by:
grantFullAccessin interfaceITable- Parameters:
grantee- The principal to grant access to. This parameter is required.
-
grantReadData
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.
- Specified by:
grantReadDatain interfaceITable- Parameters:
grantee- The principal to grant access to. This parameter is required.
-
grantReadWriteData
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.
- Specified by:
grantReadWriteDatain interfaceITable- Parameters:
grantee- The principal to grant access to. This parameter is required.
-
grantStream
@Stability(Stable) @NotNull public Grant grantStream(@NotNull IGrantable grantee, @NotNull @NotNull String... actions) Adds an IAM policy statement associated with this table's stream to an IAM principal's policy.If
encryptionKeyis present, appropriate grants to the key needs to be added separately using thetable.encryptionKey.grant*methods.- Specified by:
grantStreamin interfaceITable- Parameters:
grantee- The principal (no-op if undefined). This parameter is required.actions- The set of actions to allow (i.e. "dynamodb:DescribeStream", "dynamodb:GetRecords", ...). This parameter is required.
-
grantStreamRead
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.
- Specified by:
grantStreamReadin interfaceITable- Parameters:
grantee- The principal to grant access to. This parameter is required.
-
grantTableListStreams
Permits an IAM Principal to list streams attached to current dynamodb table.- Specified by:
grantTableListStreamsin interfaceITable- Parameters:
grantee- The principal (no-op if undefined). This parameter is required.
-
grantWriteData
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.
- Specified by:
grantWriteDatain interfaceITable- Parameters:
grantee- The principal to grant access to. This parameter is required.
-
metric
@Stability(Stable) @NotNull public Metric metric(@NotNull String metricName, @Nullable MetricOptions props) 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
statisticandperiodproperties. -
metric
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
statisticandperiodproperties. -
metricConditionalCheckFailedRequests
@Stability(Stable) @NotNull public Metric metricConditionalCheckFailedRequests(@Nullable MetricOptions props) 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
statisticandperiodproperties.- Specified by:
metricConditionalCheckFailedRequestsin interfaceITable- Parameters:
props-
-
metricConditionalCheckFailedRequests
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
statisticandperiodproperties.- Specified by:
metricConditionalCheckFailedRequestsin interfaceITable
-
metricConsumedReadCapacityUnits
@Stability(Stable) @NotNull public Metric metricConsumedReadCapacityUnits(@Nullable MetricOptions props) 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
statisticandperiodproperties.- Specified by:
metricConsumedReadCapacityUnitsin interfaceITable- Parameters:
props-
-
metricConsumedReadCapacityUnits
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
statisticandperiodproperties.- Specified by:
metricConsumedReadCapacityUnitsin interfaceITable
-
metricConsumedWriteCapacityUnits
@Stability(Stable) @NotNull public Metric metricConsumedWriteCapacityUnits(@Nullable MetricOptions props) 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
statisticandperiodproperties.- Specified by:
metricConsumedWriteCapacityUnitsin interfaceITable- Parameters:
props-
-
metricConsumedWriteCapacityUnits
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
statisticandperiodproperties.- Specified by:
metricConsumedWriteCapacityUnitsin interfaceITable
-
metricSuccessfulRequestLatency
@Stability(Stable) @NotNull public Metric metricSuccessfulRequestLatency(@Nullable MetricOptions props) 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
statisticandperiodproperties.- Specified by:
metricSuccessfulRequestLatencyin interfaceITable- Parameters:
props-
-
metricSuccessfulRequestLatency
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
statisticandperiodproperties.- Specified by:
metricSuccessfulRequestLatencyin interfaceITable
-
metricSystemErrors
@Stability(Deprecated) @Deprecated @NotNull public Metric metricSystemErrors(@Nullable MetricOptions props) Deprecated.usemetricSystemErrorsForOperations.(deprecated) Metric for the system errors this table.- Specified by:
metricSystemErrorsin interfaceITable- Parameters:
props-
-
metricSystemErrors
Deprecated.usemetricSystemErrorsForOperations.(deprecated) Metric for the system errors this table.- Specified by:
metricSystemErrorsin interfaceITable
-
metricSystemErrorsForOperations
@Stability(Stable) @NotNull public IMetric metricSystemErrorsForOperations(@Nullable SystemErrorsForOperationsMetricOptions props) 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
statisticandperiodproperties.- Specified by:
metricSystemErrorsForOperationsin interfaceITable- Parameters:
props-
-
metricSystemErrorsForOperations
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
statisticandperiodproperties.- Specified by:
metricSystemErrorsForOperationsin interfaceITable
-
metricThrottledRequests
@Stability(Deprecated) @Deprecated @NotNull public Metric metricThrottledRequests(@Nullable MetricOptions props) Deprecated.Do not use this function. It returns an invalid metric. UsemetricThrottledRequestsForOperationinstead.(deprecated) How many requests are throttled on this table.Default: sum over 5 minutes
- Specified by:
metricThrottledRequestsin interfaceITable- Parameters:
props-
-
metricThrottledRequests
Deprecated.Do not use this function. It returns an invalid metric. UsemetricThrottledRequestsForOperationinstead.(deprecated) How many requests are throttled on this table.Default: sum over 5 minutes
- Specified by:
metricThrottledRequestsin interfaceITable
-
metricThrottledRequestsForOperation
@Stability(Stable) @NotNull public Metric metricThrottledRequestsForOperation(@NotNull String operation, @Nullable MetricOptions props) How many requests are throttled on this table, for the given operation.Default: sum over 5 minutes
- Parameters:
operation- This parameter is required.props-
-
metricThrottledRequestsForOperation
@Stability(Stable) @NotNull public Metric metricThrottledRequestsForOperation(@NotNull String operation) How many requests are throttled on this table, for the given operation.Default: sum over 5 minutes
- Parameters:
operation- This parameter is required.
-
metricUserErrors
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
statisticandperiodproperties.- Specified by:
metricUserErrorsin interfaceITable- Parameters:
props-
-
metricUserErrors
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
statisticandperiodproperties.- Specified by:
metricUserErrorsin interfaceITable
-
schema
Get schema attributes of table or index.- Parameters:
indexName-- Returns:
- Schema of table or index.
-
schema
Get schema attributes of table or index.- Returns:
- Schema of table or index.
-
validate
Validate the table construct. -
getHasIndex
Whether this table has indexes. -
getRegionalArns
-
getTableArn
Arn of the dynamodb table.- Specified by:
getTableArnin interfaceITable
-
getTableName
Table name of the dynamodb table.- Specified by:
getTableNamein interfaceITable
-
getEncryptionKey
KMS encryption key, if this table uses a customer-managed encryption key.- Specified by:
getEncryptionKeyin interfaceITable
-
getTableStreamArn
ARN of the table's stream, if there is one.- Specified by:
getTableStreamArnin interfaceITable
-
grantTableListStreams(software.amazon.awscdk.services.iam.IGrantable)for more granular permission