Show / Hide Table of Contents

Class Port

Interface for classes that provide the connection-specification parts of a security group rule.

Inheritance
object
Port
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Port : DeputyBase
Syntax (vb)
Public Class Port Inherits DeputyBase
Remarks

ExampleMetadata: infused

Examples
ApplicationLoadBalancer loadBalancer;


            var vpc = new Vpc(this, "MyVPC");
            var fleet = new Fleet(this, "MyProject", new FleetProps {
                ComputeType = FleetComputeType.MEDIUM,
                EnvironmentType = EnvironmentType.LINUX_CONTAINER,
                BaseCapacity = 1,
                Vpc = vpc
            });

            fleet.Connections.AllowTo(loadBalancer, Port.Tcp(443));

            var project = new Project(this, "MyProject", new ProjectProps {
                Environment = new BuildEnvironment {
                    Fleet = fleet
                },
                BuildSpec = BuildSpec.FromObject(new Dictionary<string, object> { })
            });

Synopsis

Constructors

Port(IPortProps)

Interface for classes that provide the connection-specification parts of a security group rule.

Properties

CanInlineRule

Whether the rule containing this port range can be inlined into a securitygroup or not.

DNS_TCP

Well-known DNS port (TCP 53).

DNS_UDP

Well-known DNS port (UDP 53).

HTTP

Well-known HTTP port (TCP 80).

HTTPS

Well-known HTTPS port (TCP 443).

IMAP

Well-known IMAP port (TCP 143).

IMAPS

Well-known IMAPS port (TCP 993).

LDAP

Well-known LDAP port (TCP 389).

MSSQL

Well-known Microsoft SQL Server port (TCP 1433).

MYSQL_AURORA

Well-known MySQL and Aurora port (TCP 3306).

NFS

Well-known NFS port (TCP 2049).

POP3

Well-known POP3 port (TCP 110).

POP3S

Well-known POP3S port (TCP 995).

POSTGRES

Well-known PostgreSQL port (TCP 5432).

RDP

Well-known Microsoft Remote Desktop Protocol port (TCP 3389).

SMB

Well-known SMB port (TCP 445).

SMTP

Well-known SMTP port (TCP 25).

SSH

Well-known SSH port (TCP 22).

Methods

Ah()

A single AH port.

AllIcmp()

All ICMP traffic.

AllIcmpV6()

All ICMPv6 traffic.

AllTcp()

Any TCP traffic.

AllTraffic()

All traffic.

AllUdp()

Any UDP traffic.

Esp()

A single ESP port.

IcmpPing()

ICMP ping (echo) traffic.

IcmpType(double)

All codes for a single ICMP type.

IcmpTypeAndCode(double, double)

A specific combination of ICMP type and code.

Tcp(double)

A single TCP port.

TcpRange(double, double)

A TCP port range.

ToRuleJson()

Produce the ingress/egress rule JSON for the given connection.

ToString()

Interface for classes that provide the connection-specification parts of a security group rule.

Udp(double)

A single UDP port.

UdpRange(double, double)

A UDP port range.

Constructors

Port(IPortProps)

Interface for classes that provide the connection-specification parts of a security group rule.

public Port(IPortProps props)
Parameters
props IPortProps
Remarks

ExampleMetadata: infused

Examples
ApplicationLoadBalancer loadBalancer;


            var vpc = new Vpc(this, "MyVPC");
            var fleet = new Fleet(this, "MyProject", new FleetProps {
                ComputeType = FleetComputeType.MEDIUM,
                EnvironmentType = EnvironmentType.LINUX_CONTAINER,
                BaseCapacity = 1,
                Vpc = vpc
            });

            fleet.Connections.AllowTo(loadBalancer, Port.Tcp(443));

            var project = new Project(this, "MyProject", new ProjectProps {
                Environment = new BuildEnvironment {
                    Fleet = fleet
                },
                BuildSpec = BuildSpec.FromObject(new Dictionary<string, object> { })
            });

Properties

CanInlineRule

Whether the rule containing this port range can be inlined into a securitygroup or not.

public virtual bool CanInlineRule { get; }
Property Value

bool

Remarks

