How to Fix 'You may not specify a referenced group id for an existing IPv4 CIDR rule'【AWS】
Table Of Contents
How I fixed the AWS security group error 'You may not specify a referenced group id for an existing IPv4 CIDR rule' by adding the rule again as a new row.
Error Message
You may not specify a referenced group id for an existing IPv4 CIDR rule
(My console was in Japanese. The English text above is the message shown in the English console, as quoted in this Classmethod article.)
Solution
Press the Add Rule button again to add a new row, and configure the settings.
Background
Before encountering this error, I was initially specifying an IP address in this field instead of a security group. I removed the IP address and attempted to select a security group, which triggered the error.
Since the error said a referenced group ID can't be specified for an existing IPv4 CIDR rule, I tried specifying the security group as a new entry, which resolved the issue.
I spent around 15 minutes troubleshooting this, so I hope this helps someone.
Reference: Why the Error Occurs
According to Configure security group rules, you can't change the source type of an existing rule. If the source is an IPv4 CIDR block, you can't specify an IPv6 CIDR block, a prefix list, or a security group. That seems to be why editing the same row fails while adding a new rule works. You may also want to delete the old row if you no longer need it.




