Passer au contenu

How do I troubleshoot the Amazon SQS error "Invalid value for the parameter policy"?

Lecture de 3 minute(s)
1

I want to troubleshoot the Amazon Simple Queue Service (Amazon SQS) error "Invalid value for the parameter policy".

Short description

I updated my Amazon SQS queue access policy and received one of the following errors:

"InvalidAttributeValue: Invalid value for the parameter Policy"

-or-

"An error occurred (InvalidAttributeValue) when calling the SetQueueAttributes operation: Invalid value for the parameter Policy."

Resolution

Amazon SQS queue access policy updates

To update SQS queue access policies, use the Amazon SQS console. The SQS access policy update invokes the SetQueueAttributes API.

Confirm that the access policy is valid

Check that the access policy has all the required fields and that the AWS Identity and Access Management (IAM) entities exist. For more information, see IAM JSON policy element reference and IAM policy validation.

To create and test an SQS queue access policy, you can use the AWS Policy Generator. Make sure that the policy is in JSON format.

Confirm that the Principal element value exists and is valid

Make sure that the Principal element exists in the access policy and that the value is valid. The Principal element can use the following values:

principalelement
AWS account and root user"Principal": { "AWS": "arn:aws:iam::AWS-account-ID:root" } or "Principal": { "AWS": "AWS-account-ID" } " }
IAM roles"Principal": { "AWS": "arn:aws:iam::AWS-account-ID:role/role-name" }
Role sessions"Principal": { "AWS": "arn:aws:sts::AWS-account-ID:assumed-role/role-name/role-session-name" }
IAM users"Principal": { "AWS": "arn:aws:iam::AWS-account-ID:user/user-name" }
AWS Security Token Service (AWS STS) federated user"Principal": { "AWS": "arn:aws:sts::AWS-account-ID:federated-user/user-name"
AWS services"Principal": { "Service": "sns.amazonaws.com" }
All principals"Principal" : { "AWS" : "*" }

If your SQS access policy Principal element includes an IAM entity, then make sure that the entity exists before you use the policy. Amazon SQS validates the access policy and checks for the IAM entity. If the IAM entity doesn't exist, then you get an error. To confirm IAM entities, use the GetRole and GetUser APIs.

Note: SQS resource policies can't use AccessKey IDs and instance profiles as the Principal element.

For more information, see AWS JSON policy elements: Principal.

Confirm that the Resource element exists and is valid

Make sure that the Resource element exists in the access policy and that the value is valid.

If you add or update an SQS queue access policy without a resource or with an invalid resource Amazon Resource Name (ARN), then you receive the "InvalidAttributeValue" error.

Related information

How do I grant access to an Amazon SQS queue?

AWS OFFICIELA mis à jour il y a 25 jours
2 Commentaires

Thank you!

The Policy Generator in https://awspolicygen.s3.amazonaws.com/policygen.html (which I found through the official docs) kept generating a policy with:

...
      "Principal": {
        "AWS": [
          "events.amazonaws.com"
        ]
      }
...

i.e. "AWS" instead of "Service". This was rejected by the SQS policy field. Once I changed it to "Service" the policy was accepted.

a répondu il y a 3 ans

This article was reviewed and updated on 2026-10-20.

EXPERT

a répondu il y a 25 jours