Skip to content
GitHubXDiscord

EventBus

The EventBus resource lets you manage AWS EventBuses for event-driven architectures, allowing you to receive and process events from various sources.

Create a basic EventBus with a name and a description:

import AWS from "alchemy/aws/control";
const myEventBus = await AWS.Events.EventBus("myEventBus", {
Name: "MyCustomEventBus",
Description: "This EventBus handles custom application events."
});

Configure an EventBus with a policy to control access and a dead-letter queue:

const advancedEventBus = await AWS.Events.EventBus("advancedEventBus", {
Name: "AdvancedEventBus",
Policy: JSON.stringify({
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Principal: {
Service: "lambda.amazonaws.com"
},
Action: "events:PutEvents",
Resource: "*"
}
]
}),
DeadLetterConfig: {
Arn: "arn:aws:sqs:us-west-2:123456789012:myDeadLetterQueue"
}
});

Create an EventBus that specifies an event source name for better event management:

const sourceNameEventBus = await AWS.Events.EventBus("sourceNameEventBus", {
Name: "SourceNameEventBus",
EventSourceName: "com.mycompany.myapp"
});

Set up an EventBus with KMS encryption for enhanced security:

const encryptedEventBus = await AWS.Events.EventBus("encryptedEventBus", {
Name: "EncryptedEventBus",
KmsKeyIdentifier: "arn:aws:kms:us-west-2:123456789012:key/abcd1234-efgh-5678-ijkl-90mnopqrst",
Description: "This EventBus uses KMS for encryption."
});

Create an EventBus with tags for better resource management:

const taggedEventBus = await AWS.Events.EventBus("taggedEventBus", {
Name: "TaggedEventBus",
Tags: [
{
Key: "Environment",
Value: "Production"
},
{
Key: "Project",
Value: "MyApplication"
}
]
});