ConnectionNetwork Class
VPC network placement for a Glue Connection.
A Glue connection targets a single subnet. Choose the placement with one of the mutually-exclusive factories — an explicit subnet, or a VPC to select one from — so a subnet paired with a VPC, or a subnet selection without a VPC, cannot be expressed.
| Source | aws-glue/lib/connection.ts |
|---|---|
| Type last changed |
Example
ts
declare const securityGroup: ec2.SecurityGroup;
declare const vpc: ec2.Vpc;
new glue.Connection(this, 'MyConnection', {
type: glue.ConnectionType.NETWORK,
securityGroups: [securityGroup],
// vpcSubnets is optional - defaults to private subnets
network: glue.ConnectionNetwork.vpc(vpc, { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }),
});
python
# security_group: ec2.SecurityGroup
# vpc: ec2.Vpc
glue.Connection(self, "MyConnection",
type=glue.ConnectionType.NETWORK,
security_groups=[security_group],
# vpcSubnets is optional - defaults to private subnets
network=glue.ConnectionNetwork.vpc(vpc, subnet_type=ec2.SubnetType.PRIVATE_WITH_EGRESS)
)
java
SecurityGroup securityGroup;
Vpc vpc;
Connection.Builder.create(this, "MyConnection")
.type(ConnectionType.NETWORK)
.securityGroups(List.of(securityGroup))
// vpcSubnets is optional - defaults to private subnets
.network(ConnectionNetwork.vpc(vpc, SubnetSelection.builder().subnetType(SubnetType.PRIVATE_WITH_EGRESS).build()))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
SecurityGroup securityGroup;
Vpc vpc;
new Connection(this, "MyConnection", new ConnectionProps {
Type = ConnectionType.NETWORK,
SecurityGroups = new [] { securityGroup },
// vpcSubnets is optional - defaults to private subnets
Network = ConnectionNetwork.Vpc(vpc, new SubnetSelection { SubnetType = SubnetType.PRIVATE_WITH_EGRESS })
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var securityGroup SecurityGroup
var vpc Vpc
glue.NewConnection(this, jsii.String("MyConnection"), &ConnectionProps{
Type: glue.ConnectionType_NETWORK(),
SecurityGroups: []ISecurityGroup{
securityGroup,
},
// vpcSubnets is optional - defaults to private subnets
Network: glue.ConnectionNetwork_Vpc(vpc, &SubnetSelection{
SubnetType: ec2.SubnetType_PRIVATE_WITH_EGRESS,
}),
})
Methods
subnet(subnet: ISubnet): ConnectionNetwork // chainable@staticmethod def subnet(subnet: ISubnet) -> ConnectionNetworkpublic static ConnectionNetwork subnet(ISubnet subnet)public static ConnectionNetwork Subnet(ISubnet subnet)func Subnet(Subnet ISubnet) ConnectionNetwork static #Pin the connection to a specific subnet.
1 parameter
Parameters
subnetsubnetsubnetsubnetSubnet— the subnet the connection targets.
vpc(vpc: IVpc, vpcSubnets?: SubnetSelection): ConnectionNetwork // chainable@staticmethod def vpc(vpc: IVpc, vpc_subnets: typing.Optional[SubnetSelection] = None) -> ConnectionNetworkpublic static ConnectionNetwork vpc(IVpc vpc, SubnetSelection vpcSubnets)public static ConnectionNetwork Vpc(IVpc vpc, SubnetSelection? vpcSubnets = null)func Vpc(Vpc IVpc, VpcSubnets SubnetSelection) ConnectionNetwork static #Select the connection's subnet from a VPC.
Since a Glue connection targets a single subnet, the first subnet of the selection is used.
2 parameters
Parameters
vpcvpcvpcvpcVpc— the VPC to select a subnet from.vpcSubnetsvpc_subnetsvpcSubnetsvpcSubnetsVpcSubnets— which subnets to select from.