class Connections
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.EC2.Connections |
Java | software.amazon.awscdk.services.ec2.Connections |
Python | aws_cdk.aws_ec2.Connections |
TypeScript (source) | @aws-cdk/aws-ec2 » Connections |
Implements
IConnectable
Manage the allowed network connections for constructs with Security Groups.
Security Groups can be thought of as a firewall for network-connected devices. This class makes it easy to allow network connections to and from security groups, and between security groups individually. When establishing connectivity between security groups, it will automatically add rules in both security groups
This object can manage one or more security groups.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as ec2 from '@aws-cdk/aws-ec2';
declare const peer: ec2.IPeer;
declare const port: ec2.Port;
declare const securityGroup: ec2.SecurityGroup;
const connections = new ec2.Connections(/* all optional props */ {
defaultPort: port,
peer: peer,
securityGroups: [securityGroup],
});
Initializer
new Connections(props?: ConnectionsProps)
Parameters
- props
Connections
Props
Properties
Name | Type | Description |
---|---|---|
connections | Connections | The network connections associated with this resource. |
security | ISecurity [] | |
default | Port | The default port configured for this connection peer, if available. |
connections
Type:
Connections
The network connections associated with this resource.
securityGroups
Type:
ISecurity
[]
defaultPort?
Type:
Port
(optional)
The default port configured for this connection peer, if available.
Methods
Name | Description |
---|---|
add | Add a security group to the list of security groups managed by this object. |
allow | Allow connections from the peer on our default port. |
allow | Allow default connections from all IPv4 ranges. |
allow | Allow hosts inside the security group to connect to each other. |
allow | Allow connections from the peer on our default port. |
allow | Allow connections from the peer on the given port. |
allow | Allow from any IPv4 ranges. |
allow | Allow hosts inside the security group to connect to each other on the given port. |
allow | Allow connections to the peer on the given port. |
allow | Allow to all IPv4 ranges. |
allow | Allow connections to the security group on their default port. |
SecurityGroup(...securityGroups)
addpublic addSecurityGroup(...securityGroups: ISecurityGroup[]): void
Parameters
- securityGroups
ISecurity
Group
Add a security group to the list of security groups managed by this object.
DefaultPortFrom(other, description?)
allowpublic allowDefaultPortFrom(other: IConnectable, description?: string): void
Parameters
- other
IConnectable
- description
string
Allow connections from the peer on our default port.
Even if the peer has a default port, we will always use our default port.
DefaultPortFromAnyIpv4(description?)
allowpublic allowDefaultPortFromAnyIpv4(description?: string): void
Parameters
- description
string
Allow default connections from all IPv4 ranges.
DefaultPortInternally(description?)
allowpublic allowDefaultPortInternally(description?: string): void
Parameters
- description
string
Allow hosts inside the security group to connect to each other.
DefaultPortTo(other, description?)
allowpublic allowDefaultPortTo(other: IConnectable, description?: string): void
Parameters
- other
IConnectable
- description
string
Allow connections from the peer on our default port.
Even if the peer has a default port, we will always use our default port.
From(other, portRange, description?)
allowpublic allowFrom(other: IConnectable, portRange: Port, description?: string): void
Parameters
- other
IConnectable
- portRange
Port
- description
string
Allow connections from the peer on the given port.
FromAnyIpv4(portRange, description?)
allowpublic allowFromAnyIpv4(portRange: Port, description?: string): void
Parameters
- portRange
Port
- description
string
Allow from any IPv4 ranges.
Internally(portRange, description?)
allowpublic allowInternally(portRange: Port, description?: string): void
Parameters
- portRange
Port
- description
string
Allow hosts inside the security group to connect to each other on the given port.
To(other, portRange, description?)
allowpublic allowTo(other: IConnectable, portRange: Port, description?: string): void
Parameters
- other
IConnectable
- portRange
Port
- description
string
Allow connections to the peer on the given port.
ToAnyIpv4(portRange, description?)
allowpublic allowToAnyIpv4(portRange: Port, description?: string): void
Parameters
- portRange
Port
- description
string
Allow to all IPv4 ranges.
ToDefaultPort(other, description?)
allowpublic allowToDefaultPort(other: IConnectable, description?: string): void
Parameters
- other
IConnectable
- description
string
Allow connections to the security group on their default port.