Amazon Machine Image (AMI)
- AMI is the snapshot of the EBS Volume (Hard disk of ec2) which can be used to create ec2 instances
- AMIs are two types
- free
- community images
- paid (Market place)
- free
- AMIs belong to a region and every image will have unique id called as
ami-id - If we want same AMI across multiple regions we copy the ami to a new region and we get a new id
- AMIs created by us are private in nature, we can share this ami with other AWS Accounts or make it public
Manual creation of AMI
- Lets assume we need an apache server, with a website Refer Here and lets also install
- php info page (some information about current system)
- stress
- Lets create an ec2 instance and install all of the above softwares
- Manual steps
sudo apt update
sudo apt install apache2 unzip -y
sudo apt install php8.3 libapache2-mod-php8.3 php8.3-cli php8.3-{bz2,curl,mbstring,intl} stress -y
- Create a file called as info.php in
/var/www/html/info.phpwith following content
<?php
phpinfo();
?>
- Now lets copy the website
cd /tmp/
wget https://www.free-css.com/assets/files/free-css-templates/download/page296/listrace.zip
unzip listrace.zip
sudo mv listrace-v1.0/ /var/www/html/listings


* Lets create an ami in mumbai region





* As done in the class we can perform a quick test to launch an ec2 instance with this ami.
* Post succesful creation lets copy in hyderabad region



Azure VM Images
- Azure VM Images is snapshot of managed disk + additional metadata.
- In Azure VM Images we have two types of VM Images
- Generalized VM Images: These images will allow the user to set username and passwords/keys during creation
- Specialized VM Images: same as ami (usernames are fixed)
- Azure while creating the image will remove all the user specific information from vm and then take a snapshot
- So once we use a vm to create a generalized vm image, vm becomes unusable.
- Azure VM Images also are of two types
- free
- paid
- Azure also has a market place
- Refer Here for steps
Manual creation of Vm Image
- Lets assume we need an apache server, with a website Refer Here and lets also install
- php info page (some information about current system)
- stress
- Lets create an vm and install all of the above softwares
- Manual steps
sudo apt update
sudo apt install apache2 unzip -y
sudo apt install php8.3 libapache2-mod-php8.3 php8.3-cli php8.3-{bz2,curl,mbstring,intl} stress -y
- Create a file called as info.php in
/var/www/html/info.phpwith following content
<?php
phpinfo();
?>
- Now lets copy the website
cd /tmp/
wget https://www.free-css.com/assets/files/free-css-templates/download/page296/listrace.zip
unzip listrace.zip
sudo mv listrace-v1.0/ /var/www/html/listings


* Now we need to create a vm image Refer Here
- Azure Vm IMage has 4 properties
- publisher: Organization/individual who is publishing image
- offer: this represents the category
server/osiamge/ - sku: different release
- version: current versions
- Azure vm image has a unique id or URN
<publisher>:<offer>:<sku>:<version> -
To store vm images we create a compute gallery with a vm image defintion and a specific image version


- As discussed in the class we can create a vm with the vm image created
