You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove nameserver from resolv.conf at the end of AMI build
The conditional statement avoids cleaning if the `/etc/resolv.conf` is a symbolic link. It is a symbolic link when it is managed by other systems.
Cleaning the `/etc/resolv.conf` speeds up instance launch because it wouldn't try to use name server from the AMI creation environment. The delay was shown in `/var/log/cloud-init.log`:
```
2025-03-19 16:00:07,721 - util.py[DEBUG]: Resolving URL: http://169.254.169.254 took 40.099 seconds
2025-03-19 16:00:07,721 - util.py[DEBUG]: Resolving URL: http://[fd00:ec2::254] took 0.000 seconds
2025-03-19 16:00:17,731 - util.py[DEBUG]: Resolving URL: http://instance-data.:8773 took 10.010 seconds
```
Example content of `/etc/resolv.conf`:
```
cat /etc/resolv.conf
# Generated by NetworkManager
search ec2.internal
nameserver 192.168.0.2
```
Signed-off-by: Hanwen <[email protected]>
0 commit comments