I'd argue this is way easier on Mikrotik, than using OpenWRT and somehow integrating "mosquito" and "bash" [and cron and reading the dnsmasq leases].
#Sorry,but I have to correct you.
#All you have to do on openwrt is to log into openwrt-shell, using ssh or putty, for example, and type:
echo 'dhcp-script=/etc/mqttlease.sh' >> /etc/dnsmasq.conf
#Install optional package
opkg install mosquitto
#To communicate with AWS-IoT, you need
opkg install mosquitto-ssl
#instead
cat > /etc/mqttlease.sh <<END
#!/bin/sh
event="$1"
if [ $event != 'del' ] then
mac="$2"
ip="$3"
hostname="$4"
time="`date '+%Y-%m-%d %H:%M:%S'`"
message="$time $event $mac $ip $hostname"
mosquitto_pub -h 'YOURMQTTBROKER' -t 'YOURTOPIC' -m "$message"
#For AWS:
#mosquitto_pub --cafile 'PATHTOYOURAWSCAFILE' --cert 'PATHTOYOURAWSCLIENTCERTIFICATE' --key 'PATHTOYOURAWSCLIENTKEY' -h 'YOURMQTTBROKER' -t 'YOURTOPIC' -m "$message"
fi
END
#Just in case ...
chmod +x /etc/mqttlease.sh
#dnsmasq is a wide spread, tiny, open source dns-forwarder/cache and dhcp server, standard in every openwrt system.
#Thus, very well documented and maintained. Goggling for 'manpage dnsmasq' you will find more detailed info about dhcp-script.
#mosquitto is a well known and well documented open source mqtt util, too. Goggling for 'manpage mosquitto' will help you.
#Note, that deleted/expired leases will not be reported via mqtt. Further filtering to be done on broker.
I am thankful for this real world comparison of same functionality in ROS and openwrt.