From 3dcc4e5d3055bce08b88171c5a0f072ca3024ec5 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Mon, 25 May 2026 21:05:35 +0900 Subject: [PATCH 1/9] eventbridge-fan-in-terraform: Update AWS Provider to v6 --- eventbridge-fan-in-terraform/provider.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eventbridge-fan-in-terraform/provider.tf b/eventbridge-fan-in-terraform/provider.tf index ec1976ed2b..8356ec71cb 100644 --- a/eventbridge-fan-in-terraform/provider.tf +++ b/eventbridge-fan-in-terraform/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = "5.9.0" + version = "~> 6.0" } } } @@ -17,4 +17,4 @@ provider "aws" { provider "aws" { region = "us-east-2" alias = "others" -} \ No newline at end of file +} From ef1fb2c8e57de4463d078135d80809f4982296b8 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 9 Aug 2026 17:53:20 +0900 Subject: [PATCH 2/9] eventbridge-fan-in-terraform: Add Eventbus creation steps to README --- eventbridge-fan-in-terraform/README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/eventbridge-fan-in-terraform/README.md b/eventbridge-fan-in-terraform/README.md index 81d585fb17..934b42e0b0 100644 --- a/eventbridge-fan-in-terraform/README.md +++ b/eventbridge-fan-in-terraform/README.md @@ -29,13 +29,19 @@ Important: this application uses various AWS services and there are costs associ ``` 3. In the provider.tf file, add the Regions where the Eventbuses exist in the provider block with alias "others". Also add the Region where you want the central Eventbus to be created in the provider block with alias "central" -4. In the terraform.tfvars file, add the ARNs of the existing Eventbuses you want to aggregate. Note that all of these fan-in Eventbuses should exist in the same Region. +4. If you do not already have Eventbuses to aggregate, create a minimum of 2 Eventbuses in the fan-in Region: + ``` + aws events create-event-bus --name eventBus1 --region us-east-2 + aws events create-event-bus --name eventBus2 --region us-east-2 + ``` + +5. In the terraform.tfvars file, add the ARNs of the existing Eventbuses you want to aggregate. Note that all of these fan-in Eventbuses should exist in the same Region. -5. From the command line, initialize Terraform: +6. From the command line, initialize Terraform: ``` terraform init ``` -6. From the command line, apply the configuration in the main.tf file and follow the prompts: +7. From the command line, apply the configuration in the main.tf file and follow the prompts: ``` terraform apply ``` @@ -60,4 +66,4 @@ Login to the AWS account where the terraform is deployed. Publish an event on an ---- Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. -SPDX-License-Identifier: MIT-0 \ No newline at end of file +SPDX-License-Identifier: MIT-0 From 0ae285782e1aa2a04156a93a5fa3e22a375de66c Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 9 Aug 2026 17:57:17 +0900 Subject: [PATCH 3/9] eventbridge-fan-in-terraform: Replace deprecated is_enabled with state and pin module version --- eventbridge-fan-in-terraform/main.tf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eventbridge-fan-in-terraform/main.tf b/eventbridge-fan-in-terraform/main.tf index 13a3d137b0..e39cef7de9 100644 --- a/eventbridge-fan-in-terraform/main.tf +++ b/eventbridge-fan-in-terraform/main.tf @@ -12,7 +12,7 @@ resource "aws_cloudwatch_event_rule" "ebrule" { local.account_id ] }) - is_enabled = true + state = "ENABLED" } //IAM role and policy for Event rule @@ -95,7 +95,8 @@ module "central_eventbridge" { providers = { aws = aws.central } - source = "terraform-aws-modules/eventbridge/aws" + source = "terraform-aws-modules/eventbridge/aws" + version = "~> 4.3" bus_name = "central-event-bus" From d3b54a927d303ccb5300587e672f79f82ffc2a54 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 9 Aug 2026 18:10:08 +0900 Subject: [PATCH 4/9] eventbridge-fan-in-terraform: Remove unused outputs --- eventbridge-fan-in-terraform/outputs.tf | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/eventbridge-fan-in-terraform/outputs.tf b/eventbridge-fan-in-terraform/outputs.tf index 65d314163d..2df8df9157 100644 --- a/eventbridge-fan-in-terraform/outputs.tf +++ b/eventbridge-fan-in-terraform/outputs.tf @@ -1,15 +1,3 @@ -output "all_rules" { - value = resource.aws_cloudwatch_event_rule.ebrule -} - -output "ebRole" { - value = aws_iam_role.event_bus_invoke_central_event_bus.arn -} - output "central_bus_arn" { value = module.central_eventbridge.eventbridge_bus_arn } - -output "central_bus_rule_arn" { - value = module.central_eventbridge.eventbridge_rule_arns -} \ No newline at end of file From 994c993976c918eae33cd4b4ea9c7f0e0a175823 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 9 Aug 2026 18:11:09 +0900 Subject: [PATCH 5/9] eventbridge-fan-in-terraform: Remove unused Lambda handler stub --- eventbridge-fan-in-terraform/src/app.js | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 eventbridge-fan-in-terraform/src/app.js diff --git a/eventbridge-fan-in-terraform/src/app.js b/eventbridge-fan-in-terraform/src/app.js deleted file mode 100644 index cb3c4d9c1b..0000000000 --- a/eventbridge-fan-in-terraform/src/app.js +++ /dev/null @@ -1,10 +0,0 @@ -/*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: MIT-0 - */ - -'use strict' - -exports.handler = async (event) => { - // Lambda handler code - console.log(JSON.stringify(event, 0, null)) -} \ No newline at end of file From 248274f89ea20467f72daf0f448fce6086430683 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 9 Aug 2026 18:15:00 +0900 Subject: [PATCH 6/9] eventbridge-fan-in-terraform: Fix missing provider aliases causing cross-region errors --- eventbridge-fan-in-terraform/main.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eventbridge-fan-in-terraform/main.tf b/eventbridge-fan-in-terraform/main.tf index e39cef7de9..0ecef95fdd 100644 --- a/eventbridge-fan-in-terraform/main.tf +++ b/eventbridge-fan-in-terraform/main.tf @@ -86,6 +86,7 @@ data "aws_iam_policy_document" "log_policy" { } resource "aws_cloudwatch_log_resource_policy" "log-resource-policy" { + provider = aws.central policy_document = data.aws_iam_policy_document.log_policy.json policy_name = "eventbridge-log-publishing-policy" } @@ -129,6 +130,7 @@ module "central_eventbridge" { //Create targets on each rule to send events to Central Eventbus resource "aws_cloudwatch_event_target" "EBtargets" { + provider = aws.others for_each = tomap(aws_cloudwatch_event_rule.ebrule) event_bus_name = each.key rule = each.value.name From a20a132553a8e188695bfeb8856dc2b578298eef Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 9 Aug 2026 18:20:50 +0900 Subject: [PATCH 7/9] eventbridge-fan-in-terraform: Add testing commands to README --- eventbridge-fan-in-terraform/README.md | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/eventbridge-fan-in-terraform/README.md b/eventbridge-fan-in-terraform/README.md index 934b42e0b0..0aaae29e9b 100644 --- a/eventbridge-fan-in-terraform/README.md +++ b/eventbridge-fan-in-terraform/README.md @@ -54,7 +54,32 @@ This application picks the configurations from terraform.tfvars files to create Note: To test this pattern, you will need a minimum of 2 existing event buses in the fan-in Region. -Login to the AWS account where the terraform is deployed. Publish an event on any of the fan-in Eventbuses. Switch to the Region where the central Eventbus is created and navigate to Cloudwatch logs. You should see the event you published in the log group of the Central Eventbus. +1. Publish a test event on each of the fan-in Eventbuses: + ``` + aws events put-events --region us-east-2 --entries '[ + { + "EventBusName": "eventBus1", + "Source": "demo.test", + "DetailType": "TestEvent", + "Detail": "{\"message\": \"hello from eventBus1\"}" + } + ]' + aws events put-events --region us-east-2 --entries '[ + { + "EventBusName": "eventBus2", + "Source": "demo.test", + "DetailType": "TestEvent", + "Detail": "{\"message\": \"hello from eventBus2\"}" + } + ]' + ``` + Each command should return `"FailedEntryCount": 0`. + +2. After a few seconds, check the log group of the central Eventbus in the central Region: + ``` + aws logs tail /aws/events/central-bus-logs/logs --region ca-central-1 --since 10m + ``` + You should see both published events as JSON, including `"source": "demo.test"` and `"region": "us-east-2"`. You can also view the log group `/aws/events/central-bus-logs/logs` in the Cloudwatch console. ## Cleanup From e1fc64c78f1bd6d28c4fad0b3e7f7805073d9dab Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 9 Aug 2026 18:22:00 +0900 Subject: [PATCH 8/9] eventbridge-fan-in-terraform: Add Eventbus cleanup steps to README --- eventbridge-fan-in-terraform/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eventbridge-fan-in-terraform/README.md b/eventbridge-fan-in-terraform/README.md index 0aaae29e9b..5ef5daf85b 100644 --- a/eventbridge-fan-in-terraform/README.md +++ b/eventbridge-fan-in-terraform/README.md @@ -88,6 +88,11 @@ Note: To test this pattern, you will need a minimum of 2 existing event buses in ``` terraform destroy ``` +2. If you created the Eventbuses in the deployment step 4, delete them: + ``` + aws events delete-event-bus --name eventBus1 --region us-east-2 + aws events delete-event-bus --name eventBus2 --region us-east-2 + ``` ---- Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. From c9eb5fc4a69d2c23193bc8a5efc276af27406dd0 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 9 Aug 2026 18:25:44 +0900 Subject: [PATCH 9/9] eventbridge-fan-in-terraform: Fix service name spelling in README --- eventbridge-fan-in-terraform/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eventbridge-fan-in-terraform/README.md b/eventbridge-fan-in-terraform/README.md index 5ef5daf85b..aee890df23 100644 --- a/eventbridge-fan-in-terraform/README.md +++ b/eventbridge-fan-in-terraform/README.md @@ -1,8 +1,8 @@ -# Amazon Eventbridge Eventbus fan-in to Central Eventbus to different Region +# Amazon EventBridge Eventbus fan-in to Central Eventbus to different Region This pattern demonstrates how to aggregate all your events from multiple Eventbus (in the same Region) to a central Eventbus in a different Region. This allows you to centrally accumulate events coming in from different event sources for downstream consumption. -This pattern is deployed using Terraform to create a central EventBridge bus, Eventbridge rules on fan-in buses and all IAM resources required. The Eventbuses to aggregate can be defined in the `terraform.tfvars` file (sample ARNs is provided, replace with Eventbus ARNs as needed). The provider.tf file also lists the AWS Regions of the fan-in Eventbus and central Eventbus (replace these based on where your Eventbuses exist and where you want your central bus to be created). +This pattern is deployed using Terraform to create a central EventBridge bus, EventBridge rules on fan-in buses and all IAM resources required. The Eventbuses to aggregate can be defined in the `terraform.tfvars` file (sample ARNs is provided, replace with Eventbus ARNs as needed). The provider.tf file also lists the AWS Regions of the fan-in Eventbus and central Eventbus (replace these based on where your Eventbuses exist and where you want your central bus to be created). Note: The pattern assumes you already have a minimum of 2 eventbuses that you want to aggregate onto a central Eventbus (the central bus will be created as part of this deployment). The fan-in Eventbuses can be created manually or using any of the Infrastructure-as-code platforms. @@ -48,7 +48,7 @@ Important: this application uses various AWS services and there are costs associ ## How it works -This application picks the configurations from terraform.tfvars files to create Eventbridge rules on all entered Eventbus for fan-in to a central Eventbus. The terraform creates the rules, along with the required IAM roles and policies and configures the target as the central Eventbus which it also creates. The central Eventbus has a rule that routes all events to a Cloudwatch log group for testing. +This application picks the configurations from terraform.tfvars files to create EventBridge rules on all entered Eventbus for fan-in to a central Eventbus. The terraform creates the rules, along with the required IAM roles and policies and configures the target as the central Eventbus which it also creates. The central Eventbus has a rule that routes all events to a CloudWatch log group for testing. ## Testing @@ -79,7 +79,7 @@ Note: To test this pattern, you will need a minimum of 2 existing event buses in ``` aws logs tail /aws/events/central-bus-logs/logs --region ca-central-1 --since 10m ``` - You should see both published events as JSON, including `"source": "demo.test"` and `"region": "us-east-2"`. You can also view the log group `/aws/events/central-bus-logs/logs` in the Cloudwatch console. + You should see both published events as JSON, including `"source": "demo.test"` and `"region": "us-east-2"`. You can also view the log group `/aws/events/central-bus-logs/logs` in the CloudWatch console. ## Cleanup