title: Passing variable to aws cli inline json
body: <p>I wrote a script to create sqs resource on local stack. I wanted to pass a value that I get from one cli command to the next but inside an inline json. Following is the section of the script in question.</p>
  
  <pre><code>arn=$(aws --endpoint-url=http://localhost:4576 sqs get-queue-attributes \
  --queue-url http://localhost:4576/my_dead_letter_queue_url \
  --query 'Attributes.QueueArn' \
  --output text)
  
  aws --endpoint-url=http://localhost:4576 sqs create-queue \
  --queue-name my_queue \
  --attributes \
  '{"RedrivePolicy":"{\"deadLetterTargetArn\":\"$arn\", \"maxReceiveCount\":\"5\"}"}'
  </code></pre>
  
  <p>So I'm trying to pass that "arn" variable but the cli is taking that as a string and trying to find a sqs with url "$arn" and fails. I also tried removing the quote. In that case, the error is malformed string.</p>
  
  <p>Instead of the arn variable, if I use the arn value as string there, it works.</p>
  
  <p>Can someone please show me how to pass that variable inside that inline json if it is possible?</p>
  
  <p>Thank you for reading :)</p>
  
  <p>Shahed</p>