Wednesday, 16 September 2020

Custom AMI creation

A lot of optimization can possible in AWS AMI.

Custom AMI can be built for both windows or Linux. 


Using a custom built AMI can provide the following advantages:

  • Faster boot time (no need for EC2 user data at boot time)
  • Machine comes configured with monitoring /enterprise software.
  • Control of maintenance and updates of AWIs over time.
  • in case of pre-installed packages needed.
  • security concerns - control over the machines in the network.
  • Active Directory integration out of box.
  • installing your app ahead of time.
Note: AMI are built for a specific  AWS region.

Create AMI Hands on:


Step1: Launch EC2 instance.
Step2: Run all the required commands or scripts for customization required on the standard AMI(Operating system).


Example: Suppose i need Operating system with upgrade machine & install java 8 jdk by default in the AMI (operating system).

Run the below commands:

#upgrade machine
Sudo yum update -y

#install java 8 jdk
sudo yum install -y java-1.8.0-openjdk-devel

#set java jdk 8 as default

sudo /usr/sbin/alternatives --config java
sudo /usr/sbin/alternatives --config javac



Step3: Now go to EC2 instance launch page --> Right click on the EC2 instance where Step2 performed.

Then image --> Create image as below:






Step 4: Image name and description.
                 inputs for delete on termination. 


Step 5: Click on create image.                                                                                                           


Step 6: Conformation screen looks likes the below:& Click on View pending image ami link as highlighted below.                                                                                           


Step 7: After few minutes, our customized AMI is available.                                                                                   


Step 8: Right click on the AMI and go with Launch option.                                                                                      


Step 9: Result screen will navigate to Choose Instance Type page by skipping standard AMI  & Choose custom  AMI 





No comments:

Post a Comment