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::NetworkInterfaceAttachment Attaches an elastic network interface (ENI) to an Amazon EC2 instance. You can use this resource type to attach additional network interfaces to an instance without interruption. ## Syntax To declare this entity in your CloudFormation template, use the following syntax: ### JSON ``` { "Type" : "AWS::EC2::NetworkInterfaceAttachment", "Properties" : { "[DeleteOnTermination](#cfn-ec2-networkinterfaceattachment-deleteontermination)" : {{Boolean}}, "[DeviceIndex](#cfn-ec2-networkinterfaceattachment-deviceindex)" : {{String}}, "[EnaQueueCount](#cfn-ec2-networkinterfaceattachment-enaqueuecount)" : {{Integer}}, "[EnaSrdSpecification](#cfn-ec2-networkinterfaceattachment-enasrdspecification)" : {{EnaSrdSpecification}}, "[InstanceId](#cfn-ec2-networkinterfaceattachment-instanceid)" : {{String}}, "[NetworkInterfaceId](#cfn-ec2-networkinterfaceattachment-networkinterfaceid)" : {{String}} } } ``` ### YAML ``` Type: AWS::EC2::NetworkInterfaceAttachment Properties: [DeleteOnTermination](#cfn-ec2-networkinterfaceattachment-deleteontermination): {{Boolean}} [DeviceIndex](#cfn-ec2-networkinterfaceattachment-deviceindex): {{String}} [EnaQueueCount](#cfn-ec2-networkinterfaceattachment-enaqueuecount): {{Integer}} [EnaSrdSpecification](#cfn-ec2-networkinterfaceattachment-enasrdspecification): {{ EnaSrdSpecification}} [InstanceId](#cfn-ec2-networkinterfaceattachment-instanceid): {{String}} [NetworkInterfaceId](#cfn-ec2-networkinterfaceattachment-networkinterfaceid): {{String}} ``` ## Properties `DeleteOnTermination` Whether to delete the network interface when the instance terminates. By default, this value is set to `true`. *Required*: No *Type*: Boolean *Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) `DeviceIndex` The network interface's position in the attachment order. For example, the first attached network interface has a `DeviceIndex` of 0. *Required*: Yes *Type*: String *Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement) `EnaQueueCount` The number of ENA queues created with the instance. *Required*: No *Type*: Integer *Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) `EnaSrdSpecification` Configures ENA Express for the network interface that this action attaches to the instance. *Required*: No *Type*: [EnaSrdSpecification](aws-properties-ec2-networkinterfaceattachment-enasrdspecification.md) *Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) `InstanceId` The ID of the instance to which you will attach the ENI. *Required*: Yes *Type*: String *Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement) `NetworkInterfaceId` The ID of the ENI that you want to attach. *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 ### Ref When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the resource name. 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 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). #### `AttachmentId` The ID of the network interface attachment. ## Examples ### Network interface attachment The following example attaches `MyNetworkInterface` to `MyInstance`. #### JSON ``` "NetworkInterfaceAttachment" : { "Type" : "AWS::EC2::NetworkInterfaceAttachment", "Properties" : { "InstanceId" : {"Ref" : "MyInstance"}, "NetworkInterfaceId" : {"Ref" : "MyNetworkInterface"}, "DeviceIndex" : "1" } } ``` #### YAML ``` NetworkInterfaceAttachment: Type: AWS::EC2::NetworkInterfaceAttachment Properties: InstanceId: Ref: MyInstance NetworkInterfaceId: Ref: MyNetworkInterface DeviceIndex: 1 ```