-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(kinesis): support resource policy for a data stream #31909
Conversation
f2be286
to
07a5140
Compare
07a5140
to
c2d91b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution for this well requested feature @mazyu36! Just a few comments.
```ts | ||
const stream = new kinesis.Stream(this, 'MyStream'); | ||
|
||
// add resource policy | ||
stream.addToResourcePolicy(new iam.PolicyStatement({ | ||
resources: [stream.streamArn], | ||
actions: ['kinesis:GetRecords'], | ||
principals: [new iam.AnyPrincipal()], | ||
})); | ||
``` | ||
|
||
A policy document can also be passed on `ResourcePolicy` construction | ||
|
||
```ts | ||
const stream = new kinesis.Stream(this, 'MyStream'); | ||
|
||
const policyDocument = new iam.PolicyDocument({ | ||
assignSids: true, | ||
statements: [ | ||
new iam.PolicyStatement({ | ||
actions: ['kinesis:GetRecords'], | ||
resources: [stream.streamArn], | ||
principals: [new iam.AnyPrincipal()], | ||
}), | ||
], | ||
}); | ||
|
||
// create resource policy | ||
new kinesis.ResourcePolicy(this, 'ResourcePolicy', { | ||
stream, | ||
policyDocument, | ||
}); | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer to add a couple of sentences explicitly stating that the first example is Creating a ResourcePolicy using
addToResourcePolicyand the second being
Creating a ResourcePolicy manually.
The sentence A policy document can also be passed on
ResourcePolicy construction
is also a little bit confusing, are we saying that you must pass a policy document when manually creating a ResourcePolicy
or that when manually creating a ResourcePolicy
you can optionally pass in your own PolicyDocument
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I've updated.
Co-authored-by: paulhcsun <[email protected]>
Co-authored-by: paulhcsun <[email protected]>
Co-authored-by: paulhcsun <[email protected]>
Pull request has been modified.
@paulhcsun |
@Mergifyio update |
✅ Branch has been successfully updated |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Pull request has been modified.
@Mergifyio update |
✅ Branch has been successfully updated |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Closes #28814 .
Reason for this change
To support resource policy for a Kinesis Data stream.
Description of changes
ResourcePolicy
Construct.addToResourcePolicy
method toStream
Construct.Description of how you validated changes
Add unit tests and integ test.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license