java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.ec2.Port
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-09-24T10:56:31.080Z") @Stability(Stable) public class Port extends software.amazon.jsii.JsiiObject
Interface for classes that provide the connection-specification parts of a security group rule.

Example:

 InstanceType instanceType;
 NatInstanceProviderV2 provider = NatProvider.instanceV2(NatInstanceProps.builder()
         .instanceType(instanceType)
         .defaultAllowedTraffic(NatTrafficDirection.OUTBOUND_ONLY)
         .build());
 Vpc.Builder.create(this, "TheVPC")
         .natGatewayProvider(provider)
         .build();
 provider.connections.allowFrom(Peer.ipv4("1.2.3.4/8"), Port.HTTP);
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A fluent builder for Port.

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Port
    Well-known DNS port (TCP 53).
    static final Port
    Well-known DNS port (UDP 53).
    static final Port
    Well-known HTTP port (TCP 80).
    static final Port
    Well-known HTTPS port (TCP 443).
    static final Port
    Well-known IMAP port (TCP 143).
    static final Port
    Well-known IMAPS port (TCP 993).
    static final Port
    Well-known LDAP port (TCP 389).
    static final Port
    Well-known Microsoft SQL Server port (TCP 1433).
    static final Port
    Well-known MySQL and Aurora port (TCP 3306).
    static final Port
    Well-known NFS port (TCP 2049).
    static final Port
    Well-known POP3 port (TCP 110).
    static final Port
    Well-known POP3S port (TCP 995).
    static final Port
    Well-known PostgreSQL port (TCP 5432).
    static final Port
    Well-known Microsoft Remote Desktop Protocol port (TCP 3389).
    static final Port
    Well-known SMB port (TCP 445).
    static final Port
    Well-known SMTP port (TCP 25).
    static final Port
    Well-known SSH port (TCP 22).
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    Port(PortProps props)
     
    protected
    Port(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    Port(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Port
    ah()
    A single AH port.
    static Port
    All ICMP traffic.
    static Port
    All ICMPv6 traffic.
    static Port
    Any TCP traffic.
    static Port
    All traffic.
    static Port
    Any UDP traffic.
    static Port
    esp()
    A single ESP port.
    Whether the rule containing this port range can be inlined into a securitygroup or not.
    static Port
    ICMP ping (echo) traffic.
    static Port
    All codes for a single ICMP type.
    static Port
    A specific combination of ICMP type and code.
    static Port
    tcp(Number port)
    A single TCP port.
    static Port
    tcpRange(Number startPort, Number endPort)
    A TCP port range.
    Produce the ingress/egress rule JSON for the given connection.
     
    static Port
    udp(Number port)
    A single UDP port.
    static Port
    udpRange(Number startPort, Number endPort)
    A UDP port range.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Field Details

    • DNS_TCP

      @Stability(Stable) public static final Port DNS_TCP
      Well-known DNS port (TCP 53).
    • DNS_UDP

      @Stability(Stable) public static final Port DNS_UDP
      Well-known DNS port (UDP 53).
    • HTTP

      @Stability(Stable) public static final Port HTTP
      Well-known HTTP port (TCP 80).
    • HTTPS

      @Stability(Stable) public static final Port HTTPS
      Well-known HTTPS port (TCP 443).
    • IMAP

      @Stability(Stable) public static final Port IMAP
      Well-known IMAP port (TCP 143).
    • IMAPS

      @Stability(Stable) public static final Port IMAPS
      Well-known IMAPS port (TCP 993).
    • LDAP

      @Stability(Stable) public static final Port LDAP
      Well-known LDAP port (TCP 389).
    • MSSQL

      @Stability(Stable) public static final Port MSSQL
      Well-known Microsoft SQL Server port (TCP 1433).
    • MYSQL_AURORA

      @Stability(Stable) public static final Port MYSQL_AURORA
      Well-known MySQL and Aurora port (TCP 3306).
    • NFS

      @Stability(Stable) public static final Port NFS
      Well-known NFS port (TCP 2049).
    • POP3

      @Stability(Stable) public static final Port POP3
      Well-known POP3 port (TCP 110).
    • POP3_S

      @Stability(Stable) public static final Port POP3_S
      Well-known POP3S port (TCP 995).
    • POSTGRES

      @Stability(Stable) public static final Port POSTGRES
      Well-known PostgreSQL port (TCP 5432).
    • RDP

      @Stability(Stable) public static final Port RDP
      Well-known Microsoft Remote Desktop Protocol port (TCP 3389).
    • SMB

      @Stability(Stable) public static final Port SMB
      Well-known SMB port (TCP 445).
    • SMTP

      @Stability(Stable) public static final Port SMTP
      Well-known SMTP port (TCP 25).
    • SSH

      @Stability(Stable) public static final Port SSH
      Well-known SSH port (TCP 22).
  • Constructor Details

    • Port

      protected Port(software.amazon.jsii.JsiiObjectRef objRef)
    • Port

      protected Port(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Port

      @Stability(Stable) public Port(@NotNull PortProps props)
      Parameters:
      props - This parameter is required.
  • Method Details

    • ah

      @Stability(Stable) @NotNull public static Port ah()
      A single AH port.
    • allIcmp

      @Stability(Stable) @NotNull public static Port allIcmp()
      All ICMP traffic.
    • allIcmpV6

      @Stability(Stable) @NotNull public static Port allIcmpV6()
      All ICMPv6 traffic.
    • allTcp

      @Stability(Stable) @NotNull public static Port allTcp()
      Any TCP traffic.
    • allTraffic

      @Stability(Stable) @NotNull public static Port allTraffic()
      All traffic.
    • allUdp

      @Stability(Stable) @NotNull public static Port allUdp()
      Any UDP traffic.
    • esp

      @Stability(Stable) @NotNull public static Port esp()
      A single ESP port.
    • icmpPing

      @Stability(Stable) @NotNull public static Port icmpPing()
      ICMP ping (echo) traffic.
    • icmpType

      @Stability(Stable) @NotNull public static Port icmpType(@NotNull Number type)
      All codes for a single ICMP type.

      Parameters:
      type - This parameter is required.
    • icmpTypeAndCode

      @Stability(Stable) @NotNull public static Port icmpTypeAndCode(@NotNull Number type, @NotNull Number code)
      A specific combination of ICMP type and code.

      Parameters:
      type - This parameter is required.
      code - This parameter is required.
      See Also:
    • tcp

      @Stability(Stable) @NotNull public static Port tcp(@NotNull Number port)
      A single TCP port.

      Parameters:
      port - This parameter is required.
    • tcpRange

      @Stability(Stable) @NotNull public static Port tcpRange(@NotNull Number startPort, @NotNull Number endPort)
      A TCP port range.

      Parameters:
      startPort - This parameter is required.
      endPort - This parameter is required.
    • udp

      @Stability(Stable) @NotNull public static Port udp(@NotNull Number port)
      A single UDP port.

      Parameters:
      port - This parameter is required.
    • udpRange

      @Stability(Stable) @NotNull public static Port udpRange(@NotNull Number startPort, @NotNull Number endPort)
      A UDP port range.

      Parameters:
      startPort - This parameter is required.
      endPort - This parameter is required.
    • toRuleJson

      @Stability(Stable) @NotNull public Object toRuleJson()
      Produce the ingress/egress rule JSON for the given connection.
    • toString

      @Stability(Stable) @NotNull public String toString()
      Overrides:
      toString in class Object
    • getCanInlineRule

      @Stability(Stable) @NotNull public Boolean getCanInlineRule()
      Whether the rule containing this port range can be inlined into a securitygroup or not.