Class Port
Interface for classes that provide the connection-specification parts of a security group rule.
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
Remarks
ExampleMetadata: infused
DNS_TCP
Well-known DNS port (TCP 53).
public static Port DNS_TCP { get; }
Property Value
Remarks
ExampleMetadata: infused
DNS_UDP
Well-known DNS port (UDP 53).
public static Port DNS_UDP { get; }
Property Value
Remarks
ExampleMetadata: infused
HTTP
Well-known HTTP port (TCP 80).
public static Port HTTP { get; }
Property Value
Remarks
ExampleMetadata: infused
HTTPS
Well-known HTTPS port (TCP 443).
public static Port HTTPS { get; }
Property Value
Remarks
ExampleMetadata: infused
IMAP
Well-known IMAP port (TCP 143).
public static Port IMAP { get; }
Property Value
Remarks
ExampleMetadata: infused
IMAPS
Well-known IMAPS port (TCP 993).
public static Port IMAPS { get; }
Property Value
Remarks
ExampleMetadata: infused
LDAP
Well-known LDAP port (TCP 389).
public static Port LDAP { get; }
Property Value
Remarks
ExampleMetadata: infused
MSSQL
Well-known Microsoft SQL Server port (TCP 1433).
public static Port MSSQL { get; }
Property Value
Remarks
ExampleMetadata: infused
MYSQL_AURORA
Well-known MySQL and Aurora port (TCP 3306).
public static Port MYSQL_AURORA { get; }
Property Value
Remarks
ExampleMetadata: infused
NFS
Well-known NFS port (TCP 2049).
public static Port NFS { get; }
Property Value
Remarks
ExampleMetadata: infused
POP3
Well-known POP3 port (TCP 110).
public static Port POP3 { get; }
Property Value
Remarks
ExampleMetadata: infused
POP3S
Well-known POP3S port (TCP 995).
public static Port POP3S { get; }
Property Value
Remarks
ExampleMetadata: infused
POSTGRES
Well-known PostgreSQL port (TCP 5432).
public static Port POSTGRES { get; }
Property Value
Remarks
ExampleMetadata: infused
RDP
Well-known Microsoft Remote Desktop Protocol port (TCP 3389).
public static Port RDP { get; }
Property Value
Remarks
ExampleMetadata: infused
SMB
Well-known SMB port (TCP 445).
public static Port SMB { get; }
Property Value
Remarks
ExampleMetadata: infused
SMTP
Well-known SMTP port (TCP 25).
public static Port SMTP { get; }
Property Value
Remarks
ExampleMetadata: infused
SSH
Well-known SSH port (TCP 22).
public static Port SSH { get; }
Property Value
Remarks
ExampleMetadata: infused
Methods
Ah()
AllIcmp()
AllIcmpV6()
AllTcp()
AllTraffic()
AllUdp()
Esp()
IcmpPing()
ICMP ping (echo) traffic.
public static Port IcmpPing()
Returns
Remarks
ExampleMetadata: infused
IcmpType(double)
All codes for a single ICMP type.
public static Port IcmpType(double type)
Parameters
- type double
Returns
Remarks
ExampleMetadata: infused
IcmpTypeAndCode(double, double)
A specific combination of ICMP type and code.
public static Port IcmpTypeAndCode(double type, double code)
Parameters
Returns
Remarks
Tcp(double)
A single TCP port.
public static Port Tcp(double port)
Parameters
- port double
Returns
Remarks
ExampleMetadata: infused
TcpRange(double, double)
A TCP port range.
public static Port TcpRange(double startPort, double endPort)
Parameters
Returns
Remarks
ExampleMetadata: infused
ToRuleJson()
Produce the ingress/egress rule JSON for the given connection.
public virtual object ToRuleJson()
Returns
Remarks
ExampleMetadata: infused
ToString()
Interface for classes that provide the connection-specification parts of a security group rule.
public override string ToString()
Returns
Remarks
ExampleMetadata: infused
Udp(double)
A single UDP port.
public static Port Udp(double port)
Parameters
- port double
Returns
Remarks
ExampleMetadata: infused