Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 29 additions & 44 deletions packages/@aws-cdk/aws-kinesis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Using the CDK, a new Kinesis stream can be created as part of the stack using th
your own identifier to the stream. If not, CloudFormation will generate a name.

```ts
new Stream(this, "MyFirstStream", {
streamName: "my-awesome-stream"
new kinesis.Stream(this, 'MyFirstStream', {
streamName: 'my-awesome-stream',
});
```

Expand All @@ -44,10 +44,10 @@ to specify how long the data in the shards should remain accessible.
Read more at [Creating and Managing Streams](https://docs.aws.amazon.com/streams/latest/dev/working-with-streams.html)

```ts
new Stream(this, "MyFirstStream", {
streamName: "my-awesome-stream",
new kinesis.Stream(this, 'MyFirstStream', {
streamName: 'my-awesome-stream',
shardCount: 3,
retentionPeriod: Duration.hours(48)
retentionPeriod: Duration.hours(48),
});
```

Expand All @@ -59,28 +59,26 @@ server-side encryption using an AWS KMS key for a specified stream.
Encryption is enabled by default on your stream with the master key owned by Kinesis Data Streams in regions where it is supported.

```ts
new Stream(this, 'MyEncryptedStream');
new kinesis.Stream(this, 'MyEncryptedStream');
```

You can enable encryption on your stream with a user-managed key by specifying the `encryption` property.
A KMS key will be created for you and associated with the stream.

```ts
new Stream(this, "MyEncryptedStream", {
encryption: StreamEncryption.KMS
new kinesis.Stream(this, 'MyEncryptedStream', {
encryption: kinesis.StreamEncryption.KMS,
});
```

You can also supply your own external KMS key to use for stream encryption by specifying the `encryptionKey` property.

```ts
import * as kms from "@aws-cdk/aws-kms";
const key = new kms.Key(this, 'MyKey');

const key = new kms.Key(this, "MyKey");

new Stream(this, "MyEncryptedStream", {
encryption: StreamEncryption.KMS,
encryptionKey: key
new kinesis.Stream(this, 'MyEncryptedStream', {
encryption: kinesis.StreamEncryption.KMS,
encryptionKey: key,
});
```

Expand All @@ -91,32 +89,20 @@ Any Kinesis stream that has been created outside the stack can be imported into
Streams can be imported by their ARN via the `Stream.fromStreamArn()` API

```ts
const stack = new Stack(app, "MyStack");

const importedStream = Stream.fromStreamArn(
stack,
"ImportedStream",
"arn:aws:kinesis:us-east-2:123456789012:stream/f3j09j2230j"
const importedStream = kinesis.Stream.fromStreamArn(this, 'ImportedStream',
'arn:aws:kinesis:us-east-2:123456789012:stream/f3j09j2230j',
);
```

Encrypted Streams can also be imported by their attributes via the `Stream.fromStreamAttributes()` API

```ts
import { Key } from "@aws-cdk/aws-kms";

const stack = new Stack(app, "MyStack");

const importedStream = Stream.fromStreamAttributes(
stack,
"ImportedEncryptedStream",
{
streamArn: "arn:aws:kinesis:us-east-2:123456789012:stream/f3j09j2230j",
encryptionKey: kms.Key.fromKeyArn(
"arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
)
}
);
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',
),
});
```

### Permission Grants
Expand All @@ -138,10 +124,10 @@ If the stream has an encryption key, read permissions will also be granted to th
const lambdaRole = new iam.Role(this, 'Role', {
assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'),
description: 'Example role...',
}
});

const stream = new Stream(this, 'MyEncryptedStream', {
encryption: StreamEncryption.KMS
const stream = new kinesis.Stream(this, 'MyEncryptedStream', {
encryption: kinesis.StreamEncryption.KMS,
});

// give lambda permissions to read stream
Expand All @@ -165,10 +151,10 @@ If the stream has an encryption key, write permissions will also be granted to t
const lambdaRole = new iam.Role(this, 'Role', {
assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'),
description: 'Example role...',
}
});

const stream = new Stream(this, 'MyEncryptedStream', {
encryption: StreamEncryption.KMS
const stream = new kinesis.Stream(this, 'MyEncryptedStream', {
encryption: kinesis.StreamEncryption.KMS,
});

// give lambda permissions to write to stream
Expand All @@ -186,9 +172,9 @@ The following write permissions are provided to a service principal by the `gran
You can add any set of permissions to a stream by calling the `grant()` API.

```ts
const user = new iam.User(stack, 'MyUser');
const user = new iam.User(this, 'MyUser');

const stream = new Stream(stack, 'MyStream');
const stream = new kinesis.Stream(this, 'MyStream');

// give my user permissions to list shards
stream.grant(user, 'kinesis:ListShards');
Expand All @@ -199,7 +185,7 @@ stream.grant(user, 'kinesis:ListShards');
You can use common metrics from your stream to create alarms and/or dashboards. The `stream.metric('MetricName')` method creates a metric with the stream namespace and dimension. You can also use pre-define methods like `stream.metricGetRecordsSuccess()`. To find out more about Kinesis metrics check [Monitoring the Amazon Kinesis Data Streams Service with Amazon CloudWatch](https://docs.aws.amazon.com/streams/latest/dev/monitoring-with-cloudwatch.html).

```ts
const stream = new Stream(stack, 'MyStream');
const stream = new kinesis.Stream(this, 'MyStream');

// Using base metric method passing the metric name
stream.metric('GetRecords.Success');
Expand All @@ -210,4 +196,3 @@ stream.metricGetRecordsSuccess();
// using pre-defined and overriding the statistic
stream.metricGetRecordsSuccess({ statistic: 'Maximum' });
```

9 changes: 8 additions & 1 deletion packages/@aws-cdk/aws-kinesis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@
]
}
},
"projectReferences": true
"projectReferences": true,
"metadata": {
"jsii": {
"rosetta": {
"strict": true
}
}
}
},
"repository": {
"type": "git",
Expand Down
14 changes: 14 additions & 0 deletions packages/@aws-cdk/aws-kinesis/rosetta/default.ts-fixture
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Fixture with packages imported, but nothing else
import { Construct } from 'constructs';
import { Duration, Stack } from '@aws-cdk/core';
import * as kinesis from '@aws-cdk/aws-kinesis';
import * as kms from '@aws-cdk/aws-kms';
import * as iam from '@aws-cdk/aws-iam';

class Fixture extends Stack {
constructor(scope: Construct, id: string) {
super(scope, id);

/// here
}
}
16 changes: 8 additions & 8 deletions packages/@aws-cdk/aws-kinesisanalytics-flink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,17 @@ aws-kinesisanalytics-runtime library to [retrieve these
properties](https://docs.aws.amazon.com/kinesisanalytics/latest/java/how-properties.html#how-properties-access).

```ts
import * as flink from '@aws-cdk/aws-kinesisanalytics-flink';

declare const bucket: s3.Bucket;
const flinkApp = new flink.Application(this, 'Application', {
// ...
propertyGroups: {
FlinkApplicationProperties: {
inputStreamName: 'my-input-kinesis-stream',
outputStreamName: 'my-output-kinesis-stream',
},
},
// ...
runtime: flink.Runtime.FLINK_1_13,
code: flink.ApplicationCode.fromBucket(bucket, 'my-app.jar'),
});
```

Expand All @@ -55,14 +56,13 @@ when the Flink job starts. These include parameters for checkpointing,
snapshotting, monitoring, and parallelism.

```ts
import * as logs from '@aws-cdk/aws-logs';

declare const bucket: s3.Bucket;
const flinkApp = new flink.Application(this, 'Application', {
code: flink.ApplicationCode.fromBucket(bucket, 'my-app.jar'),
runtime: file.Runtime.FLINK_1_13,
runtime: flink.Runtime.FLINK_1_13,
checkpointingEnabled: true, // default is true
checkpointInterval: cdk.Duration.seconds(30), // default is 1 minute
minPauseBetweenCheckpoints: cdk.Duration.seconds(10), // default is 5 seconds
checkpointInterval: Duration.seconds(30), // default is 1 minute
minPauseBetweenCheckpoints: Duration.seconds(10), // default is 5 seconds
logLevel: flink.LogLevel.ERROR, // default is INFO
metricsLevel: flink.MetricsLevel.PARALLELISM, // default is APPLICATION
autoScalingEnabled: false, // default is true
Expand Down
9 changes: 8 additions & 1 deletion packages/@aws-cdk/aws-kinesisanalytics-flink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@
]
}
},
"projectReferences": true
"projectReferences": true,
"metadata": {
"jsii": {
"rosetta": {
"strict": true
}
}
}
},
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Fixture with packages imported, but nothing else
import { Construct } from 'constructs';
import { Duration, Stack } from '@aws-cdk/core';
import * as flink from '@aws-cdk/aws-kinesisanalytics-flink';
import * as logs from '@aws-cdk/aws-logs';
import * as s3 from '@aws-cdk/aws-s3';

class Fixture extends Stack {
constructor(scope: Construct, id: string) {
super(scope, id);

/// here
}
}
9 changes: 8 additions & 1 deletion packages/@aws-cdk/aws-kinesisanalytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@
]
}
},
"projectReferences": true
"projectReferences": true,
"metadata": {
"jsii": {
"rosetta": {
"strict": true
}
}
}
},
"repository": {
"type": "git",
Expand Down
4 changes: 4 additions & 0 deletions packages/@aws-cdk/aws-kinesisfirehose-destinations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ delivery stream. Destinations can be added by specifying the `destinations` prop
defining a delivery stream.

See [Amazon Kinesis Data Firehose module README](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-kinesisfirehose-readme.html) for usage examples.

```ts nofixture
import * as destinations from '@aws-cdk/aws-kinesisfirehose-destinations';
```
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"metadata": {
"jsii": {
"rosetta": {
"strict": false
"strict": true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Fixture with packages imported, but nothing else
import { Construct } from '@aws-cdk/core';
import { S3Bucket } from '@aws-cdk/aws-kinesisfirehose-destinations';
import { Construct } from 'constructs';
import { Stack } from '@aws-cdk/core';
import * as destinations from '@aws-cdk/aws-kinesisfirehose-destinations';

class Fixture extends Construct {
class Fixture extends Stack {
constructor(scope: Construct, id: string) {
super(scope, id);

Expand Down
Loading