Class Table
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.dynamodb.TableBase
software.amazon.awscdk.services.dynamodb.Table
- All Implemented Interfaces:
IEnvironmentAware,IResource,ITable,IResourceWithPolicy,IResourceWithPolicyV2,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.118.0 (build 02eec31)",
date="2025-11-04T09:27:38.778Z")
@Stability(Stable)
public class Table
extends TableBase
Provides a DynamoDB table.
Example:
import software.amazon.awscdk.services.lambda.eventsources.*;
import software.amazon.awscdk.services.dynamodb.*;
import software.amazon.awscdk.services.kms.Key;
Function fn;
Table table = Table.Builder.create(this, "Table")
.partitionKey(Attribute.builder()
.name("id")
.type(AttributeType.STRING)
.build())
.stream(StreamViewType.NEW_IMAGE)
.build();
// Your self managed KMS key
IKey myKey = Key.fromKeyArn(this, "SourceBucketEncryptionKey", "arn:aws:kms:us-east-1:123456789012:key/<key-id>");
fn.addEventSource(DynamoEventSource.Builder.create(table)
.startingPosition(StartingPosition.LATEST)
.filters(List.of(FilterCriteria.filter(Map.of("eventName", FilterRule.isEqual("INSERT")))))
.filterEncryption(myKey)
.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.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IResourceWithPolicy
IResourceWithPolicy.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.dynamodb.ITable
ITable.Jsii$Default -
Field Summary
Fields -
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.addToResourcePolicy(PolicyStatement statement) Adds a statement to the resource policy associated with this 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.Resource policy to assign to DynamoDB Table.protected CfnTablegetTable()Arn of the dynamodb table.Table name of the dynamodb table.ARN of the table's stream, if there is one.schema()Get schema attributes of table or index.Get schema attributes of table or index.voidsetResourcePolicy(PolicyDocument value) Resource policy to assign to DynamoDB Table.Methods inherited from class software.amazon.awscdk.services.dynamodb.TableBase
getRegionalArns, grant, grantFullAccess, grantReadData, grantReadWriteData, grantStream, grantStreamRead, grantTableListStreams, grantWriteData, metric, metric, metricConditionalCheckFailedRequests, metricConditionalCheckFailedRequests, metricConsumedReadCapacityUnits, metricConsumedReadCapacityUnits, metricConsumedWriteCapacityUnits, metricConsumedWriteCapacityUnits, metricSuccessfulRequestLatency, metricSuccessfulRequestLatency, metricSystemErrors, metricSystemErrors, metricSystemErrorsForOperations, metricSystemErrorsForOperations, metricThrottledRequests, metricThrottledRequests, metricThrottledRequestsForOperation, metricThrottledRequestsForOperation, metricThrottledRequestsForOperations, metricThrottledRequestsForOperations, metricUserErrors, metricUserErrorsMethods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, 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.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.awscdk.services.iam.IResourceWithPolicy
getEnvMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
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.
-
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.
-
addToResourcePolicy
@Stability(Stable) @NotNull public AddToResourcePolicyResult addToResourcePolicy(@NotNull PolicyStatement statement) Adds a statement to the resource policy associated with this table.A resource policy will be automatically created upon the first call to
addToResourcePolicy.Note that this does not work with imported tables.
- Specified by:
addToResourcePolicyin interfaceIResourceWithPolicyV2- Specified by:
addToResourcePolicyin classTableBase- Parameters:
statement- The policy statement to add. 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
-
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.
-
getHasIndex
Whether this table has indexes.- Specified by:
getHasIndexin classTableBase
-
getTable
-
getTableArn
Arn of the dynamodb table.- Specified by:
getTableArnin interfaceITable- Specified by:
getTableArnin classTableBase
-
getTableName
Table name of the dynamodb table.- Specified by:
getTableNamein interfaceITable- Specified by:
getTableNamein classTableBase
-
getEncryptionKey
KMS encryption key, if this table uses a customer-managed encryption key.- Specified by:
getEncryptionKeyin interfaceITable- Specified by:
getEncryptionKeyin classTableBase
-
getTableStreamArn
ARN of the table's stream, if there is one.- Specified by:
getTableStreamArnin interfaceITable- Specified by:
getTableStreamArnin classTableBase
-
getResourcePolicy
Resource policy to assign to DynamoDB Table.Default: - No resource policy statements are added to the created table.
- Specified by:
getResourcePolicyin classTableBase- See Also:
-
setResourcePolicy
Resource policy to assign to DynamoDB Table.Default: - No resource policy statements are added to the created table.
- Specified by:
setResourcePolicyin classTableBase- See Also:
-