"ReturnConsumedCapacity": "TOTAL"
}
"ReplyDateTime": {"S": "2015-02-18T20:27:36.165Z"}, "PostedBy": {"S": "User A"},
"Id": {"S": "Amazon DynamoDB#DynamoDB Thread 1"}
}, {
"ReplyDateTime": {"S": "2015-02-25T20:27:36.165Z"}, "PostedBy": {"S": "User B"},
The following example returns the number of items in the Thread table for a particular forum.
Sample Request
POST / HTTP/1.1
Host: dynamodb.<region>.<domain>;
Accept-Encoding: identity
Query
Content-Length: <PayloadSizeBytes>
User-Agent: <UserAgentString>
Content-Type: application/x-amz-json-1.0
Authorization: AWS4-HMAC-SHA256 Credential=<Credential>, SignedHeaders=<Headers>, Signature=<Signature>
X-Amz-Date: <Date>
X-Amz-Target: DynamoDB_20120810.Query {
"TableName": "Thread", "ConsistentRead": true,
"KeyConditionExpression": "ForumName = :val",
"ExpressionAttributeValues": {":val": {"S": "Amazon DynamoDB"}}
}
Sample Response
HTTP/1.1 200 OK
x-amzn-RequestId: <RequestId>
x-amz-crc32: <Checksum>
Content-Type: application/x-amz-json-1.0 Content-Length: <PayloadSizeBytes>
Date: <Date>
{
"Count":2, "ScannedCount":2 }
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
• AWS Command Line Interface
• AWS SDK for .NET
• AWS SDK for C++
• AWS SDK for Go
• AWS SDK for Java V2
• AWS SDK for JavaScript
• AWS SDK for PHP V3
• AWS SDK for Python
• AWS SDK for Ruby V3
RestoreTableFromBackup
RestoreTableFromBackup
Service: Amazon DynamoDB
Creates a new table from an existing backup. Any number of users can execute up to 4 concurrent restores (any type of restore) in a given account.
You can call RestoreTableFromBackup at a maximum rate of 10 times per second.
You must manually set up the following on the restored table:
• Auto scaling policies
• IAM policies
• Amazon CloudWatch metrics and alarms
• Tags
• Stream settings
• Time to Live (TTL) settings
Request Syntax
{ "BackupArn": "string",
"BillingModeOverride": "string", "GlobalSecondaryIndexOverride": [ {
"LocalSecondaryIndexOverride": [ {
"ProvisionedThroughputOverride": { "ReadCapacityUnits": number, "WriteCapacityUnits": number
RestoreTableFromBackup
},
"SSESpecificationOverride": { "Enabled": boolean,
"KMSMasterKeyId": "string", "SSEType": "string"
},
"TargetTableName": "string"
}
Request Parameters
The request accepts the following data in JSON format.
NoteIn the following list, the required parameters are described first.
BackupArn (p. 160)
The Amazon Resource Name (ARN) associated with the backup.
Type: String
Length Constraints: Minimum length of 37. Maximum length of 1024.
Required: Yes
TargetTableName (p. 160)
The name of the new table to which the backup must be restored.
Type: String
Length Constraints: Minimum length of 3. Maximum length of 255.
Pattern: [a-zA-Z0-9_.-]+
Required: Yes
BillingModeOverride (p. 160)
The billing mode of the restored table.
Type: String
Valid Values: PROVISIONED | PAY_PER_REQUEST Required: No
GlobalSecondaryIndexOverride (p. 160)
List of global secondary indexes for the restored table. The indexes provided should match existing secondary indexes. You can choose to exclude some or all of the indexes at the time of restore.
Type: Array of GlobalSecondaryIndex (p. 396) objects Required: No
LocalSecondaryIndexOverride (p. 160)
List of local secondary indexes for the restored table. The indexes provided should match existing secondary indexes. You can choose to exclude some or all of the indexes at the time of restore.
Type: Array of LocalSecondaryIndex (p. 416) objects Required: No
RestoreTableFromBackup
ProvisionedThroughputOverride (p. 160)
Provisioned throughput settings for the restored table.
Type: ProvisionedThroughput (p. 426) object Required: No
SSESpecificationOverride (p. 160)
The new server-side encryption settings for the restored table.
Type: SSESpecification (p. 460) object Required: No
Response Syntax
{
"TableDescription": { "ArchivalSummary": {
"LastUpdateToPayPerRequestDateTime": number },
"CreationDateTime": number, "GlobalSecondaryIndexes": [
"GlobalTableVersion": "string",
RestoreTableFromBackup
"LatestStreamArn": "string", "LatestStreamLabel": "string", "LocalSecondaryIndexes": [ "ReplicaStatusPercentProgress": "string", "ReplicaTableClassSummary": {
RestoreTableFromBackup
"InaccessibleEncryptionDateTime": number, "KMSMasterKeyArn": "string",
"SSEType": "string", "Status": "string"
},
"StreamSpecification": { "StreamEnabled": boolean, "StreamViewType": "string"
},
"TableArn": "string", "TableClassSummary": {
"LastUpdateDateTime": number, "TableClass": "string"
},
"TableId": "string", "TableName": "string", "TableSizeBytes": number, "TableStatus": "string"
} }
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
TableDescription (p. 162)
The description of the table created from an existing backup.
Type: TableDescription (p. 464) object
Errors
For information about the errors that are common to all actions, see Common Errors (p. 519).
BackupInUseException
There is another ongoing conflicting backup control plane operation on the table. The backup is either being created, deleted or restored to a table.
HTTP Status Code: 400 BackupNotFoundException
Backup not found for the given BackupARN.
HTTP Status Code: 400 InternalServerError
An error occurred on the server side.
HTTP Status Code: 500 LimitExceededException
There is no limit to the number of daily on-demand backups that can be taken.
Up to 50 simultaneous table operations are allowed per account. These operations include
CreateTable, UpdateTable, DeleteTable,UpdateTimeToLive, RestoreTableFromBackup, and RestoreTableToPointInTime.
RestoreTableFromBackup
The only exception is when you are creating a table with one or more secondary indexes. You can have up to 25 such requests running at a time; however, if the table or index specifications are complex, DynamoDB might temporarily reduce the number of concurrent operations.
There is a soft account quota of 256 tables.
HTTP Status Code: 400 TableAlreadyExistsException
A target table with the specified name already exists.
HTTP Status Code: 400 TableInUseException
A target table with the specified name is either being created or deleted.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
• AWS Command Line Interface
• AWS SDK for .NET
• AWS SDK for C++
• AWS SDK for Go
• AWS SDK for Java V2
• AWS SDK for JavaScript
• AWS SDK for PHP V3
• AWS SDK for Python
• AWS SDK for Ruby V3
RestoreTableToPointInTime
RestoreTableToPointInTime
Service: Amazon DynamoDB
Restores the specified table to the specified point in time within EarliestRestorableDateTime and LatestRestorableDateTime. You can restore your table to any point in time during the last 35 days.
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, DynamoDB restores your table data to the state based on the selected date and time (day:hour:minute:second) to a new table.
Along with data, the following are also included on the new restored table using point in time recovery:
• Global secondary indexes (GSIs)
• Local secondary indexes (LSIs)
• Provisioned read and write capacity
• Encryption settings Important
All these settings come from the current settings of the source table at the time of restore.
You must manually set up the following on the restored table:
• Auto scaling policies
• IAM policies
• Amazon CloudWatch metrics and alarms
• Tags
• Stream settings
• Time to Live (TTL) settings
• Point in time recovery settings
Request Syntax
{
"BillingModeOverride": "string", "GlobalSecondaryIndexOverride": [ {
"IndexName": "string", "KeySchema": [ {
"AttributeName": "string", "KeyType": "string"
} ],
"Projection": {
"NonKeyAttributes": [ "string" ], "ProjectionType": "string"
},
"ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": number }
} ],
"LocalSecondaryIndexOverride": [ {
"IndexName": "string",
RestoreTableToPointInTime
"KeySchema": [ {
"AttributeName": "string", "KeyType": "string"
} ],
"Projection": {
"NonKeyAttributes": [ "string" ], "ProjectionType": "string"
} } ],
"ProvisionedThroughputOverride": { "ReadCapacityUnits": number, "WriteCapacityUnits": number },
"RestoreDateTime": number, "SourceTableArn": "string", "SourceTableName": "string", "SSESpecificationOverride": { "Enabled": boolean,
"KMSMasterKeyId": "string", "SSEType": "string"
},
"TargetTableName": "string", "UseLatestRestorableTime": boolean }
Request Parameters
The request accepts the following data in JSON format.
NoteIn the following list, the required parameters are described first.
TargetTableName (p. 166)
The name of the new table to which it must be restored to.
Type: String
Length Constraints: Minimum length of 3. Maximum length of 255.
Pattern: [a-zA-Z0-9_.-]+
Required: Yes
BillingModeOverride (p. 166)
The billing mode of the restored table.
Type: String
Valid Values: PROVISIONED | PAY_PER_REQUEST Required: No
GlobalSecondaryIndexOverride (p. 166)
List of global secondary indexes for the restored table. The indexes provided should match existing secondary indexes. You can choose to exclude some or all of the indexes at the time of restore.
Type: Array of GlobalSecondaryIndex (p. 396) objects Required: No
RestoreTableToPointInTime
LocalSecondaryIndexOverride (p. 166)
List of local secondary indexes for the restored table. The indexes provided should match existing secondary indexes. You can choose to exclude some or all of the indexes at the time of restore.
Type: Array of LocalSecondaryIndex (p. 416) objects Required: No
ProvisionedThroughputOverride (p. 166)
Provisioned throughput settings for the restored table.
Type: ProvisionedThroughput (p. 426) object Required: No
RestoreDateTime (p. 166)
Time in the past to restore the table to.
Type: Timestamp Required: No SourceTableArn (p. 166)
The DynamoDB table that will be restored. This value is an Amazon Resource Name (ARN).
Type: String Required: No
SourceTableName (p. 166)
Name of the source table that is being restored.
Type: String
Length Constraints: Minimum length of 3. Maximum length of 255.
Pattern: [a-zA-Z0-9_.-]+
Required: No
SSESpecificationOverride (p. 166)
The new server-side encryption settings for the restored table.
Type: SSESpecification (p. 460) object Required: No
UseLatestRestorableTime (p. 166)
Restore the table to the latest possible time. LatestRestorableDateTime is typically 5 minutes before the current time.
Type: Boolean Required: No
Response Syntax
{ "TableDescription": { "ArchivalSummary": {
"ArchivalBackupArn": "string",
RestoreTableToPointInTime
"LastUpdateToPayPerRequestDateTime": number },
"CreationDateTime": number, "GlobalSecondaryIndexes": [
"GlobalTableVersion": "string", "ItemCount": number,
"LatestStreamArn": "string", "LatestStreamLabel": "string", "LocalSecondaryIndexes": [
RestoreTableToPointInTime "ReplicaStatusPercentProgress": "string", "ReplicaTableClassSummary": {
"InaccessibleEncryptionDateTime": number, "KMSMasterKeyArn": "string", "TableSizeBytes": number, "TableStatus": "string"
} }
RestoreTableToPointInTime
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
TableDescription (p. 168)
Represents the properties of a table.
Type: TableDescription (p. 464) object
Errors
For information about the errors that are common to all actions, see Common Errors (p. 519).
InternalServerError
An error occurred on the server side.
HTTP Status Code: 500 InvalidRestoreTimeException
An invalid restore time was specified. RestoreDateTime must be between EarliestRestorableDateTime and LatestRestorableDateTime.
HTTP Status Code: 400 LimitExceededException
There is no limit to the number of daily on-demand backups that can be taken.
Up to 50 simultaneous table operations are allowed per account. These operations include
CreateTable, UpdateTable, DeleteTable,UpdateTimeToLive, RestoreTableFromBackup, and RestoreTableToPointInTime.
The only exception is when you are creating a table with one or more secondary indexes. You can have up to 25 such requests running at a time; however, if the table or index specifications are complex, DynamoDB might temporarily reduce the number of concurrent operations.
There is a soft account quota of 256 tables.
HTTP Status Code: 400
PointInTimeRecoveryUnavailableException
Point in time recovery has not yet been enabled for this source table.
HTTP Status Code: 400 TableAlreadyExistsException
A target table with the specified name already exists.
HTTP Status Code: 400 TableInUseException
A target table with the specified name is either being created or deleted.
HTTP Status Code: 400
RestoreTableToPointInTime
TableNotFoundException
A source table with the name TableName does not currently exist within the subscriber's account.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
• AWS Command Line Interface
• AWS SDK for .NET
• AWS SDK for C++
• AWS SDK for Go
• AWS SDK for Java V2
• AWS SDK for JavaScript
• AWS SDK for PHP V3
• AWS SDK for Python
• AWS SDK for Ruby V3
Scan
Scan
Service: Amazon DynamoDB
The Scan operation returns one or more items and item attributes by accessing every item in a table or a secondary index. To have DynamoDB return fewer items, you can provide a FilterExpression operation.
If the total number of scanned items exceeds the maximum dataset size limit of 1 MB, the scan stops and results are returned to the user as a LastEvaluatedKey value to continue the scan in a subsequent operation. The results also include the number of items exceeding the limit. A scan can result in no table data meeting the filter criteria.
A single Scan operation reads up to the maximum number of items set (if using the Limit parameter) or a maximum of 1 MB of data and then apply any filtering to the results using FilterExpression.
If LastEvaluatedKey is present in the response, you need to paginate the result set. For more information, see Paginating the Results in the Amazon DynamoDB Developer Guide.
Scan operations proceed sequentially; however, for faster performance on a large table or
secondary index, applications can request a parallel Scan operation by providing the Segment and TotalSegments parameters. For more information, see Parallel Scan in the Amazon DynamoDB Developer Guide.
Scan uses eventually consistent reads when accessing the data in a table; therefore, the result set might not include the changes to data in the table immediately before the operation began. If you need a consistent copy of the data, as of the time that the Scan begins, you can set the ConsistentRead parameter to true.
Request Syntax
{ "AttributesToGet": [ "string" ], "ConditionalOperator": "string", "ConsistentRead": boolean, "ExclusiveStartKey": { "string" : {
"ExpressionAttributeNames": { "string" : "string"
},
"ExpressionAttributeValues": { "string" : {
Scan
"FilterExpression": "string", "IndexName": "string",
"Limit": number,
"ProjectionExpression": "string", "ReturnConsumedCapacity": "string", "ScanFilter": {
"Segment": number, "Select": "string", "TableName": "string", "TotalSegments": number }
Request Parameters
The request accepts the following data in JSON format.
NoteIn the following list, the required parameters are described first.
TableName (p. 173)
The name of the table containing the requested items; or, if you provide IndexName, the name of the table to which that index belongs.
Type: String
Length Constraints: Minimum length of 3. Maximum length of 255.
Pattern: [a-zA-Z0-9_.-]+
Required: Yes
Scan
AttributesToGet (p. 173)
This is a legacy parameter. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.
Type: Array of strings
Array Members: Minimum number of 1 item.
Length Constraints: Maximum length of 65535.
Required: No
ConditionalOperator (p. 173)
This is a legacy parameter. Use FilterExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.
Type: String
Valid Values: AND | OR Required: No
ConsistentRead (p. 173)
A Boolean value that determines the read consistency model during the scan:
• If ConsistentRead is false, then the data returned from Scan might not contain the results from other recently completed write operations (PutItem, UpdateItem, or DeleteItem).
• If ConsistentRead is true, then all of the write operations that completed before the Scan began are guaranteed to be contained in the Scan response.
The default setting for ConsistentRead is false.
The ConsistentRead parameter is not supported on global secondary indexes. If you scan a global secondary index with ConsistentRead set to true, you will receive a ValidationException.
Type: Boolean Required: No
ExclusiveStartKey (p. 173)
The primary key of the first item that this operation will evaluate. Use the value that was returned for LastEvaluatedKey in the previous operation.
The data type for ExclusiveStartKey must be String, Number or Binary. No set data types are allowed.
In a parallel scan, a Scan request that includes ExclusiveStartKey must specify the same segment whose previous Scan returned the corresponding value of LastEvaluatedKey.
Type: String to AttributeValue (p. 338) object map Key Length Constraints: Maximum length of 65535.
Required: No
ExpressionAttributeNames (p. 173)
One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames:
• To access an attribute whose name conflicts with a DynamoDB reserved word.
• To create a placeholder for repeating occurrences of an attribute name in an expression.
Scan
• To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
• Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide). To work around this, you could specify the following for ExpressionAttributeNames:
• {"#P":"Percentile"}
You could then use this substitution in an expression, as in this example:
• #P = :val Note
Tokens that begin with the : character are expression attribute values, which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide.
Type: String to string map
Value Length Constraints: Maximum length of 65535.
Required: No
ExpressionAttributeValues (p. 173)
One or more values that can be substituted in an expression.
Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:
Available | Backordered | Discontinued
You would first need to specify ExpressionAttributeValues as follows:
{ ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":
{"S":"Discontinued"} }
You could then use these values in an expression, such as this:
ProductStatus IN (:avail, :back, :disc)
For more information on expression attribute values, see Condition Expressions in the Amazon DynamoDB Developer Guide.
Type: String to AttributeValue (p. 338) object map Required: No
FilterExpression (p. 173)
A string that contains conditions that DynamoDB applies after the Scan operation, but before the data is returned to you. Items that do not satisfy the FilterExpression criteria are not returned.
NoteA FilterExpression is applied after the items have already been read; the process of filtering does not consume any additional read capacity units.
Scan
For more information, see Filter Expressions in the Amazon DynamoDB Developer Guide.
Type: String Required: No IndexName (p. 173)
The name of a secondary index to scan. This index can be any local secondary index or global secondary index. Note that if you use the IndexName parameter, you must also provide TableName.
Type: String
Length Constraints: Minimum length of 3. Maximum length of 255.
Pattern: [a-zA-Z0-9_.-]+
Required: No Limit (p. 173)
The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the number of items up to the limit while processing the results, it stops the operation and returns the matching values up to that point, and a key in LastEvaluatedKey to apply in a subsequent operation, so that you can pick up where you left off. Also, if the processed dataset size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in LastEvaluatedKey to apply in a subsequent operation to continue the operation. For more information, see Working with Queries in the Amazon DynamoDB Developer Guide.
Type: Integer
Valid Range: Minimum value of 1.
Required: No
ProjectionExpression (p. 173)
A string that identifies one or more attributes to retrieve from the specified table or index.
These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.
If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
For more information, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide.
Type: String Required: No
ReturnConsumedCapacity (p. 173)
Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:
• INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed.
Note that some operations, such as GetItem and BatchGetItem, do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).
• TOTAL - The response includes only the aggregate ConsumedCapacity for the operation.
• NONE - No ConsumedCapacity details are included in the response.
Scan
Type: String
Valid Values: INDEXES | TOTAL | NONE Required: No
ScanFilter (p. 173)
This is a legacy parameter. Use FilterExpression instead. For more information, see ScanFilter in the Amazon DynamoDB Developer Guide.
Type: String to Condition (p. 364) object map Key Length Constraints: Maximum length of 65535.
Required: No Segment (p. 173)
For a parallel Scan request, Segment identifies an individual segment to be scanned by an application worker.
Segment IDs are zero-based, so the first segment is always 0. For example, if you want to use four application threads to scan a table or an index, then the first thread specifies a Segment value of 0, the second thread specifies 1, and so on.
The value of LastEvaluatedKey returned from a parallel Scan request must be used as ExclusiveStartKey with the same segment ID in a subsequent Scan operation.
The value for Segment must be greater than or equal to 0, and less than the value provided for TotalSegments.
If you provide Segment, you must also provide TotalSegments.
Type: Integer
Valid Range: Minimum value of 0. Maximum value of 999999.
Required: No Select (p. 173)
The attributes to be returned in the result. You can retrieve all item attributes, specific item
The attributes to be returned in the result. You can retrieve all item attributes, specific item