

# Amazon DynamoDB Streams
<a name="API_Operations_Amazon_DynamoDB_Streams"></a>

The following actions are supported by Amazon DynamoDB Streams:
+  [DescribeStream](API_streams_DescribeStream.md) 
+  [GetRecords](API_streams_GetRecords.md) 
+  [GetShardIterator](API_streams_GetShardIterator.md) 
+  [ListStreams](API_streams_ListStreams.md) 

# DescribeStream
<a name="API_streams_DescribeStream"></a>

Returns information about a stream, including the current status of the stream, its Amazon Resource Name (ARN), the composition of its shards, and its corresponding DynamoDB table.

**Note**  
You can call `DescribeStream` at a maximum rate of 10 times per second.

Each shard in the stream has a `SequenceNumberRange` associated with it. If the `SequenceNumberRange` has a `StartingSequenceNumber` but no `EndingSequenceNumber`, then the shard is still open (able to receive more stream records). If both `StartingSequenceNumber` and `EndingSequenceNumber` are present, then that shard is closed and can no longer receive more data.

## Request Syntax
<a name="API_streams_DescribeStream_RequestSyntax"></a>

```
{
   "ExclusiveStartShardId": "string",
   "Limit": number,
   "ShardFilter": { 
      "ShardId": "string",
      "Type": "string"
   },
   "StreamArn": "string"
}
```

## Request Parameters
<a name="API_streams_DescribeStream_RequestParameters"></a>

The request accepts the following data in JSON format.

