在我的实例启动期间,我会自动分配一个辅助私有 IPv4 地址。要配置 Ubuntu 以识别这个辅助 IP,我需要运行
ip addr add 10.0.1.15/24 dev eth0
Run Code Online (Sandbox Code Playgroud)
To access the primary private IP address I have found this command (described in the AWS Docs and in figaros question):
curl http://169.254.169.254/latest/meta-data/local-ipv4
Run Code Online (Sandbox Code Playgroud)
But how can I get the secondary IP address to run the ip command automatically on startup? For Amazon Linux Systems there's the ec2-net-utils package wich can handle this automatically.