Skip to content

Instantly share code, notes, and snippets.

@martezr
Last active October 1, 2025 02:22
Show Gist options
  • Select an option

  • Save martezr/cd6eedcadbad5bf37740bfe728693fe7 to your computer and use it in GitHub Desktop.

Select an option

Save martezr/cd6eedcadbad5bf37740bfe728693fe7 to your computer and use it in GitHub Desktop.
apt update && apt -y upgrade && apt -y autoremove && apt clean
apt-get install -y nano iputils-ping qemu-guest-agent
cat << EOF > /etc/cloud/cloud.cfg.d/10_aws.cfg
datasource:
Ec2:
metadata_urls: ["http://169.254.169.254:80"]
max_wait: 10
timeout: 5
EOF
rm /etc/netplan/50-cloud-init.yaml
truncate -s0 /etc/machine-id
rm /var/lib/dbus/machine-id
ln -s /etc/machine-id /var/lib/dbus/machine-id
#cat << EOF >> /etc/dhcp/dhclient.conf
#supersede rfc3442-classless-static-routes 16,169,254,0,0,0,0,0,0;
#EOF
cat << EOF > /etc/systemd/system/nl-agent.service
# /etc/systemd/system/nl-agent.service
[Unit]
Description=Nightlight Agent Service
After=network.target
[Service]
Type=simple
Restart=on-failure
RestartSec=10
startLimitIntervalSec=60
ExecStartPre=/bin/mkdir -p /opt/nightlight
WorkingDirectory=/opt/nightlight
ExecStart=/opt/nightlight/nl-agent
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable nl-agent.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment