How to Launch an EC2 Instance Using a Custom AMI

Related Courses

How to Launch an EC2 Instance Using a Custom AMI

Cloud computing follows the Agile software development lifecycle, enabling rapid server deployment and scalability. For instance, Netflix utilizes AWS EC2 with Autoscaling to automatically add or remove instances based on user demand. In this article, we’ll explore how to launch an EC2 instance using a custom AMI.

Naresh I Technologies is the number one computer training institute in Hyderabad and ranks among the top five computer training institutes in India. Contact us for comprehensive AWS training today!

Ways to Deploy Applications on an EC2 Instance

There are several ways to get your application and its settings onto an EC2 instance:

  1. Configuration Management Tools: Tools like Chef and Puppet allow lifecycle management of applications (install, upgrade, rollback) on thousands of machines.
  2. User Data Scripts: Pass shell scripts to the EC2 instance to install and configure applications during startup.
  3. Custom AMI: An Amazon Machine Image (AMI) includes all necessary details like OS, applications, and settings. It is the quickest method to launch an EC2 instance.

Below, we detail the steps to create a custom AMI and launch an EC2 instance using it.

Steps to Launch an EC2 Instance Using a Custom AMI

Step 1: Launch an EC2 Instance Using an Existing AMI

  1. Use an existing Linux or Windows AMI to launch an EC2 instance.
  2. Log in to the instance (e.g., using PuTTY for Windows).

Step 2: Install the Required Application

Install your desired application and make configuration changes. For example, install Apache Tomcat on an Ubuntu EC2 instance:

sudo apt update  
sudo apt install tomcat9  
sudo systemctl start tomcat9  
  • Verify the installation: Access http://ec2-public-ip:8080 in a browser.
  • Ensure port 8080 is open in the Security Group’s inbound rules.

Step 3: Create a Custom AMI

  1. Stop the EC2 Instance: Ensures consistency during image creation.
  2. In the AWS Management Console, navigate to:
    • ActionsImageCreate Image.
  3. Provide the Image Name and Description.
  4. Restart the instance after the image is created.
  5. Navigate to the AMI tab in the left panel to monitor its status.
    • The AMI starts in a pending state and changes to available.

Visibility Settings: By default, the AMI is private. You can make it public or share it with specific users:

  • ActionsManage Image Permissions.

Step 4: Launch a New EC2 Instance Using the Custom AMI

  1. Go to the EC2 Management ConsoleLaunch Instance.
  2. Under My AMIs, select the custom AMI created earlier.
  3. Follow the standard EC2 instance launch process.
  4. Verify your application (e.g., Tomcat) by accessing the instance’s public 

    http://ec2-public-ip:8080
    


    Important Notes
  1. Deregister the AMI: Once the EC2 instance is terminated, deregister the AMI to avoid unnecessary storage costs.
  2. Terminate Unused Instances: If an EC2 instance remains active, it incurs costs even if unused.

Why Use a Custom AMI?

Creating a custom AMI simplifies deployment:

  • Faster Launch: Applications and configurations are pre-installed.
  • Consistency: Launch identical instances every time.
  • Scalability: Ideal for Autoscaling environments.

Learn AWS at Naresh I Technologies

Naresh I Technologies offers comprehensive AWS training for freshers and professionals. As the number one computer training institute in Hyderabad, we provide:

  • Classroom and Online Training
  • Hands-on Practical Sessions in world-class labs
  • Corporate Training with theoretical and practical modules
  • Job Placement Assistance for freshers

Start your AWS journey today! Contact us by submitting the online form on our website or giving us a missed call. Our counselors will guide you in choosing the right AWS certification.

Naresh I Technologies – Shaping Careers, Building Futures!
Contact us today for expert AWS training.