TransactGetItems
is a synchronous operation that atomically retrieves multiple items from one or more tables (but not from indexes) in a single account and Region. ATransactGetItems
call can contain up to 25TransactGetItem
objects, each of which contains aGet
structure that specifies an item to retrieve from a table in the account and Region. A call toTransactGetItems
cannot retrieve items from tables in more than one Amazon Web Services account or Region. The aggregate size of the items in the transaction cannot exceed 4 MB.
DynamoDB rejects the entire TransactGetItems
request if any of the following is true:
A conflicting operation is in the process of updating an item to be read.
There is insufficient provisioned capacity for the transaction to be completed.
There is a user error, such as an invalid data format.
The aggregate size of the items in the transaction cannot exceed 4 MB.
See also: AWS API Documentation
See ‘aws help’ for descriptions of global parameters.
transact-get-items
--transact-items <value>
[--return-consumed-capacity <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
--transact-items
(list)
An ordered array of up to 25
TransactGetItem
objects, each of which contains aGet
structure.(structure)
Specifies an item to be retrieved as part of the transaction.
Get -> (structure)
Contains the primary key that identifies the item to get, together with the name of the table that contains the item, and optionally the specific attributes of the item to retrieve.
Key -> (map)
A map of attribute names to
AttributeValue
objects that specifies the primary key of the item to retrieve.key -> (string)
value -> (structure)
Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S -> (string)
An attribute of type String. For example:
"S": "Hello"
N -> (string)
An attribute of type Number. For example:
"N": "123.45"
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B -> (blob)
An attribute of type Binary. For example:
"B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"
SS -> (list)
An attribute of type String Set. For example:
"SS": ["Giraffe", "Hippo" ,"Zebra"]
(string)
NS -> (list)
An attribute of type Number Set. For example:
"NS": ["42.2", "-19", "7.5", "3.14"]
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string)
BS -> (list)
An attribute of type Binary Set. For example:
"BS": ["U3Vubnk=", "UmFpbnk=", "U25vd3k="]
(blob)
M -> (map)
An attribute of type Map. For example:
"M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}
key -> (string)
value -> (structure)
Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S -> (string)
An attribute of type String. For example:
"S": "Hello"
N -> (string)
An attribute of type Number. For example:
"N": "123.45"
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B -> (blob)
An attribute of type Binary. For example:
"B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"
SS -> (list)
An attribute of type String Set. For example:
"SS": ["Giraffe", "Hippo" ,"Zebra"]
(string)
NS -> (list)
An attribute of type Number Set. For example:
"NS": ["42.2", "-19", "7.5", "3.14"]
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string)
BS -> (list)
An attribute of type Binary Set. For example:
"BS": ["U3Vubnk=", "UmFpbnk=", "U25vd3k="]
(blob)
M -> (map)
An attribute of type Map. For example:
"M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}
key -> (string)
( … recursive … )
L -> (list)
An attribute of type List. For example:
"L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"N": "3.14159"}]
( … recursive … )
NULL -> (boolean)
An attribute of type Null. For example:
"NULL": true
BOOL -> (boolean)
An attribute of type Boolean. For example:
"BOOL": true
L -> (list)
An attribute of type List. For example:
"L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"N": "3.14159"}]
(structure)
Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S -> (string)
An attribute of type String. For example:
"S": "Hello"
N -> (string)
An attribute of type Number. For example:
"N": "123.45"
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B -> (blob)
An attribute of type Binary. For example:
"B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"
SS -> (list)
An attribute of type String Set. For example:
"SS": ["Giraffe", "Hippo" ,"Zebra"]
(string)
NS -> (list)
An attribute of type Number Set. For example:
"NS": ["42.2", "-19", "7.5", "3.14"]
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string)
BS -> (list)
An attribute of type Binary Set. For example:
"BS": ["U3Vubnk=", "UmFpbnk=", "U25vd3k="]
(blob)
M -> (map)
An attribute of type Map. For example:
"M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}
key -> (string)
( … recursive … )
L -> (list)
An attribute of type List. For example:
"L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"N": "3.14159"}]
( … recursive … )
NULL -> (boolean)
An attribute of type Null. For example:
"NULL": true
BOOL -> (boolean)
An attribute of type Boolean. For example:
"BOOL": true
NULL -> (boolean)
An attribute of type Null. For example:
"NULL": true
BOOL -> (boolean)
An attribute of type Boolean. For example:
"BOOL": true
TableName -> (string)
The name of the table from which to retrieve the specified item.
ProjectionExpression -> (string)
A string that identifies one or more attributes of the specified item to retrieve from the table. The attributes in the expression must be separated by commas. If no attribute names are specified, then all attributes of the specified item are returned. If any of the requested attributes are not found, they do not appear in the result.
ExpressionAttributeNames -> (map)
One or more substitution tokens for attribute names in the ProjectionExpression parameter.
key -> (string)
value -> (string)
JSON Syntax:
[
{
"Get": {
"Key": {"string": {
"S": "string",
"N": "string",
"B": blob,
"SS": ["string", ...],
"NS": ["string", ...],
"BS": [blob, ...],
"M": {"string": {
"S": "string",
"N": "string",
"B": blob,
"SS": ["string", ...],
"NS": ["string", ...],
"BS": [blob, ...],
"M": {"string": { ... recursive ... }
...},
"L": [
{ ... recursive ... }
...
],
"NULL": true|false,
"BOOL": true|false
}
...},
"L": [
{
"S": "string",
"N": "string",
"B": blob,
"SS": ["string", ...],
"NS": ["string", ...],
"BS": [blob, ...],
"M": {"string": { ... recursive ... }
...},
"L": [
{ ... recursive ... }
...
],
"NULL": true|false,
"BOOL": true|false
}
...
],
"NULL": true|false,
"BOOL": true|false
}
...},
"TableName": "string",
"ProjectionExpression": "string",
"ExpressionAttributeNames": {"string": "string"
...}
}
}
...
]
--return-consumed-capacity
(string)
A value of
TOTAL
causes consumed capacity information to be returned, and a value ofNONE
prevents that information from being returned. No other value is valid.Possible values:
INDEXES
TOTAL
NONE
--cli-input-json
| --cli-input-yaml
(string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton
. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml
.
--generate-cli-skeleton
(string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input
, prints a sample input JSON that can be used as an argument for --cli-input-json
. Similarly, if provided yaml-input
it will print a sample input YAML that can be used with --cli-input-yaml
. If provided with the value output
, it validates the command inputs and returns a sample output JSON for that command.
See ‘aws help’ for descriptions of global parameters.
To retrieve multiple items atomically from one or more tables
The following transact-get-items
example retrieves multiple items atomically.
aws dynamodb transact-get-items \
--transact-items file://transact-items.json \
--return-consumed-capacity TOTAL
Contents of transact-items.json
:
[
{
"Get": {
"Key": {
"Artist": {"S": "Acme Band"},
"SongTitle": {"S": "Happy Day"}
},
"TableName": "MusicCollection"
}
},
{
"Get": {
"Key": {
"Artist": {"S": "No One You Know"},
"SongTitle": {"S": "Call Me Today"}
},
"TableName": "MusicCollection"
}
}
]
Output:
{
"ConsumedCapacity": [
{
"TableName": "MusicCollection",
"CapacityUnits": 4.0,
"ReadCapacityUnits": 4.0
}
],
"Responses": [
{
"Item": {
"AlbumTitle": {
"S": "Songs About Life"
},
"Artist": {
"S": "Acme Band"
},
"SongTitle": {
"S": "Happy Day"
}
}
},
{
"Item": {
"AlbumTitle": {
"S": "Somewhat Famous"
},
"Artist": {
"S": "No One You Know"
},
"SongTitle": {
"S": "Call Me Today"
}
}
}
]
}
For more information, see Managing Complex Workflows with DynamoDB Transactions in the Amazon DynamoDB Developer Guide.
ConsumedCapacity -> (list)
If the ReturnConsumedCapacity value was
TOTAL
, this is an array ofConsumedCapacity
objects, one for each table addressed byTransactGetItem
objects in the TransactItems parameter. TheseConsumedCapacity
objects report the read-capacity units consumed by theTransactGetItems
call in that table.(structure)
The capacity units consumed by an operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation.
ConsumedCapacity
is only returned if the request asked for it. For more information, see Provisioned Throughput in the Amazon DynamoDB Developer Guide .TableName -> (string)
The name of the table that was affected by the operation.
CapacityUnits -> (double)
The total number of capacity units consumed by the operation.
ReadCapacityUnits -> (double)
The total number of read capacity units consumed by the operation.
WriteCapacityUnits -> (double)
The total number of write capacity units consumed by the operation.
Table -> (structure)
The amount of throughput consumed on the table affected by the operation.
ReadCapacityUnits -> (double)
The total number of read capacity units consumed on a table or an index.
WriteCapacityUnits -> (double)
The total number of write capacity units consumed on a table or an index.
CapacityUnits -> (double)
The total number of capacity units consumed on a table or an index.
LocalSecondaryIndexes -> (map)
The amount of throughput consumed on each local index affected by the operation.
key -> (string)
value -> (structure)
Represents the amount of provisioned throughput capacity consumed on a table or an index.
ReadCapacityUnits -> (double)
The total number of read capacity units consumed on a table or an index.
WriteCapacityUnits -> (double)
The total number of write capacity units consumed on a table or an index.
CapacityUnits -> (double)
The total number of capacity units consumed on a table or an index.
GlobalSecondaryIndexes -> (map)
The amount of throughput consumed on each global index affected by the operation.
key -> (string)
value -> (structure)
Represents the amount of provisioned throughput capacity consumed on a table or an index.
ReadCapacityUnits -> (double)
The total number of read capacity units consumed on a table or an index.
WriteCapacityUnits -> (double)
The total number of write capacity units consumed on a table or an index.
CapacityUnits -> (double)
The total number of capacity units consumed on a table or an index.
Responses -> (list)
An ordered array of up to 25
ItemResponse
objects, each of which corresponds to theTransactGetItem
object in the same position in the TransactItems array. EachItemResponse
object contains a Map of the name-value pairs that are the projected attributes of the requested item.If a requested item could not be retrieved, the corresponding
ItemResponse
object is Null, or if the requested item has no projected attributes, the correspondingItemResponse
object is an empty Map.(structure)
Details for the requested item.
Item -> (map)
Map of attribute data consisting of the data type and attribute value.
key -> (string)
value -> (structure)
Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S -> (string)
An attribute of type String. For example:
"S": "Hello"
N -> (string)
An attribute of type Number. For example:
"N": "123.45"
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B -> (blob)
An attribute of type Binary. For example:
"B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"
SS -> (list)
An attribute of type String Set. For example:
"SS": ["Giraffe", "Hippo" ,"Zebra"]
(string)
NS -> (list)
An attribute of type Number Set. For example:
"NS": ["42.2", "-19", "7.5", "3.14"]
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string)
BS -> (list)
An attribute of type Binary Set. For example:
"BS": ["U3Vubnk=", "UmFpbnk=", "U25vd3k="]
(blob)
M -> (map)
An attribute of type Map. For example:
"M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}
key -> (string)
value -> (structure)
Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S -> (string)
An attribute of type String. For example:
"S": "Hello"
N -> (string)
An attribute of type Number. For example:
"N": "123.45"
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B -> (blob)
An attribute of type Binary. For example:
"B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"
SS -> (list)
An attribute of type String Set. For example:
"SS": ["Giraffe", "Hippo" ,"Zebra"]
(string)
NS -> (list)
An attribute of type Number Set. For example:
"NS": ["42.2", "-19", "7.5", "3.14"]
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string)
BS -> (list)
An attribute of type Binary Set. For example:
"BS": ["U3Vubnk=", "UmFpbnk=", "U25vd3k="]
(blob)
M -> (map)
An attribute of type Map. For example:
"M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}
key -> (string)
( … recursive … )
L -> (list)
An attribute of type List. For example:
"L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"N": "3.14159"}]
( … recursive … )
NULL -> (boolean)
An attribute of type Null. For example:
"NULL": true
BOOL -> (boolean)
An attribute of type Boolean. For example:
"BOOL": true
L -> (list)
An attribute of type List. For example:
"L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"N": "3.14159"}]
(structure)
Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S -> (string)
An attribute of type String. For example:
"S": "Hello"
N -> (string)
An attribute of type Number. For example:
"N": "123.45"
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B -> (blob)
An attribute of type Binary. For example:
"B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"
SS -> (list)
An attribute of type String Set. For example:
"SS": ["Giraffe", "Hippo" ,"Zebra"]
(string)
NS -> (list)
An attribute of type Number Set. For example:
"NS": ["42.2", "-19", "7.5", "3.14"]
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string)
BS -> (list)
An attribute of type Binary Set. For example:
"BS": ["U3Vubnk=", "UmFpbnk=", "U25vd3k="]
(blob)
M -> (map)
An attribute of type Map. For example:
"M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}
key -> (string)
( … recursive … )
L -> (list)
An attribute of type List. For example:
"L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"N": "3.14159"}]
( … recursive … )
NULL -> (boolean)
An attribute of type Null. For example:
"NULL": true
BOOL -> (boolean)
An attribute of type Boolean. For example:
"BOOL": true
NULL -> (boolean)
An attribute of type Null. For example:
"NULL": true
BOOL -> (boolean)
An attribute of type Boolean. For example:
"BOOL": true