Peer
- class aws_cdk.aws_ec2.Peer
Bases:
object
Peer object factories (to be used in Security Group management).
The static methods on this object can be used to create peer objects which represent a connection partner in Security Group rules.
Use this object if you need to represent connection partners using plain IP addresses, or a prefix list ID.
If you want to address a connection partner by Security Group, you can just use the Security Group (or the construct that contains a Security Group) directly, as it already implements
IPeer
.- ExampleMetadata:
infused
Example:
# vpc: ec2.Vpc cluster = msk.Cluster(self, "Cluster", cluster_name="myCluster", kafka_version=msk.KafkaVersion.V2_8_1, vpc=vpc ) cluster.connections.allow_from( ec2.Peer.ipv4("1.2.3.4/8"), ec2.Port.tcp(2181)) cluster.connections.allow_from( ec2.Peer.ipv4("1.2.3.4/8"), ec2.Port.tcp(9094))
Static Methods
- classmethod ipv4(cidr_ip)
Create an IPv4 peer from a CIDR.
- Parameters:
cidr_ip (
str
) –- Return type:
- classmethod ipv6(cidr_ip)
Create an IPv6 peer from a CIDR.
- Parameters:
cidr_ip (
str
) –- Return type:
- classmethod prefix_list(prefix_list_id)
A prefix list.
- Parameters:
prefix_list_id (
str
) –- Return type: