Skip to content
v2.278.0

NetworkConfigurationProperty Struct ​

The network configuration for a task or service.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';
const networkConfigurationProperty: ecs.CfnService.NetworkConfigurationProperty = {
  awsvpcConfiguration: {
    assignPublicIp: 'assignPublicIp',
    securityGroups: ['securityGroups'],
    subnets: ['subnets'],
  },
};
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_ecs as ecs

network_configuration_property = ecs.CfnService.NetworkConfigurationProperty(
    awsvpc_configuration=ecs.CfnService.AwsVpcConfigurationProperty(
        assign_public_ip="assignPublicIp",
        security_groups=["securityGroups"],
        subnets=["subnets"]
    )
)
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.ecs.*;

NetworkConfigurationProperty networkConfigurationProperty = NetworkConfigurationProperty.builder()
        .awsvpcConfiguration(AwsVpcConfigurationProperty.builder()
                .assignPublicIp("assignPublicIp")
                .securityGroups(List.of("securityGroups"))
                .subnets(List.of("subnets"))
                .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.ECS;

var networkConfigurationProperty = new NetworkConfigurationProperty {
    AwsvpcConfiguration = new AwsVpcConfigurationProperty {
        AssignPublicIp = "assignPublicIp",
        SecurityGroups = new [] { "securityGroups" },
        Subnets = new [] { "subnets" }
    }
};
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"

networkConfigurationProperty := &NetworkConfigurationProperty{
	AwsvpcConfiguration: &AwsVpcConfigurationProperty{
		AssignPublicIp: jsii.String("assignPublicIp"),
		SecurityGroups: []*string{
			jsii.String("securityGroups"),
		},
		Subnets: []*string{
			jsii.String("subnets"),
		},
	},
}

Properties ​

awsvpcConfigurationoptionalIResolvable | CfnService.AwsVpcConfigurationPropertyawsvpc_configurationoptionaltyping.Union[IResolvable, AwsVpcConfigurationProperty]awsvpcConfigurationoptionalIResolvableAwsvpcConfigurationoptionalIResolvableAwsvpcConfigurationoptionalinterface{} #
The VPC subnets and security groups that are associated with a task.

All specified subnets and security groups must be from the same VPC.