简体   繁体   中英

Attaching ENI on eth0 on EC2 instance startup

I need to attach a static private IP to an instance in an ASG. Since I can't specify it in the Launch Template, I'm using a user-data script to attach an existing ENI on instance startup. It works fine with --device-index 1 but then I get a total of two IPs.

Why is it not possible to have --device-index 0 to attach only the IP address I need?

According to the AWS Certified Solutions Architect Study Guide,

  1. "Every instance must have a primary.network interface"
  2. "You can't remove the primary ENI from an instance, and you can't change its su.net."

My best guess is that by the time you run your user-data script, you already have a primary.network interface attached.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM