Bootstrapping & User-Data/Meta-Data
Bootstrapping:
- Refers to a self-starting process or set of commands without external input.
- With EC2, we can bootstrap the instance (during the creation process) with custom commands (such as installing software packages, running updates, and configuring other various settings).
User-Data:
- A step/section during the EC2 instance creation process where you can include your own custom commands via script (i.e. a bash script).
- Here is an example of a bash script that will automate the process of updating the yum package installer, install Apache Web Server, and start the Apache Service.
#!/bin/bash
yum update -y
yum install -y httpd
service httpd start
Viewing User-Data & Instance Meta-Data
- When logged into an EC2 instance, you can view the instance user-data used during creation, or meta-data by executing one of the following commands:
- curl http://169.254.169.254/latest/user-data (displays bootstrapping commands)
- curl http://169.254.169.254/latest/meta-data (displays AMI, instance type, etc.)