Amazon EventBridge custom event bus cross-account sharing with AWS Resource Access Manager

Amazon EventBridge → AWS RAM Resource share → AWS Lambda Consumer function

Share one Amazon EventBridge custom event bus across accounts with AWS RAM. A consumer account subscribes and delivers events to an AWS Lambda function.

An owner account creates an Amazon EventBridge custom event bus, sets its retention period, and shares it with other accounts in the organization using AWS Resource Access Manager (AWS RAM) with the SubscribeOnly managed permission.
A consumer account creates its own subscriber on the shared bus, together with the AWS Lambda function the subscriber invokes, an IAM delivery role, and an Amazon SQS dead-letter queue for failed deliveries. Each consumer owns its subscribers; the bus owner configures no routing on their behalf.
Deploy the single template once per account with the Role parameter set to Owner or Consumer. Publish events with the AWS CLI and confirm delivery in the consumer Lambda's Amazon CloudWatch logs.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/eventbridge-custom-bus-cross-account/python/sam

Deploy

Owner account: sam deploy --stack-name xacct-bus-owner --resolve-s3 --parameter-overrides Role=Owner SharePrincipal=<CONSUMER_ACCOUNT_ID>Consumer account: sam deploy --stack-name xacct-bus-consumer --resolve-s3 --capabilities CAPABILITY_IAM --parameter-overrides Role=Consumer SharedBusArn=<BUS_ARN>


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the consumer stack first, then the owner stack: sam delete in each account.

Created by:

Anusha Ganapuram

Anusha Ganapuram

Technical Account Manager at AWS with deep expertise in serverless and event-driven solutions. Passionate about building scalable, secure and distributed applications that help organizations modernize their infrastructure and accelerate innovation.