github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/examples/terraform-http-example/user-data/user-data.sh (about)

     1  #!/bin/bash
     2  # This script is meant to be run in the User Data of an EC2 Instance while it's booting. It starts a simple
     3  # "Hello, World" web server.
     4  
     5  set -e
     6  
     7  # Send the log output from this script to user-data.log, syslog, and the console
     8  # From: https://alestic.com/2010/12/ec2-user-data-output/
     9  exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
    10  
    11  # The variables below are filled in using Terraform interpolation
    12  echo "${instance_text}" > index.html
    13  nohup busybox httpd -f -p "${instance_port}" &