Skip to content
v2.278.0

PortProps Struct ​

Properties to create a port range.

Example ​

ts
// 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 portProps: ec2.PortProps = {
  protocol: ec2.Protocol.ALL,
  stringRepresentation: 'stringRepresentation',

  // the properties below are optional
  fromPort: 123,
  toPort: 123,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2

port_props = ec2.PortProps(
    protocol=ec2.Protocol.ALL,
    string_representation="stringRepresentation",

    # the properties below are optional
    from_port=123,
    to_port=123
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;

PortProps portProps = PortProps.builder()
        .protocol(Protocol.ALL)
        .stringRepresentation("stringRepresentation")

        // the properties below are optional
        .fromPort(123)
        .toPort(123)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;

var portProps = new PortProps {
    Protocol = Protocol.ALL,
    StringRepresentation = "stringRepresentation",

    // the properties below are optional
    FromPort = 123,
    ToPort = 123
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

portProps := &PortProps{
	Protocol: awscdk.Aws_ec2.Protocol_ALL,
	StringRepresentation: jsii.String("stringRepresentation"),

	// the properties below are optional
	FromPort: jsii.Number(123),
	ToPort: jsii.Number(123),
}

Properties ​

fromPortoptionalnumberfrom_portoptionalint | floatfromPortoptionalNumberFromPortoptionaldoubleFromPortoptional*float64 #
The starting port for the range.

Default: Not included in the rule

protocolProtocolprotocolProtocolprotocolProtocolProtocolProtocolProtocolProtocol required #
The protocol for the range.
stringRepresentationstringstring_representationstrstringRepresentationStringStringRepresentationstringStringRepresentation*string required #
String representation for this object.
toPortoptionalnumberto_portoptionalint | floattoPortoptionalNumberToPortoptionaldoubleToPortoptional*float64 #
The ending port for the range.

Default: Not included in the rule