Network Interface Permission
Grant cross-account access to an Elastic network interface (ENI).
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.NetworkInterface("example", {
subnetId: exampleAwsSubnet.id,
privateIps: ["10.0.0.50"],
securityGroups: [exampleAwsSecurityGroup.id],
attachments: [{
instance: exampleAwsInstance.id,
deviceIndex: 1,
}],
});
const exampleNetworkInterfacePermission = new aws.ec2.NetworkInterfacePermission("example", {
networkInterfaceId: example.id,
awsAccountId: "123456789012",
permission: "INSTANCE-ATTACH",
});
Content copied to clipboard
import pulumi
import pulumi_aws as aws
example = aws.ec2.NetworkInterface("example",
subnet_id=example_aws_subnet["id"],
private_ips=["10.0.0.50"],
security_groups=[example_aws_security_group["id"]],
attachments=[{
"instance": example_aws_instance["id"],
"device_index": 1,
}])
example_network_interface_permission = aws.ec2.NetworkInterfacePermission("example",
network_interface_id=example.id,
aws_account_id="123456789012",
permission="INSTANCE-ATTACH")
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2.NetworkInterface("example", new()
{
SubnetId = exampleAwsSubnet.Id,
PrivateIps = new[]
{
"10.0.0.50",
},
SecurityGroups = new[]
{
exampleAwsSecurityGroup.Id,
},
Attachments = new[]
{
new Aws.Ec2.Inputs.NetworkInterfaceAttachmentArgs
{
Instance = exampleAwsInstance.Id,
DeviceIndex = 1,
},
},
});
var exampleNetworkInterfacePermission = new Aws.Ec2.NetworkInterfacePermission("example", new()
{
NetworkInterfaceId = example.Id,
AwsAccountId = "123456789012",
Permission = "INSTANCE-ATTACH",
});
});
Content copied to clipboard
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 {
example, err := ec2.NewNetworkInterface(ctx, "example", &ec2.NetworkInterfaceArgs{
SubnetId: pulumi.Any(exampleAwsSubnet.Id),
PrivateIps: pulumi.StringArray{
pulumi.String("10.0.0.50"),
},
SecurityGroups: pulumi.StringArray{
exampleAwsSecurityGroup.Id,
},
Attachments: ec2.NetworkInterfaceAttachmentTypeArray{
&ec2.NetworkInterfaceAttachmentTypeArgs{
Instance: pulumi.Any(exampleAwsInstance.Id),
DeviceIndex: pulumi.Int(1),
},
},
})
if err != nil {
return err
}
_, err = ec2.NewNetworkInterfacePermission(ctx, "example", &ec2.NetworkInterfacePermissionArgs{
NetworkInterfaceId: example.ID(),
AwsAccountId: pulumi.String("123456789012"),
Permission: pulumi.String("INSTANCE-ATTACH"),
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.NetworkInterface;
import com.pulumi.aws.ec2.NetworkInterfaceArgs;
import com.pulumi.aws.ec2.inputs.NetworkInterfaceAttachmentArgs;
import com.pulumi.aws.ec2.NetworkInterfacePermission;
import com.pulumi.aws.ec2.NetworkInterfacePermissionArgs;
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 example = new NetworkInterface("example", NetworkInterfaceArgs.builder()
.subnetId(exampleAwsSubnet.id())
.privateIps("10.0.0.50")
.securityGroups(exampleAwsSecurityGroup.id())
.attachments(NetworkInterfaceAttachmentArgs.builder()
.instance(exampleAwsInstance.id())
.deviceIndex(1)
.build())
.build());
var exampleNetworkInterfacePermission = new NetworkInterfacePermission("exampleNetworkInterfacePermission", NetworkInterfacePermissionArgs.builder()
.networkInterfaceId(example.id())
.awsAccountId("123456789012")
.permission("INSTANCE-ATTACH")
.build());
}
}
Content copied to clipboard
resources:
example:
type: aws:ec2:NetworkInterface
properties:
subnetId: ${exampleAwsSubnet.id}
privateIps:
- 10.0.0.50
securityGroups:
- ${exampleAwsSecurityGroup.id}
attachments:
- instance: ${exampleAwsInstance.id}
deviceIndex: 1
exampleNetworkInterfacePermission:
type: aws:ec2:NetworkInterfacePermission
name: example
properties:
networkInterfaceId: ${example.id}
awsAccountId: '123456789012'
permission: INSTANCE-ATTACH
Content copied to clipboard
Import
Using pulumi import
, import Network Interface Permissions using the network_interface_permission_id
. For example:
$ pulumi import aws:ec2/networkInterfacePermission:NetworkInterfacePermission example eni-perm-056ad97ce2ac377ed
Content copied to clipboard
Properties
Link copied to clipboard
The Amazon Web Services account ID.
Link copied to clipboard
The ID of the network interface.
Link copied to clipboard
ENI permission ID.
Link copied to clipboard
The type of permission to grant. Valid values are INSTANCE-ATTACH
or EIP-ASSOCIATE
.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard