Skip to content

Add cross-account SQS support with configuration examples and tests#65

Open
sherwinlu wants to merge 5 commits intomasterfrom
cross_account_support
Open

Add cross-account SQS support with configuration examples and tests#65
sherwinlu wants to merge 5 commits intomasterfrom
cross_account_support

Conversation

@sherwinlu
Copy link
Collaborator

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:

  • Added new configuration settings EB_SQS_CROSS_ACCOUNT_QUEUES and EB_SQS_QUEUE_URLS to allow specifying cross-account queues by account ID/region or by direct URL in both eb_sqs/settings.py and the documentation (README.md, cross_account_example_settings.py). [1] [2] [3]
  • Updated the documentation in README.md and 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:

  • Refactored SqsQueueClient in eb_sqs/aws/sqs_queue_client.py to:
    • Detect full SQS URLs.
    • Resolve queue URLs via direct mapping, cross-account config, or standard naming.
    • Support fetching and caching queues by URL for cross-account access.
    • Ensure correct queue creation and error handling for both same-account and cross-account queues. [1] [2] [3] [4]

Worker and Service Enhancements:

  • Updated worker service logic to resolve queues by full URL, direct URL mapping, or cross-account configuration, ensuring that queue processing works seamlessly across accounts.

Testing:

  • Added a new test script test_cross_account.py to verify cross-account SQS functionality, including URL detection, queue URL generation, and worker service queue resolution.

@sherwinlu sherwinlu requested a review from Copilot January 11, 2026 23:10
@sherwinlu sherwinlu self-assigned this Jan 11, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_QUEUES and EB_SQS_QUEUE_URLS to enable cross-account queue configuration
  • Enhanced queue resolution logic in SqsQueueClient and WorkerService to 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.

@sherwinlu sherwinlu requested a review from Copilot January 11, 2026 23:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sherwinlu sherwinlu requested a review from Copilot January 11, 2026 23:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sherwinlu sherwinlu requested a review from Copilot January 11, 2026 23:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}"
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant