failed to satisfy constraint: Member must satisfy regular expression pattern: [\w+=,.@-]+
Asked Answered
A

4

12

I am trying to apply a policy for an identity pool in AWS. I am using awc-cli to set up the policy but it constantly gives me this exception from the title:

An error occurred (InvalidRequestException) when calling the AttachPrincipalPolicy operation: 1 validation error detected: Value ''DeviceShadowPolicy'' at 'policyName' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w+=,.@-]+

This is the command I use:

aws iot attach-principal-policy --policy-name 'DeviceShadowPolicy' --principal 'PRINCIPAL'

I do not understand why do I get this error. Could somebody help me out?

Astred answered 13/10, 2021 at 1:10 Comment(1)
I'd check a couple of things: 1) make sure you have the latest version of awscli and 2) try this operation using the AWS Console, supplying the same policy name (does it work?)Copyist
A
8

Apparently, the answer was that it has to be without the single quotation sign. All the examples I saw had it with a quotation sign but for me it worked without.

Hopefully, that helps somebody.

Astred answered 16/10, 2021 at 15:14 Comment(0)
Y
3

I have this issues when I m using aws cli inside the bash script

The error I has was

An error occurred (ValidationException) when calling the DescribeCertificate operation: 1 validation error detected: Value '"arn:aws:acm:us-east-1:xxxxxxxxxx:certificate/6... (truncated)' at 'certificateArn' failed to satisfy constraint: Member must satisfy regular expression pattern: arn:[\w+=/,.@-]+:acm:[\w+=/,.@-]*:[0-9]+:[\w+=,.@-]+(/[\w+=,.@-]+)*

it turn out the variable I save from the output has double quote which can't be used for the next aws cli

The solution are below:

  1. Try to use --query and --output text when you are suing AWS CLI, it will get the value without the double quote.
  2. Remove the double quote from the script
ARN='"arn:aws:acm:us-east-1:xxxxxxxxxx:certificate/aaaaaaa-bbbbb-ccccc-dddd-fffffffffff"'

echo "${ARN//\"/}"

## Output: arn:aws:acm:us-east-1:xxxxxxxxxx:certificate/aaaaaaa-bbbbb-ccccc-dddd-fffffffffff
Yon answered 20/12, 2022 at 17:59 Comment(0)
B
0

There was a space in client id in my url make sure there is no client_id="%203434..." should be client_id="3434..."

Bespoke answered 11/4, 2023 at 20:27 Comment(0)
O
0

Had a similar issue with a document with special characters in its title (specifically ü). After removing special characters everything worked ok.

Oblast answered 9/7, 2024 at 11:54 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.