ExampleMetadata: infused

DNS_TCP

Well-known DNS port (TCP 53).

public static Port DNS_TCP { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

DNS_UDP

Well-known DNS port (UDP 53).

public static Port DNS_UDP { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

HTTP

Well-known HTTP port (TCP 80).

public static Port HTTP { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

HTTPS

Well-known HTTPS port (TCP 443).

public static Port HTTPS { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

IMAP

Well-known IMAP port (TCP 143).

public static Port IMAP { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

IMAPS

Well-known IMAPS port (TCP 993).

public static Port IMAPS { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

LDAP

Well-known LDAP port (TCP 389).

public static Port LDAP { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

MSSQL

Well-known Microsoft SQL Server port (TCP 1433).

public static Port MSSQL { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

MYSQL_AURORA

Well-known MySQL and Aurora port (TCP 3306).

public static Port MYSQL_AURORA { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

NFS

Well-known NFS port (TCP 2049).

public static Port NFS { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

POP3

Well-known POP3 port (TCP 110).

public static Port POP3 { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

POP3S

Well-known POP3S port (TCP 995).

public static Port POP3S { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

POSTGRES

Well-known PostgreSQL port (TCP 5432).

public static Port POSTGRES { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

RDP

Well-known Microsoft Remote Desktop Protocol port (TCP 3389).

public static Port RDP { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

SMB

Well-known SMB port (TCP 445).

public static Port SMB { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

SMTP

Well-known SMTP port (TCP 25).

public static Port SMTP { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

SSH

Well-known SSH port (TCP 22).

public static Port SSH { get; }
Property Value

Port

Remarks

ExampleMetadata: infused

Methods

Ah()

A single AH port.

public static Port Ah()
Returns

Port

Remarks

ExampleMetadata: infused

AllIcmp()

All ICMP traffic.

public static Port AllIcmp()
Returns

Port

Remarks

ExampleMetadata: infused

AllIcmpV6()

All ICMPv6 traffic.

public static Port AllIcmpV6()
Returns

Port

Remarks

ExampleMetadata: infused

AllTcp()

Any TCP traffic.

public static Port AllTcp()
Returns

Port

Remarks

ExampleMetadata: infused

AllTraffic()

All traffic.

public static Port AllTraffic()
Returns

Port

Remarks

ExampleMetadata: infused

AllUdp()

Any UDP traffic.

public static Port AllUdp()
Returns

Port

Remarks

ExampleMetadata: infused

Esp()

A single ESP port.

public static Port Esp()
Returns

Port

Remarks

ExampleMetadata: infused

IcmpPing()

ICMP ping (echo) traffic.

public static Port IcmpPing()
Returns

Port

Remarks

ExampleMetadata: infused

IcmpType(double)

All codes for a single ICMP type.

public static Port IcmpType(double type)
Parameters
type double
Returns

Port

Remarks

ExampleMetadata: infused

IcmpTypeAndCode(double, double)

A specific combination of ICMP type and code.

public static Port IcmpTypeAndCode(double type, double code)
Parameters
type double
code double
Returns

Port

Remarks

See: https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml

Tcp(double)

A single TCP port.

public static Port Tcp(double port)
Parameters
port double
Returns

Port

Remarks

ExampleMetadata: infused

TcpRange(double, double)

A TCP port range.

public static Port TcpRange(double startPort, double endPort)
Parameters
startPort double
endPort double
Returns

Port

Remarks

ExampleMetadata: infused

ToRuleJson()

Produce the ingress/egress rule JSON for the given connection.

public virtual object ToRuleJson()
Returns

object

Remarks

ExampleMetadata: infused

ToString()

Interface for classes that provide the connection-specification parts of a security group rule.

public override string ToString()
Returns

string

Remarks

ExampleMetadata: infused

Udp(double)

A single UDP port.

public static Port Udp(double port)
Parameters
port double
Returns

Port

Remarks

ExampleMetadata: infused

UdpRange(double, double)

A UDP port range.

public static Port UdpRange(double startPort, double endPort)
Parameters
startPort double
endPort double
Returns

Port

Remarks

ExampleMetadata: infused

Back to top Generated by DocFX