RestoreTableCommand

Restores the table to the specified point in time within the earliest_restorable_timestamp and the current time. For more information about restore points, see Time window for PITR continuous backups  in the Amazon Keyspaces Developer Guide.

Any number of users can execute up to 4 concurrent restores (any type of restore) in a given account.

When you restore using point in time recovery, Amazon Keyspaces restores your source table's schema and data to the state based on the selected timestamp (day:hour:minute:second) to a new table. The Time to Live (TTL) settings are also restored to the state based on the selected timestamp.

In addition to the table's schema, data, and TTL settings, RestoreTable restores the capacity mode, auto scaling settings, encryption settings, and point-in-time recovery settings from the source table. Unlike the table's schema data and TTL settings, which are restored based on the selected timestamp, these settings are always restored based on the table's settings as of the current time or when the table was deleted.

You can also overwrite these settings during restore:

  • Read/write capacity mode

  • Provisioned throughput capacity units

  • Auto scaling settings

  • Point-in-time (PITR) settings

  • Tags

For more information, see PITR restore settings  in the Amazon Keyspaces Developer Guide.

Note that the following settings are not restored, and you must configure them manually for the new table:

  • Identity and Access Management (IAM) policies

  • Amazon CloudWatch metrics and alarms

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { KeyspacesClient, RestoreTableCommand } from "@aws-sdk/client-keyspaces"; // ES Modules import
// const { KeyspacesClient, RestoreTableCommand } = require("@aws-sdk/client-keyspaces"); // CommonJS import
const client = new KeyspacesClient(config);
const input = { // RestoreTableRequest
  sourceKeyspaceName: "STRING_VALUE", // required
  sourceTableName: "STRING_VALUE", // required
  targetKeyspaceName: "STRING_VALUE", // required
  targetTableName: "STRING_VALUE", // required
  restoreTimestamp: new Date("TIMESTAMP"),
  capacitySpecificationOverride: { // CapacitySpecification
    throughputMode: "STRING_VALUE", // required
    readCapacityUnits: Number("long"),
    writeCapacityUnits: Number("long"),
  },
  encryptionSpecificationOverride: { // EncryptionSpecification
    type: "STRING_VALUE", // required
    kmsKeyIdentifier: "STRING_VALUE",
  },
  pointInTimeRecoveryOverride: { // PointInTimeRecovery
    status: "STRING_VALUE", // required
  },
  tagsOverride: [ // TagList
    { // Tag
      key: "STRING_VALUE", // required
      value: "STRING_VALUE", // required
    },
  ],
  autoScalingSpecification: { // AutoScalingSpecification
    writeCapacityAutoScaling: { // AutoScalingSettings
      autoScalingDisabled: true || false,
      minimumUnits: Number("long"),
      maximumUnits: Number("long"),
      scalingPolicy: { // AutoScalingPolicy
        targetTrackingScalingPolicyConfiguration: { // TargetTrackingScalingPolicyConfiguration
          disableScaleIn: true || false,
          scaleInCooldown: Number("int"),
          scaleOutCooldown: Number("int"),
          targetValue: Number("double"), // required
        },
      },
    },
    readCapacityAutoScaling: {
      autoScalingDisabled: true || false,
      minimumUnits: Number("long"),
      maximumUnits: Number("long"),
      scalingPolicy: {
        targetTrackingScalingPolicyConfiguration: {
          disableScaleIn: true || false,
          scaleInCooldown: Number("int"),
          scaleOutCooldown: Number("int"),
          targetValue: Number("double"), // required
        },
      },
    },
  },
  replicaSpecifications: [ // ReplicaSpecificationList
    { // ReplicaSpecification
      region: "STRING_VALUE", // required
      readCapacityUnits: Number("long"),
      readCapacityAutoScaling: {
        autoScalingDisabled: true || false,
        minimumUnits: Number("long"),
        maximumUnits: Number("long"),
        scalingPolicy: {
          targetTrackingScalingPolicyConfiguration: {
            disableScaleIn: true || false,
            scaleInCooldown: Number("int"),
            scaleOutCooldown: Number("int"),
            targetValue: Number("double"), // required
          },
        },
      },
    },
  ],
};
const command = new RestoreTableCommand(input);
const response = await client.send(command);
// { // RestoreTableResponse
//   restoredTableARN: "STRING_VALUE", // required
// };

