Class Port
Interface for classes that provide the connection-specification parts of a security group rule.
Inheritance
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
InstanceType instanceType;
var provider = NatProvider.InstanceV2(new NatInstanceProps {
InstanceType = instanceType,
DefaultAllowedTraffic = NatTrafficDirection.OUTBOUND_ONLY
});
new Vpc(this, "TheVPC", new VpcProps {
NatGatewayProvider = provider
});
provider.Connections.AllowFrom(Peer.Ipv4("1.2.3.4/8"), Port.HTTP);
Synopsis
Constructors
Port(IPortProps) | |
Port(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Port(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
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() | |
Udp(Double) | A single UDP port. |
UdpRange(Double, Double) | A UDP port range. |
Constructors
Port(IPortProps)
Port(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Port(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Port(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Port(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
CanInlineRule
Whether the rule containing this port range can be inlined into a securitygroup or not.
public virtual bool CanInlineRule { get; }
Property Value
System.Boolean
DNS_TCP
DNS_UDP
HTTP
HTTPS
IMAP
IMAPS
LDAP
MSSQL
Well-known Microsoft SQL Server port (TCP 1433).
public static Port MSSQL { get; }
Property Value
MYSQL_AURORA
Well-known MySQL and Aurora port (TCP 3306).
public static Port MYSQL_AURORA { get; }
Property Value
NFS
POP3
POP3S
POSTGRES
RDP
Well-known Microsoft Remote Desktop Protocol port (TCP 3389).
public static Port RDP { get; }
Property Value
SMB
SMTP
SSH
Methods
Ah()
AllIcmp()
AllIcmpV6()
AllTcp()
AllTraffic()
AllUdp()
Esp()
IcmpPing()
IcmpType(Double)
All codes for a single ICMP type.
public static Port IcmpType(double type)
Parameters
- type System.Double
Returns
IcmpTypeAndCode(Double, Double)
A specific combination of ICMP type and code.
public static Port IcmpTypeAndCode(double type, double code)
Parameters
- type System.Double
- code System.Double
Returns
Remarks
Tcp(Double)
TcpRange(Double, Double)
A TCP port range.
public static Port TcpRange(double startPort, double endPort)
Parameters
- startPort System.Double
- endPort System.Double
Returns
ToRuleJson()
Produce the ingress/egress rule JSON for the given connection.
public virtual object ToRuleJson()
Returns
System.Object
ToString()
public override string ToString()
Returns
System.String
Udp(Double)
UdpRange(Double, Double)
A UDP port range.
public static Port UdpRange(double startPort, double endPort)
Parameters
- startPort System.Double
- endPort System.Double
Returns