

This is the new *CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::EC2::TransitGatewayAttachment
<a name="aws-resource-ec2-transitgatewayattachment"></a>

Attaches a VPC to a transit gateway.

If you attach a VPC with a CIDR range that overlaps the CIDR range of a VPC that is already attached, the new VPC CIDR range is not propagated to the default propagation route table.

To send VPC traffic to an attached transit gateway, add a route to the VPC route table using [AWS::EC2::Route](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html).

To update tags for a VPC attachment after creation without replacing the attachment, use [AWS::EC2::TransitGatewayVpcAttachment](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayvpcattachment.html) instead.

## Syntax
<a name="aws-resource-ec2-transitgatewayattachment-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-ec2-transitgatewayattachment-syntax.json"></a>

```
{
  "Type" : "AWS::EC2::TransitGatewayAttachment",
  "Properties" : {
      "[Options](#cfn-ec2-transitgatewayattachment-options)" : Options,
      "[SubnetIds](#cfn-ec2-transitgatewayattachment-subnetids)" : [ String, ... ],
      "[Tags](#cfn-ec2-transitgatewayattachment-tags)" : [ Tag, ... ],
      "[TransitGatewayId](#cfn-ec2-transitgatewayattachment-transitgatewayid)" : String,
      "[VpcId](#cfn-ec2-transitgatewayattachment-vpcid)" : String
    }
}
```

### YAML
<a name="aws-resource-ec2-transitgatewayattachment-syntax.yaml"></a>

```
Type: AWS::EC2::TransitGatewayAttachment
Properties:
  [Options](#cfn-ec2-transitgatewayattachment-options): 
    Options
  [SubnetIds](#cfn-ec2-transitgatewayattachment-subnetids): 
    - String
  [Tags](#cfn-ec2-transitgatewayattachment-tags): 
    - Tag
  [TransitGatewayId](#cfn-ec2-transitgatewayattachment-transitgatewayid): String
  [VpcId](#cfn-ec2-transitgatewayattachment-vpcid): String
```

## Properties
<a name="aws-resource-ec2-transitgatewayattachment-properties"></a>