RestoreTableCommand Input

See RestoreTableCommandInput for more details

Parameter
Type
Description
sourceKeyspaceName
Required
string | undefined

The keyspace name of the source table.

sourceTableName
Required
string | undefined

The name of the source table.

targetKeyspaceName
Required
string | undefined

The name of the target keyspace.

targetTableName
Required
string | undefined

The name of the target table.

autoScalingSpecification
AutoScalingSpecification | undefined

The optional auto scaling settings for the restored table in provisioned capacity mode. Specifies if the service can manage throughput capacity of a provisioned table automatically on your behalf. Amazon Keyspaces auto scaling helps you provision throughput capacity for variable workloads efficiently by increasing and decreasing your table's read and write capacity automatically in response to application traffic.

For more information, see Managing throughput capacity automatically with Amazon Keyspaces auto scaling  in the Amazon Keyspaces Developer Guide.

capacitySpecificationOverride
CapacitySpecification | undefined

Specifies the read/write throughput capacity mode for the target table. The options are:

  • throughputMode:PAY_PER_REQUEST

  • throughputMode:PROVISIONED - Provisioned capacity mode requires readCapacityUnits and writeCapacityUnits as input.

The default is throughput_mode:PAY_PER_REQUEST.

For more information, see Read/write capacity modes  in the Amazon Keyspaces Developer Guide.

encryptionSpecificationOverride
EncryptionSpecification | undefined

Specifies the encryption settings for the target table. You can choose one of the following KMS key (KMS key):

  • type:AWS_OWNED_KMS_KEY - This key is owned by Amazon Keyspaces.

  • type:CUSTOMER_MANAGED_KMS_KEY - This key is stored in your account and is created, owned, and managed by you. This option requires the kms_key_identifier of the KMS key in Amazon Resource Name (ARN) format as input.

The default is type:AWS_OWNED_KMS_KEY.

For more information, see Encryption at rest  in the Amazon Keyspaces Developer Guide.

pointInTimeRecoveryOverride
PointInTimeRecovery | undefined

Specifies the pointInTimeRecovery settings for the target table. The options are:

  • status=ENABLED

  • status=DISABLED

If it's not specified, the default is status=DISABLED.

For more information, see Point-in-time recovery  in the Amazon Keyspaces Developer Guide.

replicaSpecifications
ReplicaSpecification[] | undefined

The optional Region specific settings of a multi-Regional table.

restoreTimestamp
Date | undefined

The restore timestamp in ISO 8601 format.

tagsOverride
Tag[] | undefined

A list of key-value pair tags to be attached to the restored table.

For more information, see Adding tags and labels to Amazon Keyspaces resources  in the Amazon Keyspaces Developer Guide.

RestoreTableCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
restoredTableARN
Required
string | undefined

The Amazon Resource Name (ARN) of the restored table.

Throws

Name
Fault
Details
AccessDeniedException
client

You don't have sufficient access permissions to perform this action.

ConflictException
client

Amazon Keyspaces couldn't complete the requested action. This error may occur if you try to perform an action and the same or a different action is already in progress, or if you try to create a resource that already exists.

InternalServerException
server

Amazon Keyspaces was unable to fully process this request because of an internal server error.

ResourceNotFoundException
client

The operation tried to access a keyspace, table, or type that doesn't exist. The resource might not be specified correctly, or its status might not be ACTIVE.

ServiceQuotaExceededException
client

The operation exceeded the service quota for this resource. For more information on service quotas, see Quotas  in the Amazon Keyspaces Developer Guide.

ValidationException
client

The operation failed due to an invalid or malformed request.

KeyspacesServiceException
Base exception class for all service exceptions from Keyspaces service.