Starting the Instance
- Open AWS EC2 and click launch instance
- Set your AMI and Instance type as you see fit
- For step 3, under advanced, paste or upload your userdata.sh file
- Start the instance
- Check logs at directory:
/var/log/amazon/ec2/ec2-macos-init.log
- The script is stored at:
/usr/local/aws/ec2-macos-init/instances/<Your-instance-name>/userdata
- Note: It’s always run as the root user from the root directory
Configure Userdata.sh
The following are some optional steps to get a script running properly
#!/bin/bash
should be on the first line of any shell/bash scripts
- Add a nice hello message thats easy to read
- Add
RED='\033[0;31m'
and call it like:echo -e "${RED}by SuMo"
to make echos easier to read
export PATH=/usr/local/bin:$PATH
Add to PATH, for things like brew/node