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

Method for Retrieving SQS Queue URL from ARN #1145

Closed
anthonybarsotti opened this issue Dec 27, 2016 · 9 comments
Closed

Method for Retrieving SQS Queue URL from ARN #1145

anthonybarsotti opened this issue Dec 27, 2016 · 9 comments

Comments

@anthonybarsotti
Copy link

The SQSClient provides the method getQueueUrl which creates a URL given the Queue's name. However, there is no similar method available to construct the Queue's URL from its ARN, which happens to be returned by other methods such as listSubscriptionsByTopic in the SNSClient.

You can, of course, generate a Queue URL from its ARN manually, but how reliable and future proof is that if it's not part of the SDK itself?

@anthonybarsotti anthonybarsotti changed the title Method for Retrieving SQS Queue Name from ARN Method for Retrieving SQS Queue URL from ARN Dec 28, 2016
@imshashank
Copy link
Contributor

@anthonybarsotti Thank you for the feedback and thoughts!

You are correct that, The getQueueUrl method only accepts Queue's name and will return the queue URL. Also listSubscriptionsByTopic can be used to get url when an arn is passed.

Can you please elaborate on how are you generating the arn manually & also is there a specific reason you need to generate the url using arn as there are other ways like you mentioned of getting the QueueUrl?

@imshashank imshashank added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. enhancement labels Dec 28, 2016
@anthonybarsotti
Copy link
Author

Can you elaborate on how to get the URL from listSubscriptionsByTopic? Currently that method is providing the SQS ARN as the endpoint property of the return value for that function, not the URL.

@imshashank
Copy link
Contributor

@anthonybarsotti Thanks for the reply.

Using method listSubscriptionsByTopic you can get the the subscription's endpoint. It is detailed in our API docs.

To help me better understand your problem, please elaborate which URL you want to get and also it will be helpful to know the reason are you trying to get this.

Thanks.

@cjyclaire cjyclaire added closing-soon This issue will automatically close in 4 days unless further comments are made. and removed response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. enhancement labels Jan 9, 2017
@dbrownxc
Copy link

dbrownxc commented Jan 9, 2017

Caveat. I'n not using this project but I'm interested in the answer to OP question. I am using the SDK for another language, but I'm using the ARN for some technologies (SNS) but the URL for this one (SQS). Since we are trying to generalize and avoid confusion, we are trying to just use ARNs everywhere in our configs. Is there a future proof method for converting the ARN to a URL, or is it subject to change?

@jeskew
Copy link
Contributor

jeskew commented Jan 9, 2017

@dbrownxc SQS's developer guide cautions that you should not create a queue URL on your own, as the format is not guaranteed to remain stable forever. The queue ARN contains the region, AWS account ID, and queue name, which can be used to call the GetQueueUrl operation.

@dbrownxc
Copy link

dbrownxc commented Jan 9, 2017

Perfect, thanks!

@cjyclaire
Copy link
Contributor

Looks like questions have been answered or lacking information for ages, closing, yet feel free to reopen with further contents :)

@Bikeman868
Copy link

Thank you for posting this question. Most of the AWS APIs are very consistent in how you address entities, but SQS is very weak in this regard. The various API methods accept and return either ARNs, queue names or queue URLs seemingly in a random pattern that makes them very difficult to deal with. Eventually I created a data structure within my application that allows me efficiently convert between these three identifiers.
If someone from the SQS team is reading this, please sort out this mess. Thanks.

@diehlaws diehlaws removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Apr 25, 2019
@paddie
Copy link

paddie commented Jul 5, 2019

I'd also add that using the boto3.client("resourcegroupstaggingapi") one really only gets queue arns returned from the API, meaning one has to do expensive additional API-calls and not-delightful string-operations to get the queueName and then the QueueURL.

Having another API endpoint for SQS that took arns would be enormously valuable here from a performance perspective...

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

No branches or pull requests

8 participants