`Options`  <a name="cfn-ec2-transitgatewayattachment-options"></a>
The VPC attachment options.  
*Required*: No  
*Type*: [Options](aws-properties-ec2-transitgatewayattachment-options.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`SubnetIds`  <a name="cfn-ec2-transitgatewayattachment-subnetids"></a>
The IDs of one or more subnets. You can specify only one subnet per Availability Zone. You must specify at least one subnet, but we recommend that you specify two subnets for better availability. The transit gateway uses one IP address from each specified subnet.  
*Required*: Yes  
*Type*: Array of String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Tags`  <a name="cfn-ec2-transitgatewayattachment-tags"></a>
The tags for the attachment.  
*Required*: No  
*Type*: Array of [Tag](aws-properties-ec2-transitgatewayattachment-tag.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`TransitGatewayId`  <a name="cfn-ec2-transitgatewayattachment-transitgatewayid"></a>
The ID of the transit gateway.  
*Required*: Yes  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`VpcId`  <a name="cfn-ec2-transitgatewayattachment-vpcid"></a>
The ID of the VPC.  
*Required*: Yes  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## Return values
<a name="aws-resource-ec2-transitgatewayattachment-return-values"></a>

### Ref
<a name="aws-resource-ec2-transitgatewayattachment-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the ID of the attachment.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-ec2-transitgatewayattachment-return-values-fn--getatt"></a>

The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the `Fn::GetAtt` intrinsic function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html).

#### 
<a name="aws-resource-ec2-transitgatewayattachment-return-values-fn--getatt-fn--getatt"></a>

`Id`  <a name="Id-fn::getatt"></a>
The ID of the attachment.

## See also
<a name="aws-resource-ec2-transitgatewayattachment--seealso"></a>
+ [CreateTransitGatewayVpcAttachment](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTransitGatewayVpcAttachment.html) in the *Amazon EC2 API Reference*.
+ [ModifyTransitGatewayVpcAttachment](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyTransitGatewayVpcAttachment.html) in the *Amazon EC2 API Reference*



# AWS::EC2::TransitGatewayAttachment Options
<a name="aws-properties-ec2-transitgatewayattachment-options"></a>

Describes the VPC attachment options.

## Syntax
<a name="aws-properties-ec2-transitgatewayattachment-options-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-ec2-transitgatewayattachment-options-syntax.json"></a>

```
{
  "[ApplianceModeSupport](#cfn-ec2-transitgatewayattachment-options-appliancemodesupport)" : String,
  "[DnsSupport](#cfn-ec2-transitgatewayattachment-options-dnssupport)" : String,
  "[Ipv6Support](#cfn-ec2-transitgatewayattachment-options-ipv6support)" : String,
  "[SecurityGroupReferencingSupport](#cfn-ec2-transitgatewayattachment-options-securitygroupreferencingsupport)" : String
}
```

### YAML
<a name="aws-properties-ec2-transitgatewayattachment-options-syntax.yaml"></a>

```
  [ApplianceModeSupport](#cfn-ec2-transitgatewayattachment-options-appliancemodesupport): String
  [DnsSupport](#cfn-ec2-transitgatewayattachment-options-dnssupport): String
  [Ipv6Support](#cfn-ec2-transitgatewayattachment-options-ipv6support): String
  [SecurityGroupReferencingSupport](#cfn-ec2-transitgatewayattachment-options-securitygroupreferencingsupport): String
```

## Properties
<a name="aws-properties-ec2-transitgatewayattachment-options-properties"></a>

`ApplianceModeSupport`  <a name="cfn-ec2-transitgatewayattachment-options-appliancemodesupport"></a>
Enable or disable appliance mode support. The default is `disable`.  
*Required*: No  
*Type*: String  
*Allowed values*: `enable | disable`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`DnsSupport`  <a name="cfn-ec2-transitgatewayattachment-options-dnssupport"></a>
Enable or disable DNS support. The default is `disable`.  
*Required*: No  
*Type*: String  
*Allowed values*: `enable | disable`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Ipv6Support`  <a name="cfn-ec2-transitgatewayattachment-options-ipv6support"></a>
Enable or disable IPv6 support. The default is `disable`.  
*Required*: No  
*Type*: String  
*Allowed values*: `enable | disable`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`SecurityGroupReferencingSupport`  <a name="cfn-ec2-transitgatewayattachment-options-securitygroupreferencingsupport"></a>
Enables you to reference a security group across VPCs attached to a transit gateway (TGW). Use this option to simplify security group management and control of instance-to-instance traffic across VPCs that are connected by transit gateway. You can also use this option to migrate from VPC peering (which was the only option that supported security group referencing) to transit gateways (which now also support security group referencing). This option is disabled by default and there are no additional costs to use this feature.  
For important information about this feature, see [Create a transit gateway](https://docs.aws.amazon.com/vpc/latest/tgw/tgw-transit-gateways.html#create-tgw) in the *AWS Transit Gateway Guide*.  
*Required*: No  
*Type*: String  
*Allowed values*: `enable | disable`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::EC2::TransitGatewayAttachment Tag
<a name="aws-properties-ec2-transitgatewayattachment-tag"></a>

Specifies a tag. For more information, see [Resource tags](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html).

## Syntax
<a name="aws-properties-ec2-transitgatewayattachment-tag-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-ec2-transitgatewayattachment-tag-syntax.json"></a>

```
{
  "[Key](#cfn-ec2-transitgatewayattachment-tag-key)" : String,
  "[Value](#cfn-ec2-transitgatewayattachment-tag-value)" : String
}
```

### YAML
<a name="aws-properties-ec2-transitgatewayattachment-tag-syntax.yaml"></a>

```
  [Key](#cfn-ec2-transitgatewayattachment-tag-key): String
  [Value](#cfn-ec2-transitgatewayattachment-tag-value): String
```

## Properties
<a name="aws-properties-ec2-transitgatewayattachment-tag-properties"></a>

`Key`  <a name="cfn-ec2-transitgatewayattachment-tag-key"></a>
The tag key.  
*Required*: Yes  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Value`  <a name="cfn-ec2-transitgatewayattachment-tag-value"></a>
The tag value.  
*Required*: Yes  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Examples
<a name="aws-properties-ec2-transitgatewayattachment-tag--examples"></a>

### 
<a name="aws-properties-ec2-transitgatewayattachment-tag--examples--"></a>

This example specifies two tags for the transit gateway attachment.

#### JSON
<a name="aws-properties-ec2-transitgatewayattachment-tag--examples----json"></a>

```
"Tags" : [
   {
      "Key" : "key1",
      "Value" : "value1"
   },
   {
      "Key" : "key2",
      "Value" : "value2"
   }
]
```

#### YAML
<a name="aws-properties-ec2-transitgatewayattachment-tag--examples----yaml"></a>

```
Tags: 
  - Key: "key1"
    Value: "value1"
  - Key: "key2"
    Value: "value2"
```