amazon-ebs builder: Attach an existing elastic network interface?

15 views
Skip to first unread message

Rob Capellini

unread,
Jun 30, 2019, 11:44:43 PM6/30/19
to Packer
Is it possible to attach an existing elastic network interface (ENI) to an instance when using any of the amazon builders?  I need eth0 to have the specific MAC address of the ENI.  I have a pre-provisioned ENI available and need to attach it to the instance at device index 0.  I have tried to script this using shell scripts, but unfortunately it seems you can't replace eth0 after the instance has been stood up.  Is there a way to do this that I am missing?

Rickard von Essen

unread,
Jul 1, 2019, 2:34:21 AM7/1/19
to packe...@googlegroups.com
Every instance in a VPC has a default network interface, called the primary network interface (eth0). You cannot detach a primary network interface from an instance. 

 Seems like it's not possible.

Why do you need it as eth0?

On Mon, Jul 1, 2019 at 5:44 AM Rob Capellini <rob.ca...@gmail.com> wrote:
Is it possible to attach an existing elastic network interface (ENI) to an instance when using any of the amazon builders?  I need eth0 to have the specific MAC address of the ENI.  I have a pre-provisioned ENI available and need to attach it to the instance at device index 0.  I have tried to script this using shell scripts, but unfortunately it seems you can't replace eth0 after the instance has been stood up.  Is there a way to do this that I am missing?

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/9ee1ea4a-6656-4f33-8419-084d964e5c2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rob Capellini

unread,
Jul 1, 2019, 8:11:36 AM7/1/19
to packe...@googlegroups.com
 Seems like it's not possible.

No, it's not possible after the instance has already been created. 

Why do you need it as eth0?

A requirement of some software that we're using (quite draconian, but a requirement nonetheless).

I've modified the packer source and got it to work by adding my own 'network_interface' option, but 'there be dragons' since you can no longer define a subnet and security group and there could be other complications.  I would try to submit a PR, but I think that this is such an edge case that it's most likely not worth the maintenance burden for the few people who would need it.  I think my best option is to pursue a custom builder plugin.

You received this message because you are subscribed to a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/PZbQvADzCw8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CALz9Rt-S5fnJ1BaeE%3DSqsxEFQ-soLAthW1KVEzanmfgfyG7MZQ%40mail.gmail.com.

Rickard von Essen

unread,
Jul 1, 2019, 9:38:40 AM7/1/19
to packe...@googlegroups.com
Yes this is probably very much an edge case but it should be fairly simple to add network_interface as a config option and disallow setting security_groups and security_group_filters if it is set. 

Reply all
Reply to author
Forward
0 new messages