# CfnTransitGatewayVpcAttachmentProps

Properties for defining a `CfnTransitGatewayVpcAttachment`.

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

- Source: Generated at build time
- Type last changed: v2.227.0 · 21 Nov 2025

## 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 options: any;
const cfnTransitGatewayVpcAttachmentProps: ec2.CfnTransitGatewayVpcAttachmentProps = {
  subnetIds: ['subnetIds'],
  transitGatewayId: 'transitGatewayId',
  vpcId: 'vpcId',

  // the properties below are optional
  addSubnetIds: ['addSubnetIds'],
  options: options,
  removeSubnetIds: ['removeSubnetIds'],
  tags: [{
    key: 'key',
    value: 'value',
  }],
};
```

Python:

```python
from aws_cdk import CfnTag
# 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

# options: Any

cfn_transit_gateway_vpc_attachment_props = ec2.CfnTransitGatewayVpcAttachmentProps(
    subnet_ids=["subnetIds"],
    transit_gateway_id="transitGatewayId",
    vpc_id="vpcId",

    # the properties below are optional
    add_subnet_ids=["addSubnetIds"],
    options=options,
    remove_subnet_ids=["removeSubnetIds"],
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)
```

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

Object options;

CfnTransitGatewayVpcAttachmentProps cfnTransitGatewayVpcAttachmentProps = CfnTransitGatewayVpcAttachmentProps.builder()
        .subnetIds(List.of("subnetIds"))
        .transitGatewayId("transitGatewayId")
        .vpcId("vpcId")

        // the properties below are optional
        .addSubnetIds(List.of("addSubnetIds"))
        .options(options)
        .removeSubnetIds(List.of("removeSubnetIds"))
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .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;

var options;

var cfnTransitGatewayVpcAttachmentProps = new CfnTransitGatewayVpcAttachmentProps {
    SubnetIds = new [] { "subnetIds" },
    TransitGatewayId = "transitGatewayId",
    VpcId = "vpcId",

    // the properties below are optional
    AddSubnetIds = new [] { "addSubnetIds" },
    Options = options,
    RemoveSubnetIds = new [] { "removeSubnetIds" },
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } }
};
```

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 options interface{}

cfnTransitGatewayVpcAttachmentProps := &CfnTransitGatewayVpcAttachmentProps{
	SubnetIds: []*string{
		jsii.String("subnetIds"),
	},
	TransitGatewayId: jsii.String("transitGatewayId"),
	VpcId: jsii.String("vpcId"),

	// the properties below are optional
	AddSubnetIds: []*string{
		jsii.String("addSubnetIds"),
	},
	Options: options,
	RemoveSubnetIds: []*string{
		jsii.String("removeSubnetIds"),
	},
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
}
```

## Properties

- `addSubnetIds`: string[] — The IDs of one or more subnets to add.

  You can specify at most one subnet per Availability Zone.

- `options`: any — The VPC attachment options.

- `removeSubnetIds`: string[] — The IDs of one or more subnets to remove.

- `subnetIds`: string[] (required) — The IDs of the subnets.

- `tags`: [CfnTag](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — The tags for the VPC attachment.

- `transitGatewayId`: string | [ITransitGatewayRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ec2.ITransitGatewayRef.html) (required) — The ID of the transit gateway.

- `vpcId`: string (required) — The ID of the VPC.
