Skip to content
v2.278.0

VpcConfig Struct ​

Specifies the VPC that you want your Amazon SageMaker training job to connect to.

Example ​

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';
import { aws_stepfunctions_tasks as stepfunctions_tasks } from 'aws-cdk-lib';

declare const subnet: ec2.Subnet;
declare const subnetFilter: ec2.SubnetFilter;
declare const vpc: ec2.Vpc;
const vpcConfig: stepfunctions_tasks.VpcConfig = {
  vpc: vpc,

  // the properties below are optional
  subnets: {
    availabilityZones: ['availabilityZones'],
    onePerAz: false,
    subnetFilters: [subnetFilter],
    subnetGroupName: 'subnetGroupName',
    subnets: [subnet],
    subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
  },
};
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
from aws_cdk import aws_stepfunctions_tasks as stepfunctions_tasks

# subnet: ec2.Subnet
# subnet_filter: ec2.SubnetFilter
# vpc: ec2.Vpc

vpc_config = stepfunctions_tasks.VpcConfig(
    vpc=vpc,

    # the properties below are optional
    subnets=ec2.SubnetSelection(
        availability_zones=["availabilityZones"],
        one_per_az=False,
        subnet_filters=[subnet_filter],
        subnet_group_name="subnetGroupName",
        subnets=[subnet],
        subnet_type=ec2.SubnetType.PRIVATE_ISOLATED
    )
)
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.*;
import software.amazon.awscdk.services.stepfunctions.tasks.*;

Subnet subnet;
SubnetFilter subnetFilter;
Vpc vpc;

VpcConfig vpcConfig = VpcConfig.builder()
        .vpc(vpc)

        // the properties below are optional
        .subnets(SubnetSelection.builder()
                .availabilityZones(List.of("availabilityZones"))
                .onePerAz(false)
                .subnetFilters(List.of(subnetFilter))
                .subnetGroupName("subnetGroupName")
                .subnets(List.of(subnet))
                .subnetType(SubnetType.PRIVATE_ISOLATED)
                .build())
        .build();
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;
using Amazon.CDK.AWS.StepFunctions.Tasks;

Subnet subnet;
SubnetFilter subnetFilter;
Vpc vpc;

var vpcConfig = new VpcConfig {
    Vpc = vpc,

    // the properties below are optional
    Subnets = new SubnetSelection {
        AvailabilityZones = new [] { "availabilityZones" },
        OnePerAz = false,
        SubnetFilters = new [] { subnetFilter },
        SubnetGroupName = "subnetGroupName",
        Subnets = new [] { subnet },
        SubnetType = SubnetType.PRIVATE_ISOLATED
    }
};
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"
import "github.com/aws/aws-cdk-go/awscdk"

var subnet Subnet
var subnetFilter SubnetFilter
var vpc Vpc

vpcConfig := &VpcConfig{
	Vpc: vpc,

	// the properties below are optional
	Subnets: &SubnetSelection{
		AvailabilityZones: []*string{
			jsii.String("availabilityZones"),
		},
		OnePerAz: jsii.Boolean(false),
		SubnetFilters: []SubnetFilter{
			subnetFilter,
		},
		SubnetGroupName: jsii.String("subnetGroupName"),
		Subnets: []ISubnet{
			subnet,
		},
		SubnetType: awscdk.Aws_ec2.SubnetType_PRIVATE_ISOLATED,
	},
}

Properties ​

subnetsoptionalSubnetSelectionsubnetsoptionalSubnetSelectionsubnetsoptionalSubnetSelectionSubnetsoptionalSubnetSelectionSubnetsoptionalSubnetSelection #
VPC subnets.

Default: Private Subnets are selected

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpc required #
VPC.