**Note**  
In the following list, the required parameters are described first.

 ** [StreamArn](#API_streams_DescribeStream_RequestSyntax) **   <a name="DDB-streams_DescribeStream-request-StreamArn"></a>
The Amazon Resource Name (ARN) for the stream.  
Type: String  
Length Constraints: Minimum length of 37. Maximum length of 1024.  
Required: Yes

 ** [ExclusiveStartShardId](#API_streams_DescribeStream_RequestSyntax) **   <a name="DDB-streams_DescribeStream-request-ExclusiveStartShardId"></a>
The shard ID of the first item that this operation will evaluate. Use the value that was returned for `LastEvaluatedShardId` in the previous operation.   
Type: String  
Length Constraints: Minimum length of 28. Maximum length of 65.  
Required: No

 ** [Limit](#API_streams_DescribeStream_RequestSyntax) **   <a name="DDB-streams_DescribeStream-request-Limit"></a>
The maximum number of shard objects to return. The upper limit is 100.  
Type: Integer  
Valid Range: Minimum value of 1.  
Required: No

 ** [ShardFilter](#API_streams_DescribeStream_RequestSyntax) **   <a name="DDB-streams_DescribeStream-request-ShardFilter"></a>
This optional field contains the filter definition for the `DescribeStream` API.  
Type: [ShardFilter](API_streams_ShardFilter.md) object  
Required: No

## Response Syntax
<a name="API_streams_DescribeStream_ResponseSyntax"></a>

```
{
   "StreamDescription": { 
      "CreationRequestDateTime": number,
      "KeySchema": [ 
         { 
            "AttributeName": "string",
            "KeyType": "string"
         }
      ],
      "LastEvaluatedShardId": "string",
      "Shards": [ 
         { 
            "ParentShardId": "string",
            "SequenceNumberRange": { 
               "EndingSequenceNumber": "string",
               "StartingSequenceNumber": "string"
            },
            "ShardId": "string"
         }
      ],
      "StreamArn": "string",
      "StreamLabel": "string",
      "StreamStatus": "string",
      "StreamViewType": "string",
      "TableName": "string"
   }
}
```

## Response Elements
<a name="API_streams_DescribeStream_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [StreamDescription](#API_streams_DescribeStream_ResponseSyntax) **   <a name="DDB-streams_DescribeStream-response-StreamDescription"></a>
A complete description of the stream, including its creation date and time, the DynamoDB table associated with the stream, the shard IDs within the stream, and the beginning and ending sequence numbers of stream records within the shards.  
Type: [StreamDescription](API_streams_StreamDescription.md) object

## Errors
<a name="API_streams_DescribeStream_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServerError **   
An error occurred on the server side.    
 ** message **   
The server encountered an internal error trying to fulfill the request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The operation tried to access a nonexistent table or index. The resource might not be specified correctly, or its status might not be `ACTIVE`.    
 ** message **   
The resource which is being requested does not exist.
HTTP Status Code: 400

## Examples
<a name="API_streams_DescribeStream_Examples"></a>

### Describe A Stream
<a name="API_streams_DescribeStream_Example_1"></a>

The following sample returns a description of a stream with a given stream ARN. All of the shards in the stream are listed in the response, along with the beginning and ending sequence numbers of stream records within the shards. Note that one of the shards is still open, because it does not have an `EndingSequenceNumber`. 

#### Sample Request
<a name="API_streams_DescribeStream_Example_1_Request"></a>

```
POST / HTTP/1.1
x-amzn-RequestId: <RequestID>
x-amzn-crc32: <CRC32>
Content-Type: application/x-amz-json-1.0
Content-Length: <PayloadSizeBytes>     
X-Amz-Date: <Date> 
X-Amz-Target: DynamoDBStreams_20120810.DescribeStream

{
    "StreamArn": "arn:aws:dynamodb:us-west-2:111122223333:table/Forum/stream/2015-05-20T20:51:10.252"
    "ShardFilter":"{
    "Type": "CHILD_SHARDS", 
    "ShardId": "shardId-00000001741631711871-1f6a72cf"
    }"
}
```

#### Sample Response
<a name="API_streams_DescribeStream_Example_1_Response"></a>

```
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>
 
{
    "StreamDescription": {
        "StreamArn": "arn:aws:dynamodb:us-west-2:111122223333:table/Forum/stream/2015-05-20T20:51:10.252",
        "StreamLabel": "2015-05-20T20:51:10.252",
        "StreamStatus": "ENABLED",
        "StreamViewType": "NEW_AND_OLD_IMAGES",
        "CreationRequestDateTime": "Wed May 20 13:51:10 PDT 2015",
        "TableName": "Forum",
        "KeySchema": [
            {"AttributeName": "ForumName","KeyType": "HASH"},
            {"AttributeName": "Subject","KeyType": "RANGE"}
        ],
        "Shards": [
            {
                "SequenceNumberRange": {
                    "EndingSequenceNumber": "20500000000000000910398",
                    "StartingSequenceNumber": "20500000000000000910398"
                },
                "ShardId": "shardId-00000001414562045508-2bac9cd2"
            },
            {
                "ParentShardId": "shardId-00000001414562045508-2bac9cd2",
                "SequenceNumberRange": {
                    "EndingSequenceNumber": "820400000000000001192334",
                    "StartingSequenceNumber": "820400000000000001192334"
                },
                "ShardId": "shardId-00000001414576573621-f55eea83"
            },
            {
                "ParentShardId": "shardId-00000001414576573621-f55eea83",
                "SequenceNumberRange": {
                    "EndingSequenceNumber": "1683700000000000001135967",
                    "StartingSequenceNumber": "1683700000000000001135967"
                },
                "ShardId": "shardId-00000001414592258131-674fd923"
            },
            {
                "ParentShardId": "shardId-00000001414592258131-674fd923",
                "SequenceNumberRange": {"StartingSequenceNumber": "2574600000000000000935255"},
                "ShardId": "shardId-00000001414608446368-3a1afbaf"
            }
        ],
    }
}
```

## See Also
<a name="API_streams_DescribeStream_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/streams-dynamodb-2012-08-10/DescribeStream) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/streams-dynamodb-2012-08-10/DescribeStream) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/streams-dynamodb-2012-08-10/DescribeStream) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/streams-dynamodb-2012-08-10/DescribeStream) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/streams-dynamodb-2012-08-10/DescribeStream) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/streams-dynamodb-2012-08-10/DescribeStream) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/streams-dynamodb-2012-08-10/DescribeStream) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/streams-dynamodb-2012-08-10/DescribeStream) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/streams-dynamodb-2012-08-10/DescribeStream) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/streams-dynamodb-2012-08-10/DescribeStream) 

# GetRecords
<a name="API_streams_GetRecords"></a>

Retrieves the stream records from a given shard.

Specify a shard iterator using the `ShardIterator` parameter. The shard iterator specifies the position in the shard from which you want to start reading stream records sequentially. If there are no stream records available in the portion of the shard that the iterator points to, `GetRecords` returns an empty list. Note that it might take multiple calls to get to a portion of the shard that contains stream records.

**Note**  
 `GetRecords` can retrieve a maximum of 1 MB of data or 1000 stream records, whichever comes first.

## Request Syntax
<a name="API_streams_GetRecords_RequestSyntax"></a>

```
{
   "Limit": number,
   "ShardIterator": "string"
}
```

## Request Parameters
<a name="API_streams_GetRecords_RequestParameters"></a>

The request accepts the following data in JSON format.

**Note**  
In the following list, the required parameters are described first.

 ** [ShardIterator](#API_streams_GetRecords_RequestSyntax) **   <a name="DDB-streams_GetRecords-request-ShardIterator"></a>
A shard iterator that was retrieved from a previous GetShardIterator operation. This iterator can be used to access the stream records in this shard.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

 ** [Limit](#API_streams_GetRecords_RequestSyntax) **   <a name="DDB-streams_GetRecords-request-Limit"></a>
The maximum number of records to return from the shard. The upper limit is 1000.  
Type: Integer  
Valid Range: Minimum value of 1.  
Required: No

## Response Syntax
<a name="API_streams_GetRecords_ResponseSyntax"></a>

```
{
   "NextShardIterator": "string",
   "Records": [ 
      { 
         "awsRegion": "string",
         "dynamodb": { 
            "ApproximateCreationDateTime": number,
            "Keys": { 
               "string" : { 
                  "B": blob,
                  "BOOL": boolean,
                  "BS": [ blob ],
                  "L": [ 
                     "AttributeValue"
                  ],
                  "M": { 
                     "string" : "AttributeValue"
                  },
                  "N": "string",
                  "NS": [ "string" ],
                  "NULL": boolean,
                  "S": "string",
                  "SS": [ "string" ]
               }
            },
            "NewImage": { 
               "string" : { 
                  "B": blob,
                  "BOOL": boolean,
                  "BS": [ blob ],
                  "L": [ 
                     "AttributeValue"
                  ],
                  "M": { 
                     "string" : "AttributeValue"
                  },
                  "N": "string",
                  "NS": [ "string" ],
                  "NULL": boolean,
                  "S": "string",
                  "SS": [ "string" ]
               }
            },
            "OldImage": { 
               "string" : { 
                  "B": blob,
                  "BOOL": boolean,
                  "BS": [ blob ],
                  "L": [ 
                     "AttributeValue"
                  ],
                  "M": { 
                     "string" : "AttributeValue"
                  },
                  "N": "string",
                  "NS": [ "string" ],
                  "NULL": boolean,
                  "S": "string",
                  "SS": [ "string" ]
               }
            },
            "SequenceNumber": "string",
            "SizeBytes": number,
            "StreamViewType": "string"
         },
         "eventID": "string",
         "eventName": "string",
         "eventSource": "string",
         "eventVersion": "string",
         "userIdentity": { 
            "PrincipalId": "string",
            "Type": "string"
         }
      }
   ]
}
```

## Response Elements
<a name="API_streams_GetRecords_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [NextShardIterator](#API_streams_GetRecords_ResponseSyntax) **   <a name="DDB-streams_GetRecords-response-NextShardIterator"></a>
The next position in the shard from which to start sequentially reading stream records. If set to `null`, the shard has been closed and the requested iterator will not return any more data.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.

 ** [Records](#API_streams_GetRecords_ResponseSyntax) **   <a name="DDB-streams_GetRecords-response-Records"></a>
The stream records from the shard, which were retrieved using the shard iterator.  
Type: Array of [Record](API_streams_Record.md) objects

## Errors
<a name="API_streams_GetRecords_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** ExpiredIteratorException **   
The shard iterator has expired and can no longer be used to retrieve stream records. A shard iterator expires 15 minutes after it is retrieved using the `GetShardIterator` action.    
 ** message **   
The provided iterator exceeds the maximum age allowed.
HTTP Status Code: 400

 ** InternalServerError **   
An error occurred on the server side.    
 ** message **   
The server encountered an internal error trying to fulfill the request.
HTTP Status Code: 500

 ** LimitExceededException **   
There is no limit to the number of daily on-demand backups that can be taken.   
For most purposes, up to 500 simultaneous table operations are allowed per account. These operations include `CreateTable`, `UpdateTable`, `DeleteTable`,`UpdateTimeToLive`, `RestoreTableFromBackup`, and `RestoreTableToPointInTime`.   
When you are creating a table with one or more secondary indexes, you can have up to 250 such requests running at a time. However, if the table or index specifications are complex, then DynamoDB might temporarily reduce the number of concurrent operations.  
When importing into DynamoDB, up to 50 simultaneous import table operations are allowed per account.  
There is a soft account quota of 2,500 tables.  
GetRecords was called with a value of more than 1000 for the limit request parameter.  
More than 2 processes are reading from the same streams shard at the same time. Exceeding this limit may result in request throttling.    
 ** message **   
Too many operations for a given subscriber.
HTTP Status Code: 400

 ** ResourceNotFoundException **   
The operation tried to access a nonexistent table or index. The resource might not be specified correctly, or its status might not be `ACTIVE`.    
 ** message **   
The resource which is being requested does not exist.
HTTP Status Code: 400

 ** TrimmedDataAccessException **   
The operation attempted to read past the oldest stream record in a shard.  
In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose age exceeds this limit are subject to removal (trimming) from the stream. You might receive a TrimmedDataAccessException if:  
+ You request a shard iterator with a sequence number older than the trim point (24 hours).
+ You obtain a shard iterator, but before you use the iterator in a `GetRecords` request, a stream record in the shard exceeds the 24 hour period and is trimmed. This causes the iterator to access a record that no longer exists.  
 ** message **   
"The data you are trying to access has been trimmed.
HTTP Status Code: 400

## Examples
<a name="API_streams_GetRecords_Examples"></a>

### Retrieve stream records from a shard
<a name="API_streams_GetRecords_Example_1"></a>

The following sample retrieves all the stream records from a shard. To do this, it uses a `ShardIterator` that was obtained from a previous `GetShardIterator` call.

#### Sample Request
<a name="API_streams_GetRecords_Example_1_Request"></a>

```
POST / HTTP/1.1
x-amzn-RequestId: <RequestID>
x-amzn-crc32: <CRC32>
Content-Type: application/x-amz-json-1.0
Content-Length: <PayloadSizeBytes>     
X-Amz-Date: <Date> 
X-Amz-Target: DynamoDBStreams_20120810.GetRecords

{
    "ShardIterator": "arn:aws:dynamodb:us-west-2:111122223333:table/Forum/stream/2015-05-20T20:51:10.252|1|AAAAAAAAAAEvJp6D+zaQ...  <remaining characters omitted> ..."
}
```

#### Sample Response
<a name="API_streams_GetRecords_Example_1_Response"></a>

```
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>
 
{
    "NextShardIterator": "arn:aws:dynamodb:us-west-2:111122223333:table/Forum/stream/2015-05-20T20:51:10.252|1|AAAAAAAAAAGQBYshYDEe ... <remaining characters omitted> ...",
    "Records": [
        {
            "awsRegion": "us-west-2",
            "dynamodb": {
                "ApproximateCreationDateTime": 1.46480431E9,
                "Keys": {
                    "ForumName": {"S": "DynamoDB"},
                    "Subject": {"S": "DynamoDB Thread 3"}
                },
                "SequenceNumber": "300000000000000499659",
                "SizeBytes": 41,
                "StreamViewType": "KEYS_ONLY"
            },
            "eventID": "e2fd9c34eff2d779b297b26f5fef4206",
            "eventName": "INSERT",
            "eventSource": "aws:dynamodb",
            "eventVersion": "1.0"
        },
        {
            "awsRegion": "us-west-2",
            "dynamodb": {
                "ApproximateCreationDateTime": 1.46480527E9,
                "Keys": {
                    "ForumName": {"S": "DynamoDB"},
                    "Subject": {"S": "DynamoDB Thread 1"}
                },
                "SequenceNumber": "400000000000000499660",
                "SizeBytes": 41,
                "StreamViewType": "KEYS_ONLY"
            },
            "eventID": "4b25bd0da9a181a155114127e4837252",
            "eventName": "MODIFY",
            "eventSource": "aws:dynamodb",
            "eventVersion": "1.0"
        },
        {
            "awsRegion": "us-west-2",
            "dynamodb": {
                "ApproximateCreationDateTime": 1.46480646E9,
                "Keys": {
                    "ForumName": {"S": "DynamoDB"},
                    "Subject": {"S": "DynamoDB Thread 2"}
                },
                "SequenceNumber": "500000000000000499661",
                "SizeBytes": 41,
                "StreamViewType": "KEYS_ONLY"
            },
            "eventID": "740280c73a3df7842edab3548a1b08ad",
            "eventName": "REMOVE",
            "eventSource": "aws:dynamodb",
            "eventVersion": "1.0"
        }
    ]
}
```

## See Also
<a name="API_streams_GetRecords_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/streams-dynamodb-2012-08-10/GetRecords) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/streams-dynamodb-2012-08-10/GetRecords) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/streams-dynamodb-2012-08-10/GetRecords) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/streams-dynamodb-2012-08-10/GetRecords) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/streams-dynamodb-2012-08-10/GetRecords) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/streams-dynamodb-2012-08-10/GetRecords) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/streams-dynamodb-2012-08-10/GetRecords) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/streams-dynamodb-2012-08-10/GetRecords) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/streams-dynamodb-2012-08-10/GetRecords) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/streams-dynamodb-2012-08-10/GetRecords) 

# GetShardIterator
<a name="API_streams_GetShardIterator"></a>

Returns a shard iterator. A shard iterator provides information about how to retrieve the stream records from within a shard. Use the shard iterator in a subsequent `GetRecords` request to read the stream records from the shard.

**Note**  
A shard iterator expires 15 minutes after it is returned to the requester.

## Request Syntax
<a name="API_streams_GetShardIterator_RequestSyntax"></a>

```
{
   "SequenceNumber": "string",
   "ShardId": "string",
   "ShardIteratorType": "string",
   "StreamArn": "string"
}
```

## Request Parameters
<a name="API_streams_GetShardIterator_RequestParameters"></a>

The request accepts the following data in JSON format.

**Note**  
In the following list, the required parameters are described first.

 ** [ShardId](#API_streams_GetShardIterator_RequestSyntax) **   <a name="DDB-streams_GetShardIterator-request-ShardId"></a>
The identifier of the shard. The iterator will be returned for this shard ID.  
Type: String  
Length Constraints: Minimum length of 28. Maximum length of 65.  
Required: Yes

 ** [ShardIteratorType](#API_streams_GetShardIterator_RequestSyntax) **   <a name="DDB-streams_GetShardIterator-request-ShardIteratorType"></a>
Determines how the shard iterator is used to start reading stream records from the shard:  
+  `AT_SEQUENCE_NUMBER` - Start reading exactly from the position denoted by a specific sequence number.
+  `AFTER_SEQUENCE_NUMBER` - Start reading right after the position denoted by a specific sequence number.
+  `TRIM_HORIZON` - Start reading at the last (untrimmed) stream record, which is the oldest record in the shard. In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose age exceeds this limit are subject to removal (trimming) from the stream.
+  `LATEST` - Start reading just after the most recent stream record in the shard, so that you always read the most recent data in the shard.
Type: String  
Valid Values: `TRIM_HORIZON | LATEST | AT_SEQUENCE_NUMBER | AFTER_SEQUENCE_NUMBER`   
Required: Yes

 ** [StreamArn](#API_streams_GetShardIterator_RequestSyntax) **   <a name="DDB-streams_GetShardIterator-request-StreamArn"></a>
The Amazon Resource Name (ARN) for the stream.  
Type: String  
Length Constraints: Minimum length of 37. Maximum length of 1024.  
Required: Yes

 ** [SequenceNumber](#API_streams_GetShardIterator_RequestSyntax) **   <a name="DDB-streams_GetShardIterator-request-SequenceNumber"></a>
The sequence number of a stream record in the shard from which to start reading.  
Type: String  
Length Constraints: Minimum length of 21. Maximum length of 40.  
Required: No

## Response Syntax
<a name="API_streams_GetShardIterator_ResponseSyntax"></a>

```
{
   "ShardIterator": "string"
}
```

## Response Elements
<a name="API_streams_GetShardIterator_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [ShardIterator](#API_streams_GetShardIterator_ResponseSyntax) **   <a name="DDB-streams_GetShardIterator-response-ShardIterator"></a>
The position in the shard from which to start reading stream records sequentially. A shard iterator specifies this position using the sequence number of a stream record in a shard.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.

## Errors
<a name="API_streams_GetShardIterator_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServerError **   
An error occurred on the server side.    
 ** message **   
The server encountered an internal error trying to fulfill the request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The operation tried to access a nonexistent table or index. The resource might not be specified correctly, or its status might not be `ACTIVE`.    
 ** message **   
The resource which is being requested does not exist.
HTTP Status Code: 400

 ** TrimmedDataAccessException **   
The operation attempted to read past the oldest stream record in a shard.  
In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose age exceeds this limit are subject to removal (trimming) from the stream. You might receive a TrimmedDataAccessException if:  
+ You request a shard iterator with a sequence number older than the trim point (24 hours).
+ You obtain a shard iterator, but before you use the iterator in a `GetRecords` request, a stream record in the shard exceeds the 24 hour period and is trimmed. This causes the iterator to access a record that no longer exists.  
 ** message **   
"The data you are trying to access has been trimmed.
HTTP Status Code: 400

## Examples
<a name="API_streams_GetShardIterator_Examples"></a>

### Retrieve a Shard Iterator For a Stream
<a name="API_streams_GetShardIterator_Example_1"></a>

The following sample returns a shard iterator for the provided stream ARN and shard ID. The shard iterator will allow access to stream records beginning with the given sequence number.

#### Sample Request
<a name="API_streams_GetShardIterator_Example_1_Request"></a>

```
POST / HTTP/1.1
x-amzn-RequestId: <RequestID>
x-amzn-crc32: <CRC32>
Content-Type: application/x-amz-json-1.0
Content-Length: <PayloadSizeBytes>     
X-Amz-Date: <Date> 
X-Amz-Target: DynamoDBStreams_20120810.GetShardIterator

{
    "StreamArn": "arn:aws:dynamodb:us-west-2:111122223333:table/Forum/stream/2015-05-20T20:51:10.252",
    "ShardId": "00000001414576573621-f55eea83",
    "ShardIteratorType": "TRIM_HORIZON"
}
```

#### Sample Response
<a name="API_streams_GetShardIterator_Example_1_Response"></a>

```
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>
 
{         
    "ShardIterator": "arn:aws:dynamodb:us-west-2:111122223333:table/Forum/stream/2015-05-20T20:51:10.252|1|AAAAAAAAAAEvJp6D+zaQ...  <remaining characters omitted> ..."
}
```

## See Also
<a name="API_streams_GetShardIterator_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/streams-dynamodb-2012-08-10/GetShardIterator) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/streams-dynamodb-2012-08-10/GetShardIterator) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/streams-dynamodb-2012-08-10/GetShardIterator) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/streams-dynamodb-2012-08-10/GetShardIterator) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/streams-dynamodb-2012-08-10/GetShardIterator) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/streams-dynamodb-2012-08-10/GetShardIterator) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/streams-dynamodb-2012-08-10/GetShardIterator) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/streams-dynamodb-2012-08-10/GetShardIterator) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/streams-dynamodb-2012-08-10/GetShardIterator) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/streams-dynamodb-2012-08-10/GetShardIterator) 

# ListStreams
<a name="API_streams_ListStreams"></a>

Returns an array of stream ARNs associated with the current account and endpoint. If the `TableName` parameter is present, then `ListStreams` will return only the streams ARNs for that table.

**Note**  
You can call `ListStreams` at a maximum rate of 5 times per second.

## Request Syntax
<a name="API_streams_ListStreams_RequestSyntax"></a>

```
{
   "ExclusiveStartStreamArn": "string",
   "Limit": number,
   "TableName": "string"
}
```

## Request Parameters
<a name="API_streams_ListStreams_RequestParameters"></a>

The request accepts the following data in JSON format.

**Note**  
In the following list, the required parameters are described first.

 ** [ExclusiveStartStreamArn](#API_streams_ListStreams_RequestSyntax) **   <a name="DDB-streams_ListStreams-request-ExclusiveStartStreamArn"></a>
The ARN (Amazon Resource Name) of the first item that this operation will evaluate. Use the value that was returned for `LastEvaluatedStreamArn` in the previous operation.   
Type: String  
Length Constraints: Minimum length of 37. Maximum length of 1024.  
Required: No

 ** [Limit](#API_streams_ListStreams_RequestSyntax) **   <a name="DDB-streams_ListStreams-request-Limit"></a>
The maximum number of streams to return. The upper limit is 100.  
Type: Integer  
Valid Range: Minimum value of 1.  
Required: No

 ** [TableName](#API_streams_ListStreams_RequestSyntax) **   <a name="DDB-streams_ListStreams-request-TableName"></a>
If this parameter is provided, then only the streams associated with this table name are returned.  
Type: String  
Length Constraints: Minimum length of 3. Maximum length of 255.  
Pattern: `[a-zA-Z0-9_.-]+`   
Required: No

## Response Syntax
<a name="API_streams_ListStreams_ResponseSyntax"></a>

```
{
   "LastEvaluatedStreamArn": "string",
   "Streams": [ 
      { 
         "StreamArn": "string",
         "StreamLabel": "string",
         "TableName": "string"
      }
   ]
}
```

## Response Elements
<a name="API_streams_ListStreams_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [LastEvaluatedStreamArn](#API_streams_ListStreams_ResponseSyntax) **   <a name="DDB-streams_ListStreams-response-LastEvaluatedStreamArn"></a>
The stream ARN of the item where the operation stopped, inclusive of the previous result set. Use this value to start a new operation, excluding this value in the new request.  
If `LastEvaluatedStreamArn` is empty, then the "last page" of results has been processed and there is no more data to be retrieved.  
If `LastEvaluatedStreamArn` is not empty, it does not necessarily mean that there is more data in the result set. The only way to know when you have reached the end of the result set is when `LastEvaluatedStreamArn` is empty.  
Type: String  
Length Constraints: Minimum length of 37. Maximum length of 1024.

 ** [Streams](#API_streams_ListStreams_ResponseSyntax) **   <a name="DDB-streams_ListStreams-response-Streams"></a>
A list of stream descriptors associated with the current account and endpoint.  
Type: Array of [Stream](API_streams_Stream.md) objects

## Errors
<a name="API_streams_ListStreams_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServerError **   
An error occurred on the server side.    
 ** message **   
The server encountered an internal error trying to fulfill the request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The operation tried to access a nonexistent table or index. The resource might not be specified correctly, or its status might not be `ACTIVE`.    
 ** message **   
The resource which is being requested does not exist.
HTTP Status Code: 400

## Examples
<a name="API_streams_ListStreams_Examples"></a>

### Retrieve All Stream ARNs
<a name="API_streams_ListStreams_Example_1"></a>

The following sample returns all of the stream ARNs.

#### Sample Request
<a name="API_streams_ListStreams_Example_1_Request"></a>

```
POST / HTTP/1.1
x-amzn-RequestId: <RequestID>
x-amzn-crc32: <CRC32>
Content-Type: application/x-amz-json-1.0
Content-Length: <PayloadSizeBytes>     
X-Amz-Date: <Date> 
X-Amz-Target: DynamoDBStreams_20120810.ListStreams

{}
```

#### Sample Response
<a name="API_streams_ListStreams_Example_1_Response"></a>

```
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>
 
{
    "Streams": [
        {
            "StreamArn": "arn:aws:dynamodb:us-wesst-2:111122223333:table/Forum/stream/2015-05-20T20:51:10.252",
            "TableName": "Forum",
            "StreamLabel": "2015-05-20T20:51:10.252"
        }, 
        {
            "StreamArn": "arn:aws:dynamodb:us-west-2:111122223333:table/Forum/stream/2015-05-20T20:50:02.714",
            "TableName": "Forum",
            "StreamLabel": "2015-05-20T20:50:02.714"
        }, 
        {
            "StreamArn": "arn:aws:dynamodb:us-west-2:111122223333:table/Forum/stream/2015-05-19T23:03:50.641",
            "TableName": "Forum",
            "StreamLabel": "2015-05-19T23:03:50.641"
        }, 
        
        ...remaining output omitted...

    ]
}
```

## See Also
<a name="API_streams_ListStreams_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/streams-dynamodb-2012-08-10/ListStreams) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/streams-dynamodb-2012-08-10/ListStreams) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/streams-dynamodb-2012-08-10/ListStreams) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/streams-dynamodb-2012-08-10/ListStreams) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/streams-dynamodb-2012-08-10/ListStreams) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/streams-dynamodb-2012-08-10/ListStreams) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/streams-dynamodb-2012-08-10/ListStreams) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/streams-dynamodb-2012-08-10/ListStreams) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/streams-dynamodb-2012-08-10/ListStreams) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/streams-dynamodb-2012-08-10/ListStreams) 