Jason Swett
Jason Swett

Reputation: 45074

Get AWS SQS queue URL?

An AWS SQS queue URL looks like this:

sqs.us-east-1.amazonaws.com/1234567890/default_development

And here are the parts broken down:

Always same | Stored in env var | Always same   | ?          | Stored in env var
sqs         | us-east-1         | amazonaws.com | 1234567890 | default_development

So I can reconstruct the queue URL based on things I know except the 1234567890 part.

What is this number and is there a way, if I have my AWS creds in env vars, to get my hands on it without hard-coding another env var?

Upvotes: 4

Views: 32194

Answers (2)

Jason Wadsworth
Jason Wadsworth

Reputation: 8887

If you don't have access to the queue URL directly (e.g. you can get it directly from CloudFormation if you create it there) you can call the GetQueueUrl API. It takes a parameters of the QueueName and optional QueueOwnerAWSAccountId. That would be the preferred method of getting the URL. It is true that the URL is a well formed URL based on the account and region, and I wouldn't expect that to change at this point. It is possible that it would be different in a region like the China regions, or the Gov Cloud regions.

Upvotes: 1

E.J. Brennan
E.J. Brennan

Reputation: 46841

The 1234567890 should be your AWS account number.

http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/ImportantIdentifiers.html

Upvotes: 1

Related Questions