简体   繁体   English

在 EC2 实例启动时在 eth0 上附加 ENI

[英]Attaching ENI on eth0 on EC2 instance startup

I need to attach a static private IP to an instance in an ASG.我需要将 static private IP 附加到 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.因为我无法在启动模板中指定它,所以我使用用户数据脚本在实例启动时附加现有的 ENI。 It works fine with --device-index 1 but then I get a total of two IPs.它与--device-index 1一起工作正常,但我总共得到了两个 IP。

Why is it not possible to have --device-index 0 to attach only the IP address I need?为什么不能让--device-index 0只附加我需要的 IP 地址?

According to the AWS Certified Solutions Architect Study Guide,根据 AWS 认证解决方案架构师学习指南,

  1. "Every instance must have a primary.network interface" “每个实例都必须有一个 primary.network 接口”
  2. "You can't remove the primary ENI from an instance, and you can't change its su.net." “您无法从实例中删除主 ENI,也无法更改其 su.net。”

My best guess is that by the time you run your user-data script, you already have a primary.network interface attached.我最好的猜测是,当您运行用户数据脚本时,您已经附加了一个 primary.network 接口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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