In the navigation pane, choose Security Groups and select the security group.
On the Inbound tab, choose Edit.
In the dialog, choose Add Rule and do the following:
For Type, select the protocol.
If you select a custom TCP or UDP protocol, specify the port range in Port Range.
If you select a custom ICMP protocol, choose the ICMP type name from Protocol, and, if applicable, the code name from Port Range.
For Source, choose one of the following:
Custom: in the provided field, you must specify an IP address in CIDR notation, a CIDR block, or another security group.
Anywhere: automatically adds the 0.0.0.0/0 IPv4 CIDR block. This option enables all traffic of the specified type to reach your instance. This is acceptable for a short time in a test environment, but it's unsafe for production environments. In production, authorize only a specific IP address or range of addresses to access your instance.
Note
If your security group is in a VPC that's enabled for IPv6, the Anywhere option creates two rules—one for IPv4 traffic (0.0.0.0/0) and one for IPv6 traffic (::/0).
My IP: automatically adds the public IPv4 address of your local computer.
For Description, you can optionally specify a description for the rule.
For more information about the types of rules that you can add, see Security Group Rules Reference.
Choose Save.
You can also specify outbound rules. On the Outbound tab, choose Edit, Add Rule, and do the following:
For Type, select the protocol.
If you select a custom TCP or UDP protocol, specify the port range in Port Range.
If you select a custom ICMP protocol, choose the ICMP type name from Protocol, and, if applicable, the code name from Port Range.
For Destination, choose one of the following:
Custom: in the provided field, you must specify an IP address in CIDR notation, a CIDR block, or another security group.
Anywhere: automatically adds the 0.0.0.0/0 IPv4 CIDR block. This option enables outbound traffic to all IP addresses.
Note
If your security group is in a VPC that's enabled for IPv6, the Anywhere option creates two rules—one for IPv4 traffic (0.0.0.0/0) and one for IPv6 traffic (::/0).
My IP: automatically adds the IP address of your local computer.
For Description, you can optionally specify a description for the rule.
Choose Save.