Saturday, May 16, 2020

How To Use BootStrap Scripts in AWS EC2 Instance during Launch - Running commands on your Linux instance at launch | How to Run commands on your Linux instance at launch

What is bootstrap script in aws?

if you want to execute some commands during boot up(also launch), you can execute it easily by mentioning during step 3 of EC2 launch. Bootstrap scripts run only once - when the instance is instantiated for the 1st time.

Please follow the below steps to create an EC2 instance.  We will be installing Java, Maven, Jenkins and Apache during boot up.

Steps to add bootstrap script during EC2 launch

1: Go to AWS console. click on All services, Click on Compute -->  Click on EC2



2. Click on Launch instance. Choose an Amazon machine image (AMI), click next

3. select Ubuntu Server 18.04 LTS (HVM), SSD Volume Type


click next
4. choose an instance type as t2.small, 2GB memory. click next

5. in step 3, go down, under advanced details.  Copy the script
from this link.

6. Now continue like how you provision EC2 instance.
7. once you provision, you will be able to see Java, Maven and Jenkins installed in EC2 instance after launch.

Login to EC2 instance when you type 
java -version
mvn --version


Go to the browser and try to access Jenkins in the browser, Jenkins should be coming up.(make sure you open port 8080 in the firewall rules)

Java, Maven and Jenkins should be installed successfully.


No comments:

Post a Comment

DevOps Coaching Program Model Information | AWS Cloud Azure Cloud DevOps Coaching Program Model Information

Thanks for showing interest in learning DevOps. Believe it or not, anyone can become a successful DevOps engineer after finishing the excit...