Add cross-account SQS support with configuration examples and tests#65
Add cross-account SQS support with configuration examples and tests#65
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds cross-account SQS support, enabling the library to access and process SQS queues from different AWS accounts. The implementation provides two configuration methods: defining cross-account queues via account ID/region or specifying direct queue URLs.
Changes:
- Added new settings
EB_SQS_CROSS_ACCOUNT_QUEUESandEB_SQS_QUEUE_URLSto enable cross-account queue configuration - Enhanced queue resolution logic in
SqsQueueClientandWorkerServiceto detect and handle full SQS URLs and cross-account configurations - Provided comprehensive documentation and example configuration file demonstrating cross-account setup and IAM permissions
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| eb_sqs/settings.py | Adds configuration dictionaries for cross-account queues and direct URL mappings |
| eb_sqs/aws/sqs_queue_client.py | Refactors queue resolution to support URL detection, cross-account configuration, and queue fetching by URL |
| eb_sqs/worker/service.py | Updates worker queue resolution to handle full URLs and cross-account configurations |
| README.md | Adds cross-account SQS documentation with configuration examples, usage patterns, and IAM permission guidance |
| cross_account_example_settings.py | Provides example settings file demonstrating both cross-account configuration methods |
| test_cross_account.py | Adds test script to verify cross-account functionality including URL detection and queue resolution |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…le account IDs in tests
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…and update tests with additional valid URLs
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| account_id = cross_account_config.get('account_id') | ||
| region = cross_account_config.get('region', settings.AWS_REGION) | ||
| actual_queue_name = cross_account_config.get('queue_name', queue_name) | ||
| queue_url = f"https://sqs.{region}.amazonaws.com/{account_id}/{actual_queue_name}" |
There was a problem hiding this comment.
Duplicated URL construction logic exists in both WorkerService.get_queues_by_names and SqsQueueClient._get_queue_url. Consider extracting this into a shared helper function in the settings module or a utility module to ensure consistency and ease of maintenance.
This pull request adds comprehensive cross-account SQS support to the project, enabling the use of SQS queues across different AWS accounts. The main enhancements include new configuration options for specifying cross-account queues, updates to queue resolution logic, and improved documentation and testing to support these features.
Cross-Account SQS Support and Configuration:
EB_SQS_CROSS_ACCOUNT_QUEUESandEB_SQS_QUEUE_URLSto allow specifying cross-account queues by account ID/region or by direct URL in botheb_sqs/settings.pyand the documentation (README.md,cross_account_example_settings.py). [1] [2] [3]README.mdand provided a new example settings file to guide users on configuring and using cross-account queues, including IAM permissions and worker usage examples. [1] [2]Queue Resolution and Client Logic:
SqsQueueClientineb_sqs/aws/sqs_queue_client.pyto:Worker and Service Enhancements:
Testing:
test_cross_account.pyto verify cross-account SQS functionality, including URL detection, queue URL generation, and worker service queue resolution.