# ConnectionsProps

Properties to initialize a new Connections object.

Used as props by: [Connections](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Connections.html)

- Source: [`aws-ec2/lib/connections.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-ec2/lib/connections.ts#L35)

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';

declare const peer: ec2.IPeer;
declare const port: ec2.Port;
declare const securityGroup: ec2.SecurityGroup;
const connectionsProps: ec2.ConnectionsProps = {
  defaultPort: port,
  peer: peer,
  securityGroups: [securityGroup],
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2

# peer: ec2.IPeer
# port: ec2.Port
# security_group: ec2.SecurityGroup

connections_props = ec2.ConnectionsProps(
    default_port=port,
    peer=peer,
    security_groups=[security_group]
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;

IPeer peer;
Port port;
SecurityGroup securityGroup;

ConnectionsProps connectionsProps = ConnectionsProps.builder()
        .defaultPort(port)
        .peer(peer)
        .securityGroups(List.of(securityGroup))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;

IPeer peer;
Port port;
SecurityGroup securityGroup;

var connectionsProps = new ConnectionsProps {
    DefaultPort = port,
    Peer = peer,
    SecurityGroups = new [] { securityGroup }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var peer IPeer
var port Port
var securityGroup SecurityGroup

connectionsProps := &ConnectionsProps{
	DefaultPort: port,
	Peer: peer,
	SecurityGroups: []ISecurityGroup{
		securityGroup,
	},
}
```

## Properties

- `defaultPort`: [Port](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Port.html) — Default port range for initiating connections to and from this object.

  **Default:** No default port

- `peer`: [IPeer](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IPeer.html) — Class that represents the rule by which others can connect to this connectable.

  **Default:** Derived from securityGroup if set.

  This object is required, but will be derived from securityGroup if that is passed.

- `securityGroups`: [ISecurityGroup](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISecurityGroup.html)[] — What securityGroup(s) this object is managing connections for.

  **Default:** No security groups
