Bootstrap script or user-data is the custom script to perform custom installation or modifications to an EC2 instance at the time of provisioning. This script will get executed on top of the base AMI.
The user-data or the bootstrap script gets copied to the instance immediately after provisioning and gets executed. The script is located in the following location in case of Linux operating systems (Ubuntu, RHEL, CentOS, Amazon Linux etc)
/var/lib/cloud/instances/[instance-id]/user-data.txt
To monitor the progress of the execution, you can check the logs present in the following files.
/var/log/cloud-init.log /var/log/cloud-init-output.log
The above user-data files and logs are very useful to debug and monitor the execution of the bootstrap scripts. Sometimes the bootstrap script execution will wait for the completion of the execution of some scripts which are part of the AMI. It may even wait for several minutes. So we may get confused whether the bootstrap execution got failed or not.
I hope the above article is useful. Feel free to comment below this post if you have any questions or feedback.