What Is Bootstrapping? – When You Launch An Instance Using AMI, You Might Have Noticed That The Launched Instance Is Fresh And There Is No Configuration On That Instance.
- So Basically It Comes With The Default Configuration And It Is Not Your Projected Instance.
- But You Have To Install Certain Package And Want To Do Some Configuration.
- Means You Want To Do Some Configuration On The Top Of This EC2 Instance And You Want To Make That That Instance Your Projected.
- This May Take Some Valuable Time And Efforts.
- And In Order To Automate This Installation And Configuration
- We Can Pass Some Codes At The Time of Launch Of The Instance To Initiate This Task.
- So This Process Is Known As Bootstrapping.
- Let’s Say You Are Launching An Instance.
- Whether It May A Linux Instance Or Windows Instance, So We launch It This Instance Is Fresh And New.
- Nothing Is Installed On The Top Of This.
- Once The Installation Is Done.
- What We Normally Do, You Take Its Remote, You First Of Install Some Packages, Enable Some Services, You Copy Some Data.
- Then You Feel That Some Instance Is Ready To Use.
- So Basically This Is A Time Taking Procedure.
- And You Do Not Want To Waste Your Time.
- If You Seeking A Kind Of A Method.
- Which You Complete All These Tasks.
- Assigned Tasks, In The Installation Time.
- So That Can Be Done.
- That Can Be Done With The Help Of The Bootstrapping.
- Bootstrapping Enables You To Script Software Installation Configuration.
- At The Time Of Launch Of Your Instance.
- Let’s Say If You Have An Script, let’s Say You Are Taking An Script In Case Of Linux
- That Script Tell You How You Can Install These Required Softwares Configuration.
- So If You Pass That Script During The Launch Of The Instance.
- The Entire The List Of Tasks You Are Completed.
- So You Not To Take Remote Your Machine To Configure Furthur.
- This Is Called Bootstrapping.
- I’ll Tell You How The Things Can Be Done.
- Let’s Say We Have One Script Who Configure Your Server.
- I’m Taking A Simple Script In Note Pad
- I’m Just Writing A Simple Script
- Youll Understand
- What You Normally Do To Configure Your Server As An Apache Server.
- Lets Say, First Of All
Open Your Note Pad And Write
#!/bin/bash
sudo yum install -y httpd //THIS COMMAND WILL INSTALL HTPPD PACKAGE IN YOUR LINUX MACHINE//
sudo service httpd start // ONCE THE PACKAGE IS INSTALLED YOU’LL SWITCH ON THE SERVICE //
checkconfig htppd on
echo “This is my bootstrapped VM of linux” > /var/www/html/index.html
- These Lines About Configuration We Already Done Multiple Times.
- These Are The Lines You Need To Pass Through Install One Httpd Server
- Once It Is Installed What Youll Do
- Youll Just Write Line echo “This is my bootstrapped VM of linux” >
- You Just Pass This Line To index.html
- Which Implies In /var/www/html/index.html
- These Are The Four Lines You Need To Write
- To Configure Your Linux Instance As Your Apache Server
- This Is Very Simple Configuration I Need To Pass
- This Is A Kind Of Script You Need To Pass
- Either You Need To Store These Lines In A Particular File
- So That You Can Share The File
- During The Launch Of The Instance
- If This Script Is Really Small,
- You Can Copy & Paste The Script
- And That Can Be Done
- Means Your Machine Will Be Configured
- But Please Ensure That There Should Not Be Any Mistake
- In This Script
- There Should Not Be Any Mistake
- Do You See Any Mistake Here
Just Go To EC2 Dashboard On AWS Site
- Click On Instances
- Click On Launch Instance
- Select Linux AMI Free Tier
- Select t2.micro In Instance Type
- It Free of Cost That’s Why I’m Selecting It
- Click On Configure Instance Details
- now The 3rd Step, This Is Important
- To Place Your Machine In A Particular VPC
- Particular Availability Zone Or Subnet
- Select All These Settings On This 3rd Step On The Page As It Is
- Don’t Make Any Changes
- But Where You Can Pass That Script
- Scroll Down On This Step 3
- If You Scroll Down, There Is Advanced Details Option
- You Just Click And Open This Advanced Option
- And Here(User data) Either You Can Pass The File
- If You File As a Script, You Just Click On ‘As File’ Option
- And Choose A File
- Might Be Your File Is Stored In Your Laptop Or Desktop
- You Can Upload The File
- Or If The Script Is Really Small
- You Can Paste The Script Here(User Data)
- Then Click On Add Storage
- Select 8gb
- Click On Configure Security Group
- You Need To Configure The Security Group In Order To See The Result
- Click On Add Rule
- Select HTTP
- Because In HTTP Port Number 80 Should Be Open
- You Just Open This Port No 80
- Click On Review & Launch
- Select Key Pair, Check Box
- Finally, Click On Launch
- You Launched The Instance
- I Hope Everything Is Fine
- In Few Seconds The Machine Will Be Ready
- Once The Machine Is Ready
- Youll Take Its Remote
- Youll Check Directly On Your Browser
- To Check Whether This Machine Is Configured Or Not
- If Your Machine Is Configured, Your Script Is Working Fine.
- The Machine Will Be Ready
- Copy The IP Address Of The Machine You Created Now
- And Just Open Browser
- Paste The IP Address And See Its Working Or Not
- It Should Work
- You’ll See “This is bootstrapped VM of Linux” on The Page
- It’s Working
You Have To Be Very Good In Scripting If You Are Writing A Script.
Do Some Assignments
- Create A VM(LINUX) With a Private Key – how will you regain access over the instance again
- Create A Window 2012/2016 Instance & Configure It As Web Server & Test It.
- Create VM and Add 10gb ebs Volume To It.
- Launch Linux Instance & Pass A Bootstrap Script To Configure Machine As A Apache Server
- Search/Find Apache Server Script From Was Documentation And Implement It.
You Can Check AWS Bootstrap Scripts For Linux On Google