class Peer
| Language | Type name | 
|---|---|
|  .NET | Amazon.CDK.AWS.EC2.Peer | 
|  Go | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#Peer | 
|  Java | software.amazon.awscdk.services.ec2.Peer | 
|  Python | aws_cdk.aws_ec2.Peer | 
|  TypeScript (source) | aws-cdk-lib»aws_ec2»Peer | 
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.
Example
declare const vpc: ec2.Vpc;
const cluster = new msk.Cluster(this, 'Cluster', {
  clusterName: 'myCluster',
  kafkaVersion: msk.KafkaVersion.V4_1_X_KRAFT,
  vpc,
});
cluster.connections.allowFrom(
  ec2.Peer.ipv4('1.2.3.4/8'),
  ec2.Port.tcp(2181),
);
cluster.connections.allowFrom(
  ec2.Peer.ipv4('1.2.3.4/8'),
  ec2.Port.tcp(9094),
);
Initializer
new Peer()
Methods
| Name | Description | 
|---|---|
| static any | Any IPv4 address. | 
| static any | Any IPv6 address. | 
| static ipv4(cidrIp) | Create an IPv4 peer from a CIDR. | 
| static ipv6(cidrIp) | Create an IPv6 peer from a CIDR. | 
| static prefix | A prefix list. | 
| static security | A security group ID. | 
static anyIpv4() 
public static anyIpv4(): IPeer
Returns
Any IPv4 address.
static anyIpv6() 
public static anyIpv6(): IPeer
Returns
Any IPv6 address.
static ipv4(cidrIp)
public static ipv4(cidrIp: string): IPeer
Parameters
- cidrIp string
Returns
Create an IPv4 peer from a CIDR.
static ipv6(cidrIp)
public static ipv6(cidrIp: string): IPeer
Parameters
- cidrIp string
Returns
Create an IPv6 peer from a CIDR.
static prefixList(prefixListId) 
public static prefixList(prefixListId: string): IPeer
Parameters
- prefixListId string
Returns
A prefix list.
static securityGroupId(securityGroupId, sourceSecurityGroupOwnerId?)  
public static securityGroupId(securityGroupId: string, sourceSecurityGroupOwnerId?: string): IPeer
Parameters
- securityGroupId string
- sourceSecurityGroupOwnerId string
Returns
A security group ID.
