# StreamAttributes

A reference to a stream.

The easiest way to instantiate is to call
`stream.export()`. Then, the consumer can use `Stream.import(this, ref)` and
get a `Stream`.

Used as argument in: [Stream.fromStreamAttributes](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kinesis.Stream.html#fromstreamattributes)

- Source: [`aws-kinesis/lib/stream.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-kinesis/lib/stream.ts#L367)

## Example

TypeScript:

```ts
const importedStream = kinesis.Stream.fromStreamAttributes(this, 'ImportedEncryptedStream', {
  streamArn: 'arn:aws:kinesis:us-east-2:123456789012:stream/f3j09j2230j',
  encryptionKey: kms.Key.fromKeyArn(this, 'key',
    'arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012',
  ),
});
```

Python:

```python
imported_stream = kinesis.Stream.from_stream_attributes(self, "ImportedEncryptedStream",
    stream_arn="arn:aws:kinesis:us-east-2:123456789012:stream/f3j09j2230j",
    encryption_key=kms.Key.from_key_arn(self, "key", "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012")
)
```

Java:

```java
IStream importedStream = Stream.fromStreamAttributes(this, "ImportedEncryptedStream", StreamAttributes.builder()
        .streamArn("arn:aws:kinesis:us-east-2:123456789012:stream/f3j09j2230j")
        .encryptionKey(Key.fromKeyArn(this, "key", "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"))
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var importedStream = Stream.FromStreamAttributes(this, "ImportedEncryptedStream", new StreamAttributes {
    StreamArn = "arn:aws:kinesis:us-east-2:123456789012:stream/f3j09j2230j",
    EncryptionKey = Key.FromKeyArn(this, "key", "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012")
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
importedStream := kinesis.Stream_FromStreamAttributes(this, jsii.String("ImportedEncryptedStream"), &StreamAttributes{
	StreamArn: jsii.String("arn:aws:kinesis:us-east-2:123456789012:stream/f3j09j2230j"),
	EncryptionKey: kms.Key_FromKeyArn(this, jsii.String("key"), jsii.String("arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012")),
})
```

## Properties

- `encryptionKey`: [IKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — The KMS key securing the contents of the stream if encryption is enabled.

  **Default:** No encryption

- `streamArn`: string (required) — The ARN of the stream.
