Event Bus and Events
Add an event bus and start sending events to it
Add EventBridge event bus
import { Construct, Stack, StackProps } from "aws-cdk-lib";
import { RestApi } from "aws-cdk-lib/aws-apigateway";
import { EventBus } from "aws-cdk-lib/aws-events";
export class EDAWorkshopStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const eventBus = new EventBus(this, "EDAWorkshopBus-YOUR_USER_NAME", {
eventBusName: "EDAWorkshopBus-YOUR_USER_NAME",
});
const api = new RestApi(this, "EDAWorkshopAPI-YOUR_USER_NAME");
const dearSanta = api.root.addResource("dear-santa");
dearSanta.addMethod("POST");
}
}Permissions
Deploy CDK app
Test API endpoint
Validate API requests
Deploy again
Test again
Last updated