Port¶
-
class
aws_cdk.aws_ec2.
Port
(*, protocol, string_representation, from_port=None, to_port=None)¶ Bases:
object
Interface for classes that provide the connection-specification parts of a security group rule.
- ExampleMetadata
infused
Example:
# load_balancer: elbv2.ApplicationLoadBalancer vpc = ec2.Vpc(self, "MyVPC") project = codebuild.Project(self, "MyProject", vpc=vpc, build_spec=codebuild.BuildSpec.from_object({}) ) project.connections.allow_to(load_balancer, ec2.Port.tcp(443))
- Parameters
protocol (
Protocol
) – The protocol for the range.string_representation (
str
) – String representation for this object.from_port (
Union
[int
,float
,None
]) – The starting port for the range. Default: - Not included in the ruleto_port (
Union
[int
,float
,None
]) – The ending port for the range. Default: - Not included in the rule
Methods
-
to_rule_json
()¶ Produce the ingress/egress rule JSON for the given connection.
- Return type
Any
-
to_string
()¶ - Return type
str
Attributes
-
can_inline_rule
¶ Whether the rule containing this port range can be inlined into a securitygroup or not.
- Return type
bool
Static Methods
-
classmethod
icmp_type
(type)¶ All codes for a single ICMP type.
- Parameters
type (
Union
[int
,float
]) –- Return type
-
classmethod
icmp_type_and_code
(type, code)¶ A specific combination of ICMP type and code.
- Parameters
type (
Union
[int
,float
]) –code (
Union
[int
,float
]) –
- See
https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml
- Return type
-
classmethod
tcp_range
(start_port, end_port)¶ A TCP port range.
- Parameters
start_port (
Union
[int
,float
]) –end_port (
Union
[int
,float
]) –
- Return type