Reputation: 30805
I want to set up an IP address for a security group with CLI. But for some reason AWS throws an error. And the value is just absolutely correct because I'm setting the same value as set there at the time of command execution. What is wrong? Why is this error?
$ aws ec2 authorize-security-group-ingress --protocol tcp --port 22 --cidr 'xx.xx.xxx.xx/32' --group-id sg-xxxxxxxx
An error occurred (InvalidParameterValue) when calling the AuthorizeSecurityGroupIngress operation: CIDR block xx.xx.xxx.xx\32 is malformed
Upvotes: 6
Views: 15832
Reputation: 5
For anyone facing a similar issue in Cloud formation template, I was getting the same error that CIDR block xx.xxx.xx.x/23 is malformed (Service: Ec2, ...
I was trying to split a string xx.xxx.xx.x/24, xx.xxx.xx.x/23
using the Split function however I had the split characters as ","
instead of ", "
(note the extra space).
However in the error logs AWS displayed, it doesn't appear to show the extra space in front of the displayed string.
Upvotes: 0
Reputation: 269470
Your command worked perfectly well for me (substituting an IP address and a security group).
You might want to try it without the single-quotes.
Also, the error with a backslash (CIDR block xx.xx.xxx.xx\32 is malformed
) is a little concerning, as if it has converted your input. I receive exactly the same error if I use a backslash (\
) instead of a forward slash (/
).
Upvotes: 2