Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQS Connection fails when using SQS VPC Endpoints #195

Closed
dev-eng1 opened this issue Jan 28, 2021 · 2 comments
Closed

SQS Connection fails when using SQS VPC Endpoints #195

dev-eng1 opened this issue Jan 28, 2021 · 2 comments
Assignees
Labels
customer-submission Issue submitted by customer

Comments

@dev-eng1
Copy link
Contributor

dev-eng1 commented Jan 28, 2021

Describe the bug
When using SQS VPC endpoints there is a feature that means that the SQS client has to be initialised with the correct endpoint as described at boto/boto3#1900, boto/boto3#2172 and others as otherwise it attempts to connect to endpoint URL 'https:<region>.queue.amazonaws.com' which fails rather than the VPC endpoint at https://sqs.\<region>.amazonaws.com

To Reproduce

Create an AWS VPC
Create a private subnet in VPC
Create a SQS endpoint in VPC
Create a SQS queue
Run stream-loader in an EC2 within private subnet and watch it fail connecting to SQS queue

Additional context
The solution is that the correct endpoint domain is already in the SQS queue URL and works whether VPC endpoints are being used or not. So:
self.sqs = boto3.client("sqs")
becomes
import re
...
PATTERN = "^([^/^:]+)/"
...
pat = re.compile(PATTERN)
m = pat.match(URL)
if m is None:
ERROR
self.client = boto3.client(
'sqs',
endpoint = m.group(1)
)

@docktermj
Copy link
Contributor

@dev-eng1 You pull request has been merged in and I've also massaged your code a little. If you are satisfied with the change, go ahead and close this issue. If there's something we've missed, please let us know.

@docktermj docktermj added the waiting-for-customer Customer needs to verify fix or close issue label Feb 18, 2021
@docktermj docktermj mentioned this issue Feb 18, 2021
docktermj added a commit that referenced this issue Feb 18, 2021
@docktermj docktermj mentioned this issue Feb 18, 2021
@docktermj
Copy link
Contributor

@dev-eng1 Let me know if your issue has been addressed. If we don't hear back in 7 days, we'll go ahead and close the issue.

@docktermj docktermj removed the waiting-for-customer Customer needs to verify fix or close issue label Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-submission Issue submitted by customer
Projects
None yet
Development

No branches or pull requests

2 participants