Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(kinesis): add required rights to trigger Lambda from Kinesis. Fixes issue #17312. #17358

Merged
merged 8 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-kinesis/lib/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const READ_OPERATIONS = [
'kinesis:GetShardIterator',
'kinesis:ListShards',
'kinesis:SubscribeToShard',
'kinesis:DescribeStream',
'kinesis:ListStreams',
];

const WRITE_OPERATIONS = [
Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-kinesis/test/integ.stream.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
"kinesis:GetShardIterator",
"kinesis:ListShards",
"kinesis:SubscribeToShard",
"kinesis:DescribeStream",
"kinesis:ListStreams",
"kinesis:PutRecord",
"kinesis:PutRecords"
],
Expand Down
8 changes: 8 additions & 0 deletions packages/@aws-cdk/aws-kinesis/test/stream.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ describe('Kinesis data streams', () => {
'kinesis:GetShardIterator',
'kinesis:ListShards',
'kinesis:SubscribeToShard',
'kinesis:DescribeStream',
'kinesis:ListStreams',
],
Effect: 'Allow',
Resource: {
Expand Down Expand Up @@ -811,6 +813,8 @@ describe('Kinesis data streams', () => {
'kinesis:GetShardIterator',
'kinesis:ListShards',
'kinesis:SubscribeToShard',
'kinesis:DescribeStream',
'kinesis:ListStreams',
'kinesis:PutRecord',
'kinesis:PutRecords',
],
Expand Down Expand Up @@ -884,6 +888,8 @@ describe('Kinesis data streams', () => {
'kinesis:GetShardIterator',
'kinesis:ListShards',
'kinesis:SubscribeToShard',
'kinesis:DescribeStream',
'kinesis:ListStreams',
],
Effect: 'Allow',
Resource: {
Expand Down Expand Up @@ -1050,6 +1056,8 @@ describe('Kinesis data streams', () => {
'kinesis:GetShardIterator',
'kinesis:ListShards',
'kinesis:SubscribeToShard',
'kinesis:DescribeStream',
'kinesis:ListStreams',
'kinesis:PutRecord',
'kinesis:PutRecords',
],
Expand Down
7 changes: 0 additions & 7 deletions packages/@aws-cdk/aws-kinesisfirehose/lib/delivery-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,13 +358,6 @@ export class DeliveryStream extends DeliveryStreamBase {
roleArn: role.roleArn,
} : undefined;
const readStreamGrant = props.sourceStream?.grantRead(role);
/*
* Firehose still uses the deprecated DescribeStream API instead of the modern DescribeStreamSummary API.
* kinesis.IStream.grantRead does not provide DescribeStream permissions so we add it manually here.
*/
if (readStreamGrant && readStreamGrant.principalStatement) {
readStreamGrant.principalStatement.addActions('kinesis:DescribeStream');
}

const destinationConfig = props.destinations[0].bind(this, {});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@
"kinesis:GetShardIterator",
"kinesis:ListShards",
"kinesis:SubscribeToShard",
"kinesis:DescribeStream"
"kinesis:DescribeStream",
"kinesis:ListStreams"
],
"Effect": "Allow",
"Resource": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
"kinesis:GetRecords",
"kinesis:GetShardIterator",
"kinesis:ListShards",
"kinesis:SubscribeToShard"
"kinesis:SubscribeToShard",
"kinesis:DescribeStream",
"kinesis:ListStreams"
],
"Effect": "Allow",
"Resource": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
"kinesis:GetRecords",
"kinesis:GetShardIterator",
"kinesis:ListShards",
"kinesis:SubscribeToShard"
"kinesis:SubscribeToShard",
"kinesis:DescribeStream",
"kinesis:ListStreams"
],
"Effect": "Allow",
"Resource": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ describe('KinesisEventSource', () => {
'kinesis:GetShardIterator',
'kinesis:ListShards',
'kinesis:SubscribeToShard',
'kinesis:DescribeStream',
'kinesis:ListStreams',
],
'Effect': 'Allow',
'Resource': {
Expand Down