1
votes

I have an SQS Queue ARN as an input to my CloudFormation template, How do I reference Queue Name or URL from Queue ARN?

In other words, how do I get a CloudFormation Logical Queue from the ARN?(so that I can use GetAtt to reference all the attributes)

1
How is the queue being created? Can you export its name from cloudformation when you create it, then reference it in your other template docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/… - TheClassic
@TheClassic Let's say I do not own the queue, I only am given the Queue ARN - Abhishek

1 Answers

1
votes

Assuming you can't pass in the name from whatever is creating the queue, then you can get the queue name from the arn. Use Fn::Split to split the arn on colons. Then use Fn::Select to select the last string in the list. This will be something like

{ "Fn::Select" : [ "5", { "Fn::Split": [":", {"Fn::Sub": "QueueArn"}]}] }

See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html for a full list of the functions you can use.