aws.ec2.NetworkInterfaceAttachment
Explore with Pulumi AI
Attach an Elastic network interface (ENI) resource with EC2 instance.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = new aws.ec2.NetworkInterfaceAttachment("test", {
instanceId: testAwsInstance.id,
networkInterfaceId: testAwsNetworkInterface.id,
deviceIndex: 0,
});
import pulumi
import pulumi_aws as aws
test = aws.ec2.NetworkInterfaceAttachment("test",
instance_id=test_aws_instance["id"],
network_interface_id=test_aws_network_interface["id"],
device_index=0)
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.NewNetworkInterfaceAttachment(ctx, "test", &ec2.NetworkInterfaceAttachmentArgs{
InstanceId: pulumi.Any(testAwsInstance.Id),
NetworkInterfaceId: pulumi.Any(testAwsNetworkInterface.Id),
DeviceIndex: pulumi.Int(0),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = new Aws.Ec2.NetworkInterfaceAttachment("test", new()
{
InstanceId = testAwsInstance.Id,
NetworkInterfaceId = testAwsNetworkInterface.Id,
DeviceIndex = 0,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.NetworkInterfaceAttachment;
import com.pulumi.aws.ec2.NetworkInterfaceAttachmentArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var test = new NetworkInterfaceAttachment("test", NetworkInterfaceAttachmentArgs.builder()
.instanceId(testAwsInstance.id())
.networkInterfaceId(testAwsNetworkInterface.id())
.deviceIndex(0)
.build());
}
}
resources:
test:
type: aws:ec2:NetworkInterfaceAttachment
properties:
instanceId: ${testAwsInstance.id}
networkInterfaceId: ${testAwsNetworkInterface.id}
deviceIndex: 0
Create NetworkInterfaceAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new NetworkInterfaceAttachment(name: string, args: NetworkInterfaceAttachmentArgs, opts?: CustomResourceOptions);
@overload
def NetworkInterfaceAttachment(resource_name: str,
args: NetworkInterfaceAttachmentInitArgs,
opts: Optional[ResourceOptions] = None)
@overload
def NetworkInterfaceAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
device_index: Optional[int] = None,
instance_id: Optional[str] = None,
network_interface_id: Optional[str] = None)
func NewNetworkInterfaceAttachment(ctx *Context, name string, args NetworkInterfaceAttachmentArgs, opts ...ResourceOption) (*NetworkInterfaceAttachment, error)
public NetworkInterfaceAttachment(string name, NetworkInterfaceAttachmentArgs args, CustomResourceOptions? opts = null)
public NetworkInterfaceAttachment(String name, NetworkInterfaceAttachmentArgs args)
public NetworkInterfaceAttachment(String name, NetworkInterfaceAttachmentArgs args, CustomResourceOptions options)
type: aws:ec2:NetworkInterfaceAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args NetworkInterfaceAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args NetworkInterfaceAttachmentInitArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args NetworkInterfaceAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkInterfaceAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NetworkInterfaceAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var networkInterfaceAttachmentResource = new Aws.Ec2.NetworkInterfaceAttachment("networkInterfaceAttachmentResource", new()
{
DeviceIndex = 0,
InstanceId = "string",
NetworkInterfaceId = "string",
});
example, err := ec2.NewNetworkInterfaceAttachment(ctx, "networkInterfaceAttachmentResource", &ec2.NetworkInterfaceAttachmentArgs{
DeviceIndex: pulumi.Int(0),
InstanceId: pulumi.String("string"),
NetworkInterfaceId: pulumi.String("string"),
})
var networkInterfaceAttachmentResource = new NetworkInterfaceAttachment("networkInterfaceAttachmentResource", NetworkInterfaceAttachmentArgs.builder()
.deviceIndex(0)
.instanceId("string")
.networkInterfaceId("string")
.build());
network_interface_attachment_resource = aws.ec2.NetworkInterfaceAttachment("networkInterfaceAttachmentResource",
device_index=0,
instance_id="string",
network_interface_id="string")
const networkInterfaceAttachmentResource = new aws.ec2.NetworkInterfaceAttachment("networkInterfaceAttachmentResource", {
deviceIndex: 0,
instanceId: "string",
networkInterfaceId: "string",
});
type: aws:ec2:NetworkInterfaceAttachment
properties:
deviceIndex: 0
instanceId: string
networkInterfaceId: string
NetworkInterfaceAttachment Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The NetworkInterfaceAttachment resource accepts the following input properties:
- Device
Index int - Network interface index (int).
- Instance
Id string - Instance ID to attach.
- Network
Interface stringId - ENI ID to attach.
- Device
Index int - Network interface index (int).
- Instance
Id string - Instance ID to attach.
- Network
Interface stringId - ENI ID to attach.
- device
Index Integer - Network interface index (int).
- instance
Id String - Instance ID to attach.
- network
Interface StringId - ENI ID to attach.
- device
Index number - Network interface index (int).
- instance
Id string - Instance ID to attach.
- network
Interface stringId - ENI ID to attach.
- device_
index int - Network interface index (int).
- instance_
id str - Instance ID to attach.
- network_
interface_ strid - ENI ID to attach.
- device
Index Number - Network interface index (int).
- instance
Id String - Instance ID to attach.
- network
Interface StringId - ENI ID to attach.
Outputs
All input properties are implicitly available as output properties. Additionally, the NetworkInterfaceAttachment resource produces the following output properties:
- Attachment
Id string - The ENI Attachment ID.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- The status of the Network Interface Attachment.
- Attachment
Id string - The ENI Attachment ID.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- The status of the Network Interface Attachment.
- attachment
Id String - The ENI Attachment ID.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- The status of the Network Interface Attachment.
- attachment
Id string - The ENI Attachment ID.
- id string
- The provider-assigned unique ID for this managed resource.
- status string
- The status of the Network Interface Attachment.
- attachment_
id str - The ENI Attachment ID.
- id str
- The provider-assigned unique ID for this managed resource.
- status str
- The status of the Network Interface Attachment.
- attachment
Id String - The ENI Attachment ID.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- The status of the Network Interface Attachment.
Look up Existing NetworkInterfaceAttachment Resource
Get an existing NetworkInterfaceAttachment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: NetworkInterfaceAttachmentState, opts?: CustomResourceOptions): NetworkInterfaceAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
attachment_id: Optional[str] = None,
device_index: Optional[int] = None,
instance_id: Optional[str] = None,
network_interface_id: Optional[str] = None,
status: Optional[str] = None) -> NetworkInterfaceAttachment
func GetNetworkInterfaceAttachment(ctx *Context, name string, id IDInput, state *NetworkInterfaceAttachmentState, opts ...ResourceOption) (*NetworkInterfaceAttachment, error)
public static NetworkInterfaceAttachment Get(string name, Input<string> id, NetworkInterfaceAttachmentState? state, CustomResourceOptions? opts = null)
public static NetworkInterfaceAttachment get(String name, Output<String> id, NetworkInterfaceAttachmentState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Attachment
Id string - The ENI Attachment ID.
- Device
Index int - Network interface index (int).
- Instance
Id string - Instance ID to attach.
- Network
Interface stringId - ENI ID to attach.
- Status string
- The status of the Network Interface Attachment.
- Attachment
Id string - The ENI Attachment ID.
- Device
Index int - Network interface index (int).
- Instance
Id string - Instance ID to attach.
- Network
Interface stringId - ENI ID to attach.
- Status string
- The status of the Network Interface Attachment.
- attachment
Id String - The ENI Attachment ID.
- device
Index Integer - Network interface index (int).
- instance
Id String - Instance ID to attach.
- network
Interface StringId - ENI ID to attach.
- status String
- The status of the Network Interface Attachment.
- attachment
Id string - The ENI Attachment ID.
- device
Index number - Network interface index (int).
- instance
Id string - Instance ID to attach.
- network
Interface stringId - ENI ID to attach.
- status string
- The status of the Network Interface Attachment.
- attachment_
id str - The ENI Attachment ID.
- device_
index int - Network interface index (int).
- instance_
id str - Instance ID to attach.
- network_
interface_ strid - ENI ID to attach.
- status str
- The status of the Network Interface Attachment.
- attachment
Id String - The ENI Attachment ID.
- device
Index Number - Network interface index (int).
- instance
Id String - Instance ID to attach.
- network
Interface StringId - ENI ID to attach.
- status String
- The status of the Network Interface Attachment.
Import
Using pulumi import
, import Elastic network interface (ENI) Attachments using its Attachment ID. For example:
$ pulumi import aws:ec2/networkInterfaceAttachment:NetworkInterfaceAttachment secondary_nic eni-attach-0a33842b4ec347c4c
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.