Aws EC2 ubuntu instance開機禁止啟動ufw

首先停止instance

Action->Instance settings->view/change user data

加入

#cloud-config bootcmd: 
- cloud-init-per always fix_broken_ufw_1 sh -xc "/usr/sbin/service ufw stop >> /var/tmp/svc_$INSTANCE_ID 2>&1 || true" 
- cloud-init-per always fix_broken_ufw_2 sh -xc "/usr/sbin/ufw disable>> /var/tmp/ufw_$INSTANCE_ID 2>&1 || true"

重新啟動instance