{"id":18573142,"url":"https://github.com/localstack-samples/sample-cdk-event-bridge-microservices","last_synced_at":"2025-05-15T23:12:41.703Z","repository":{"id":242558905,"uuid":"809891697","full_name":"localstack-samples/sample-cdk-event-bridge-microservices","owner":"localstack-samples","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-25T08:36:58.000Z","size":48,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-17T14:44:42.995Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/localstack-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-03T16:42:34.000Z","updated_at":"2024-09-04T14:59:36.000Z","dependencies_parsed_at":"2024-06-03T19:35:22.419Z","dependency_job_id":"e648689a-381c-4e3e-acaa-9fe9a7dcf5fc","html_url":"https://github.com/localstack-samples/sample-cdk-event-bridge-microservices","commit_stats":null,"previous_names":["localstack-samples/sample-cdk-event-bridge-microservices"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-cdk-event-bridge-microservices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-cdk-event-bridge-microservices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-cdk-event-bridge-microservices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-cdk-event-bridge-microservices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/localstack-samples","download_url":"https://codeload.github.com/localstack-samples/sample-cdk-event-bridge-microservices/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254436950,"owners_count":22070949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T23:08:08.576Z","updated_at":"2025-05-15T23:12:41.682Z","avatar_url":"https://github.com/localstack-samples.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CDK deployment of Sample Microservice System of Lambda Functions connected via multiple EventBridge Buses\nLocalStack sample CDK app deploying cross-region and cross-account EventBridge buses and Lambda functions connected to them.\n\n| Key          | Value                                                                                                |\n| ------------ | ---------------------------------------------------------------------------------------------------- |\n| Environment  | \u003cimg src=\"https://img.shields.io/badge/LocalStack-deploys-4D29B4.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAKgAAACoABZrFArwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAALbSURBVHic7ZpNaxNRFIafczNTGIq0G2M7pXWRlRv3Lusf8AMFEQT3guDWhX9BcC/uFAr1B4igLgSF4EYDtsuQ3M5GYrTaj3Tmui2SpMnM3PlK3m1uzjnPw8xw50MoaNrttl+r1e4CNRv1jTG/+v3+c8dG8TSilHoAPLZVX0RYWlraUbYaJI2IuLZ7KKUWCisgq8wF5D1A3rF+EQyCYPHo6Ghh3BrP8wb1en3f9izDYlVAp9O5EkXRB8dxxl7QBoNBpLW+7fv+a5vzDIvVU0BELhpjJrmaK2NMw+YsIxunUaTZbLrdbveZ1vpmGvWyTOJToNlsuqurq1vAdWPMeSDzwzhJEh0Bp+FTmifzxBZQBXiIKaAq8BBDQJXgYUoBVYOHKQRUER4mFFBVeJhAQJXh4QwBVYeHMQJmAR5GCJgVeBgiYJbg4T8BswYPp+4GW63WwvLy8hZwLcd5TudvBj3+OFBIeA4PD596nvc1iiIrD21qtdr+ysrKR8cY42itCwUP0Gg0+sC27T5qb2/vMunB/0ipTmZxfN//orW+BCwmrGV6vd63BP9P2j9WxGbxbrd7B3g14fLfwFsROUlzBmNM33XdR6Meuxfp5eg54IYxJvXCx8fHL4F3w36blTdDI4/0WREwMnMBeQ+Qd+YC8h4g78wF5D1A3rEqwBiT6q4ubpRSI+ewuhP0PO/NwcHBExHJZZ8PICI/e73ep7z6zzNPwWP1djhuOp3OfRG5kLROFEXv19fXP49bU6TbYQDa7XZDRF6kUUtEtoFb49YUbh/gOM7YbwqnyG4URQ/PWlQ4ASllNwzDzY2NDX3WwioKmBgeqidgKnioloCp4aE6AmLBQzUExIaH8gtIBA/lFrCTFB7KK2AnDMOrSeGhnAJSg4fyCUgVHsolIHV4KI8AK/BQDgHW4KH4AqzCQwEfiIRheKKUAvjuuu7m2tpakPdMmcYYI1rre0EQ1LPo9w82qyNziMdZ3AAAAABJRU5ErkJggg==\"\u003e \u003cimg src=\"https://img.shields.io/badge/AWS-deploys-F29100.svg?logo=amazon\"\u003e                                                                                  |\n| Services     | EventBridge, Lambda, SimpleQueueService                                                           |\n| Integrations | CDK                                                                                                  |\n| Categories   | EventDriven                                                                                          |\n| Level        | Intermediate                                                                                         |\n| GitHub       | [Repository link](https://github.com/localstack-samples/sample-cdk-event-bridge-microservices)        |\n\n\n![architecture diagram showing the pipeline including Lambda producers, cross-region / cross-account EventBridge buses and Sqs consumers](architecture-diagram.png)\n\n# Prerequisites\n\n## Required Software\n- Python 3.11\n- node \u003e16\n- Docker\n- AWS CLI\n- AWS CDK\n- LocalStack CLI\n\n\u003cdetails\u003e\n  \u003csummary\u003eif you are on Mac:\u003c/summary\u003e\n\n    1. install python@3.11\n        \n        ```bash\n        brew install pyenv\n        pyenv install 3.11.0\n        ```\n\n    2. install nvm and node \u003e= 16\n    \n        ```bash\n        brew install nvm\n        nvm install 20\n        nvm use 20\n        ```\n    3. install docker\n\n        ```bash\n        brew install docker\n        ```\n\n    4. install aws cli, cdk\n\n        ```bash\n        brew install awscli\n        npm install -g aws-cdk\n        ```\n\n    5. install localstack-cli and cdklocal\n        \n        ```bash\n        brew install localstack/tap/localstack-cli\n        npm install -g aws-cdk-local\n        ```\n\u003c/details\u003e\n\n\n## Setup development environment\nClone the repository and navigate to the project directory.\n    \n```bash\ngit@github.com:localstack-samples/sample-cdk-event-bridge-microservices.git\ncd sample-cdk-event-bridge-microservices\n```\n\nCopy `.env.example` to `.env` and set the environment variables based on your target environment.\nMake sure to setup both accounts you want to deploy to accordingly.\n\n\n\nCreate a virtualenv using python@3.11 and install all the development dependencies there:\n\n```bash\npyenv local 3.11.0\npython -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\n```    \n\n\n# Deployment\n- Configure the AWS CLI for both accounts\n- Set the environment variables in the .env file based on .env.example (if you want to deploy against AWS make sure to set the correct profile names for your aws cli configuration `ACCOUNT_PROFILE_NAME_SECONDARY=\u003cname\u003e` it must be the same as in your `.aws/config` file)\n\n## Deploy the CDK stack\nAgainst AWS\n\n- bootstrapping is required for the first deployment of both accounts and regions\n\n```bash\ncdk bootstrap aws://\u003caccount-id\u003e/\u003cregion\u003e --profile \u003cprofile-name\u003e\n```\n\n- use the Makefile command `deploy-aws` or run the following commands manually\n  \n```bash\ncdk synth\ncdk deploy EventsStackPrimary \ncdk deploy EventsStackSecondaryRegion\ncdk deploy EventsStackSecondaryAccount\n```\n\nAgainst LocalStack\n\n- use the Makefile command `deploy-localstack` or run the following commands manually\n- You need to bootstrap for the desired region and account each time you start LocalStack\n\n```bash\nlocalstack start\ncdklocal synth\ncdklocal bootstrap aws://000000000000/us-east-1\ncdklocal bootstrap aws://000000000000/eu-central-1\ncdklocal bootstrap aws://000000000001/us-east-1\ncdklocal deploy EventsStackPrimary --require-approval never\ncdklocal deploy EventsStackSecondaryRegion --require-approval never\ncdklocal deploy EventsStackSecondaryAccount --require-approval never\n```\n\n\n# Testing\n\n## Run the tests either against AWS or LocalStack\n```bash\nmake test\n```\n\nThis will run a pytest defined in `tests/test_event_bridge_microservice.py`, there are two tests, one for cross-account and one for cross-region EventBridge buses, make sure that the correct stacks are deployed to the correct regions and accounts.\nThe tests will trigger the Lambda functions and assert that the data is being sent to the correct SQS queues.\n\n# Contributing\nWe appreciate your interest in contributing to our project and are always looking for new ways to improve the developer experience.\nWe welcome feedback, bug reports, and even feature ideas from the community. Please refer to the contributing file for more details on how to get started.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack-samples%2Fsample-cdk-event-bridge-microservices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocalstack-samples%2Fsample-cdk-event-bridge-microservices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack-samples%2Fsample-cdk-event-bridge-microservices/lists"}