

# RegisterStreamConsumer
<a name="API_RegisterStreamConsumer"></a>

Registers a consumer with a Kinesis data stream. When you use this operation, the consumer you register can then call [SubscribeToShard](API_SubscribeToShard.md) to receive data from the stream using enhanced fan-out, at a rate of up to 2 MiB per second for every shard you subscribe to. This rate is unaffected by the total number of consumers that read from the same stream.

You can add tags to the registered consumer when making a `RegisterStreamConsumer` request by setting the `Tags` parameter. If you pass the `Tags` parameter, in addition to having the `kinesis:RegisterStreamConsumer` permission, you must also have the `kinesis:TagResource` permission for the consumer that will be registered. Tags will take effect from the `CREATING` status of the consumer.

With On-demand Advantage streams, you can register up to 50 consumers per stream to use Enhanced Fan-out. With On-demand Standard and Provisioned streams, you can register up to 20 consumers per stream to use Enhanced Fan-out. A given consumer can only be registered with one stream at a time.

For an example of how to use this operation, see [Enhanced Fan-Out Using the Kinesis Data Streams API](https://docs.aws.amazon.com/streams/latest/dev/building-enhanced-consumers-api.html).

The use of this operation has a limit of five transactions per second per account. Also, only 5 consumers can be created simultaneously. In other words, you cannot have more than 5 consumers in a `CREATING` status at the same time. Registering a 6th consumer while there are 5 in a `CREATING` status results in a `LimitExceededException`.

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

```
{
   "ConsumerName": "string",
   "StreamARN": "string",
   "StreamId": "string",
   "Tags": { 
      "string" : "string" 
   }
}
```

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

The request accepts the following data in JSON format.

 ** [ConsumerName](#API_RegisterStreamConsumer_RequestSyntax) **   <a name="Streams-RegisterStreamConsumer-request-ConsumerName"></a>
For a given Kinesis data stream, each consumer must have a unique name. However, consumer names don't have to be unique across data streams.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `[a-zA-Z0-9_.-]+`   
Required: Yes

 ** [StreamARN](#API_RegisterStreamConsumer_RequestSyntax) **   <a name="Streams-RegisterStreamConsumer-request-StreamARN"></a>
The ARN of the Kinesis data stream that you want to register the consumer with. For more info, see [Amazon Resource Names (ARNs) and AWS Service Namespaces](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-kinesis-streams).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `arn:aws.*:kinesis:.*:\d{12}:stream/\S+`   
Required: Yes

 ** [StreamId](#API_RegisterStreamConsumer_RequestSyntax) **   <a name="Streams-RegisterStreamConsumer-request-StreamId"></a>
Not Implemented. Reserved for future use.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 24.  
Pattern: `[a-z0-9]{20}-[a-z0-9]{3}`   
Required: No

 ** [Tags](#API_RegisterStreamConsumer_RequestSyntax) **   <a name="Streams-RegisterStreamConsumer-request-Tags"></a>
A set of up to 50 key-value pairs. A tag consists of a required key and an optional value.  
Type: String to string map  
Map Entries: Maximum number of 200 items.  
Key Length Constraints: Minimum length of 1. Maximum length of 128.  
Value Length Constraints: Minimum length of 0. Maximum length of 256.  
Required: No

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

```
{
   "Consumer": { 
      "ConsumerARN": "string",
      "ConsumerCreationTimestamp": number,
      "ConsumerName": "string",
      "ConsumerStatus": "string"
   }
}
```

## Response Elements
<a name="API_RegisterStreamConsumer_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.

 ** [Consumer](#API_RegisterStreamConsumer_ResponseSyntax) **   <a name="Streams-RegisterStreamConsumer-response-Consumer"></a>
An object that represents the details of the consumer you registered. When you register a consumer, it gets an ARN that is generated by Kinesis Data Streams.  
Type: [Consumer](API_Consumer.md) object

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

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

 ** InvalidArgumentException **   
A specified parameter exceeds its restrictions, is not supported, or can't be used. For more information, see the returned message.    
 ** message **   
A message that provides information about the error.
HTTP Status Code: 400

 ** LimitExceededException **   
The requested resource exceeds the maximum number allowed, or the number of concurrent stream requests exceeds the maximum number allowed.     
 ** message **   
A message that provides information about the error.
HTTP Status Code: 400

 ** ResourceInUseException **   
The resource is not available for this operation. For successful operation, the resource must be in the `ACTIVE` state.    
 ** message **   
A message that provides information about the error.
HTTP Status Code: 400

 ** ResourceNotFoundException **   
The requested resource could not be found. The stream might not be specified correctly.    
 ** message **   
A message that provides information about the error.
HTTP Status Code: 400

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

### To create a consumer and add tags to it
<a name="API_RegisterStreamConsumer_Example_1"></a>

The following JSON example creates a consumer with the specified tags.

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

```
POST / HTTP/1.1
Host: kinesis.<region>.<domain>
Content-Length: <PayloadSizeBytes>
User-Agent: <UserAgentString>
Content-Type: application/x-amz-json-1.1
Authorization: <AuthParams>
Connection: Keep-Alive 
X-Amz-Date: <Date>
X-Amz-Target: Kinesis_20131202.RegisterStreamConsumer 
{
    "StreamARN": "arn:aws:kinesis:us-east-1:123456789012:/stream/myStream",
    "ConsumerName" : "myConsumer",
    "Tags" : [
     {
       "Key": "Project",
       "Value": "myProject"
     },
     {
       "Key": "Environment",
       "Value": "Production"
     }
   ] 
}
```

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

```
HTTP/1.1 200 OK
x-amzn-RequestId: <RequestId>
Content-Type: application/x-amz-json-1.1
Content-Length: <PayloadSizeBytes>
Date: <Date> 
{
   "Consumer": { 
      "ConsumerARN": "string",
      "ConsumerCreationTimestamp": number,
      "ConsumerName": "string",
      "ConsumerStatus": "string"
   }
}
```

## See Also
<a name="API_RegisterStreamConsumer_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/kinesis-2013-12-02/RegisterStreamConsumer) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/kinesis-2013-12-02/RegisterStreamConsumer) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/kinesis-2013-12-02/RegisterStreamConsumer) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/kinesis-2013-12-02/RegisterStreamConsumer) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/kinesis-2013-12-02/RegisterStreamConsumer) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/kinesis-2013-12-02/RegisterStreamConsumer) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/kinesis-2013-12-02/RegisterStreamConsumer) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/kinesis-2013-12-02/RegisterStreamConsumer) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/kinesis-2013-12-02/RegisterStreamConsumer) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/kinesis-2013-12-02/RegisterStreamConsumer) 