aws-cdk-lib.aws_ec2.ConnectionRule

interface ConnectionRule

LanguageType name
.NETAmazon.CDK.AWS.EC2.ConnectionRule
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsec2#ConnectionRule
Javasoftware.amazon.awscdk.services.ec2.ConnectionRule
Pythonaws_cdk.aws_ec2.ConnectionRule
TypeScript (source)aws-cdk-lib » aws_ec2 » ConnectionRule

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
const connectionRule: ec2.ConnectionRule = {
  fromPort: 123,

  // the properties below are optional
  description: 'description',
  protocol: 'protocol',
  toPort: 123,
};

Properties

NameTypeDescription
fromPortnumberStart of port range for the TCP and UDP protocols, or an ICMP type number.
description?stringDescription of this connection.
protocol?stringThe IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers).
toPort?numberEnd of port range for the TCP and UDP protocols, or an ICMP code.

fromPort

Type: number

Start of port range for the TCP and UDP protocols, or an ICMP type number.

If you specify icmp for the IpProtocol property, you can specify -1 as a wildcard (i.e., any ICMP type number).


description?

Type: string (optional, default: No description)

Description of this connection.

It is applied to both the ingress rule and the egress rule.


protocol?

Type: string (optional, default: tcp)

The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers).

Use -1 to specify all protocols. If you specify -1, or a protocol number other than tcp, udp, icmp, or 58 (ICMPv6), traffic on all ports is allowed, regardless of any ports you specify. For tcp, udp, and icmp, you must specify a port range. For protocol 58 (ICMPv6), you can optionally specify a port range; if you don't, traffic for all types and codes is allowed.


toPort?

Type: number (optional, default: If toPort is not specified, it will be the same as fromPort.)

End of port range for the TCP and UDP protocols, or an ICMP code.

If you specify icmp for the IpProtocol property, you can specify -1 as a wildcard (i.e., any ICMP code).