title: Why does Set-SQSQueueAttribute fail with an 'InvalidOperationException: Invalid value for the parameter Policy' error?
body: <p>Here is my issue, other than being new to AWS. I have been given the task of reproducing our production site that is in US-East-1 to US-West-2 for a DR site. I am running into an issue with creating the SNS alerts. The following code was from an AWS example and using the Policy from our JSON export.  Whenenver I include this into my main PS script, I get the following error:</p>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
    <p>Set-SQSQueueAttribute : Invalid value for the parameter Policy.
    At line:37 char:5
    +     Set-SQSQueueAttribute -QueueUrl $qURL -Attribute @{ Policy=$SNSpo ...
    +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (Amazon.PowerShe...AttributeCmdlet:SetSQSQ 
       ueueAttributeCmdlet) [Set-SQSQueueAttribute], InvalidOperationException
        + FullyQualifiedErrorId : Amazon.SQS.AmazonSQSException,Amazon.PowerShell.Cmdlets.SQS. 
       SetSQSQueueAttributeCmdlet</p>
  </blockquote>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>$qURL = New-SQSQueue -QueueName "Test-Queue"
  $topicARN = New-SNSTopic -Name "Test-Topic" -Region "us-west-2"
  
  $SNSpolicy = @"
  {
       "Version": "2008-10-17",
       "Id": "__default_policy_ID",
       "Statement": [
            {
             "Sid": "__default_policy_ID",
             "Effect": "Allow",
             "Principal": {
                  "AWS": "*"
            },
             "Action": [
                  "SNS:Subscribe",
                  "SNS:ListSubscriptionsByTopic",
                  "SNS:DeleteTopic",
                  "SNS:GetTopicAttributes",
                  "SNS:Publish",
                  "SNS:RemovePermission",
                  "SNS:AddPermission",
                  "SNS:Receive",
                  "SNS:SetTopicAttributes"
             ],
             "Resource": "arn:aws:sqs:us-west-2:123456789012:Test-Queue",
             "Condition": {
                  "StringEquals": {
                       "AWS:SourceOwner": $topicARN
                  }
             }
       ]
  }
  "@
  
  # set the policy
  Set-SQSQueueAttribute -QueueUrl $qURL -Attribute @{ Policy=$SNSpolicy }
  </code></pre>