# AwsVpcConfigurationProperty

An object representing the networking details for a task or service.

For example `awsVpcConfiguration={subnets=["subnet-12344321"],securityGroups=["sg-12344321"]}` .

- Source: Generated at build time
- Type last changed: v2.93.0 · 23 Aug 2023

## Example

TypeScript:

```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 awsVpcConfigurationProperty: ecs.CfnTaskSet.AwsVpcConfigurationProperty = {
  subnets: ['subnets'],

  // the properties below are optional
  assignPublicIp: 'assignPublicIp',
  securityGroups: ['securityGroups'],
};
```

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_ecs as ecs

aws_vpc_configuration_property = ecs.CfnTaskSet.AwsVpcConfigurationProperty(
    subnets=["subnets"],

    # the properties below are optional
    assign_public_ip="assignPublicIp",
    security_groups=["securityGroups"]
)
```

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.ecs.*;

AwsVpcConfigurationProperty awsVpcConfigurationProperty = AwsVpcConfigurationProperty.builder()
        .subnets(List.of("subnets"))

        // the properties below are optional
        .assignPublicIp("assignPublicIp")
        .securityGroups(List.of("securityGroups"))
        .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.ECS;

var awsVpcConfigurationProperty = new AwsVpcConfigurationProperty {
    Subnets = new [] { "subnets" },

    // the properties below are optional
    AssignPublicIp = "assignPublicIp",
    SecurityGroups = new [] { "securityGroups" }
};
```

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"

awsVpcConfigurationProperty := &AwsVpcConfigurationProperty{
	Subnets: []*string{
		jsii.String("subnets"),
	},

	// the properties below are optional
	AssignPublicIp: jsii.String("assignPublicIp"),
	SecurityGroups: []*string{
		jsii.String("securityGroups"),
	},
}
```

## Properties

- `assignPublicIp`: string — Whether the task's elastic network interface receives a public IP address.

  Consider the following when you set this value:

  - When you use `create-service` or `update-service` , the default is `DISABLED` .
  - When the service `deploymentController` is `ECS` , the value must be `DISABLED` .

- `securityGroups`: string[] — The IDs of the security groups associated with the task or service.

  If you don't specify a security group, the default security group for the VPC is used. There's a limit of 5 security groups that can be specified.

  > All specified security groups must be from the same VPC.

- `subnets`: string[] (required) — The IDs of the subnets associated with the task or service.

  There's a limit of 16 subnets that can be specified.

  > All specified subnets must be from the same VPC.
