I've a script that I'm using to run authorize-security-group-ingress
AWS CLI command.
IP = 10.10.10.10
CIDR = 32
Variable = sudo aws ec2 authorize-security-group-ingress --group-id sg-xxxxxx --ip-permissions FromPort=10,ToPort=23,IpProtocol=tcp,IpRanges='[{CidrIp=$((IP / 32))}]'
$Variable
But I get an error CIDR block $((IP / 32)) is malformed
. I tried changing the $((IP / 32))
block to $IP/32
, ($(IP) / $(CIDR))
but I still seem to get the same error. Can someone tell me what I'm doing wrong? The main issue is converting to a valid IP CIDR.