Skip to content

Commit 2a06e42

Browse files
committed
Updating README.md
1 parent 23c8f80 commit 2a06e42

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/@aws-cdk/aws-events/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,17 @@ bus.archive('MyArchive', {
186186
retention: cdk.Duration.days(365),
187187
});
188188
```
189+
190+
## Granting PutEvents to an existing EventBus
191+
192+
To import an existing EventBus into your CDK application, use `EventBus.fromEventBusArn` or `EventBus.fromEventBusAttributes`
193+
factory method.
194+
195+
Then, you can use the `grantPut` method to grant `event:PutEvents` to the eventBus.
196+
197+
```ts
198+
const eventBus = EventBus.fromEventBusArn(this, 'ImportedEventBus', 'arn:aws:events:us-east-1:111111111:event-bus/my-event-bus');
199+
200+
// now you can just call methods on the eventbus
201+
eventBus.grantPut(lambdaFunction);
202+
```

0 commit comments

Comments
 (0)