Class Table.Builder

java.lang.Object
software.amazon.awscdk.services.dynamodb.Table.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<Table>
Enclosing class:
Table

@Stability(Stable) public static final class Table.Builder extends Object implements software.amazon.jsii.Builder<Table>
A fluent builder for Table.
  • Method Details

    • create

      @Stability(Stable) public static Table.Builder create(software.constructs.Construct scope, String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      Returns:
      a new instance of Table.Builder.
    • partitionKey

      @Stability(Stable) public Table.Builder partitionKey(Attribute partitionKey)
      Partition key attribute definition.

      Parameters:
      partitionKey - Partition key attribute definition. This parameter is required.
      Returns:
      this
    • sortKey

      @Stability(Stable) public Table.Builder sortKey(Attribute sortKey)
      Sort key attribute definition.

      Default: no sort key

      Parameters:
      sortKey - Sort key attribute definition. This parameter is required.
      Returns:
      this
    • billingMode

      @Stability(Stable) public Table.Builder billingMode(BillingMode billingMode)
      Specify how you are charged for read and write throughput and how you manage capacity.

      Default: PROVISIONED if `replicationRegions` is not specified, PAY_PER_REQUEST otherwise

      Parameters:
      billingMode - Specify how you are charged for read and write throughput and how you manage capacity. This parameter is required.
      Returns:
      this
    • contributorInsightsEnabled

      @Stability(Stable) public Table.Builder contributorInsightsEnabled(Boolean contributorInsightsEnabled)
      Whether CloudWatch contributor insights is enabled.

      Default: false

      Parameters:
      contributorInsightsEnabled - Whether CloudWatch contributor insights is enabled. This parameter is required.
      Returns:
      this
    • encryption

      @Stability(Stable) public Table.Builder encryption(TableEncryption encryption)
      Whether server-side encryption with an AWS managed customer master key is enabled.

      This property cannot be set if serverSideEncryption is set.

      NOTE: if you set this to CUSTOMER_MANAGED and encryptionKey is not specified, the key that the Tablet generates for you will be created with default permissions. If you are using CDKv2, these permissions will be sufficient to enable the key for use with DynamoDB tables. If you are using CDKv1, make sure the feature flag @aws-cdk/aws-kms:defaultKeyPolicies is set to true in your cdk.json.

      Default: - server-side encryption is enabled with an AWS owned customer master key

      Parameters:
      encryption - Whether server-side encryption with an AWS managed customer master key is enabled. This parameter is required.
      Returns:
      this
    • encryptionKey

      @Stability(Stable) public Table.Builder encryptionKey(IKey encryptionKey)
      External KMS key to use for table encryption.

      This property can only be set if encryption is set to TableEncryption.CUSTOMER_MANAGED.

      Default: - If `encryption` is set to `TableEncryption.CUSTOMER_MANAGED` and this property is undefined, a new KMS key will be created and associated with this table.

      Parameters:
      encryptionKey - External KMS key to use for table encryption. This parameter is required.
      Returns:
      this
    • pointInTimeRecovery

      @Stability(Stable) public Table.Builder pointInTimeRecovery(Boolean pointInTimeRecovery)
      Whether point-in-time recovery is enabled.

      Default: - point-in-time recovery is disabled

      Parameters:
      pointInTimeRecovery - Whether point-in-time recovery is enabled. This parameter is required.
      Returns:
      this
    • readCapacity

      @Stability(Stable) public Table.Builder readCapacity(Number readCapacity)
      The read capacity for the table.

      Careful if you add Global Secondary Indexes, as those will share the table's provisioned throughput.

      Can only be provided if billingMode is Provisioned.

      Default: 5

      Parameters:
      readCapacity - The read capacity for the table. This parameter is required.
      Returns:
      this
    • removalPolicy

      @Stability(Stable) public Table.Builder removalPolicy(RemovalPolicy removalPolicy)
      The removal policy to apply to the DynamoDB Table.

      Default: RemovalPolicy.RETAIN

      Parameters:
      removalPolicy - The removal policy to apply to the DynamoDB Table. This parameter is required.
      Returns:
      this
    • replicationRegions

      @Stability(Stable) public Table.Builder replicationRegions(List<String> replicationRegions)
      Regions where replica tables will be created.

      Default: - no replica tables are created

      Parameters:
      replicationRegions - Regions where replica tables will be created. This parameter is required.
      Returns:
      this
    • replicationTimeout

      @Stability(Stable) public Table.Builder replicationTimeout(Duration replicationTimeout)
      The timeout for a table replication operation in a single region.

      Default: Duration.minutes(30)

      Parameters:
      replicationTimeout - The timeout for a table replication operation in a single region. This parameter is required.
      Returns:
      this
    • serverSideEncryption

      @Stability(Deprecated) @Deprecated public Table.Builder serverSideEncryption(Boolean serverSideEncryption)
      Deprecated.
      This property is deprecated. In order to obtain the same behavior as enabling this, set the encryption property to TableEncryption.AWS_MANAGED instead.
      (deprecated) Whether server-side encryption with an AWS managed customer master key is enabled.

      This property cannot be set if encryption and/or encryptionKey is set.

      Default: - server-side encryption is enabled with an AWS owned customer master key

      Parameters:
      serverSideEncryption - Whether server-side encryption with an AWS managed customer master key is enabled. This parameter is required.
      Returns:
      this
    • stream

      @Stability(Stable) public Table.Builder stream(StreamViewType stream)
      When an item in the table is modified, StreamViewType determines what information is written to the stream for this table.

      Default: - streams are disabled unless `replicationRegions` is specified

      Parameters:
      stream - When an item in the table is modified, StreamViewType determines what information is written to the stream for this table. This parameter is required.
      Returns:
      this
    • tableClass

      @Stability(Stable) public Table.Builder tableClass(TableClass tableClass)
      Specify the table class.

      Default: STANDARD

      Parameters:
      tableClass - Specify the table class. This parameter is required.
      Returns:
      this
    • timeToLiveAttribute

      @Stability(Stable) public Table.Builder timeToLiveAttribute(String timeToLiveAttribute)
      The name of TTL attribute.

      Default: - TTL is disabled

      Parameters:
      timeToLiveAttribute - The name of TTL attribute. This parameter is required.
      Returns:
      this
    • waitForReplicationToFinish

      @Stability(Stable) public Table.Builder waitForReplicationToFinish(Boolean waitForReplicationToFinish)
      Indicates whether CloudFormation stack waits for replication to finish.

      If set to false, the CloudFormation resource will mark the resource as created and replication will be completed asynchronously. This property is ignored if replicationRegions property is not set.

      DO NOT UNSET this property if adding/removing multiple replicationRegions in one deployment, as CloudFormation only supports one region replication at a time. CDK overcomes this limitation by waiting for replication to finish before starting new replicationRegion.

      Default: true

      Parameters:
      waitForReplicationToFinish - Indicates whether CloudFormation stack waits for replication to finish. This parameter is required.
      Returns:
      this
      See Also:
    • writeCapacity

      @Stability(Stable) public Table.Builder writeCapacity(Number writeCapacity)
      The write capacity for the table.

      Careful if you add Global Secondary Indexes, as those will share the table's provisioned throughput.

      Can only be provided if billingMode is Provisioned.

      Default: 5

      Parameters:
      writeCapacity - The write capacity for the table. This parameter is required.
      Returns:
      this
    • kinesisStream

      @Stability(Stable) public Table.Builder kinesisStream(IStream kinesisStream)
      Kinesis Data Stream to capture item-level changes for the table.

      Default: - no Kinesis Data Stream

      Parameters:
      kinesisStream - Kinesis Data Stream to capture item-level changes for the table. This parameter is required.
      Returns:
      this
    • tableName

      @Stability(Stable) public Table.Builder tableName(String tableName)
      Enforces a particular physical table name.

      Default:

      Parameters:
      tableName - Enforces a particular physical table name. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public Table build()
      Specified by:
      build in interface software.amazon.jsii.Builder<Table>
      Returns:
      a newly built instance of Table.