Redirect AWS userdata output to log file

When using a userdata script in you Autoscaling launch configuration, by default if your script has some output, it will not be visible somewhere. With this simple script you can redirect the outpout to a log file: #!/bin/bash -ex source /etc/profile exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 echo BEGIN #Your code comes […]