Sitemap

AWS Hands-On | EC2 Instance Storage | AMI Creation Process

4 min readMay 21, 2025

📌 Notice

This is a hands-on tutorial accompanying the blog post:

Pass the AWS Certified Solutions Architect Associate Certification SAA-C03-(Episode 6: EC2 Instance Storage)

🔹 Focus: Practical implementation of EC2 AMI Creation.
🔹 For theoretical concepts and exam-style questions, please refer to the main blog post (link to parent blog).

Here’s a step-by-step explanation of the AMI creation process from an existing EC2 instance using the AWS Management Console

1. Launch a New EC2 Instance (If Target Instance Doesn’t Exist)

AWS Console Steps:

1. Go to the EC2 Dashboard

2. Launch an Instance

  • Click “Launch Instance”
  • Enter a name for your instance (e.g., AMI-Source-Server)
  • Choose an Amazon Machine Image (AMI)
  • Select an OS (e.g., Amazon Linux, Ubuntu, Windows)
  • Choose an AMI (Free Tier eligible if applicable)
  • Select an Instance Type

Note :
For testing, t2.micro (Free Tier eligible)
For production, choose a suitable type (e.g., t3.medium, m5.large)

  • Configure Key Pair (for SSH Access)
  • Select an existing key pair or create a new one
  • Download the .pem file (required for Linux SSH access)
  • Network Settings (Security Group)
  • Select a VPC and subnet (default is fine for testing)
  • Configure Security Group:
  • Allow SSH (Port 22) for Linux
  • Allow RDP (Port 3389) for Windows
  • Add HTTP (Port 80) if it’s a web server
  • Configure Storage
  • Default root volume (usually 8GB for Linux, 30GB for Windows)
  • Add additional EBS volumes if needed
  • Click “Launch Instance”
  • Wait for the instance to reach the “Running” state

2. Connect & Customize the EC2 Instance

Step 1: Locate Your .pem Key File

For Linux (SSH)

  • Your key is saved in the Downloads folder (unless you chose a different location).
  • On Linux/macOS, it’s typically at:
~/Downloads/AMI-Source-Server-Key.pem

Step 2: Set Correct Permissions (Linux/macOS Only)

For security, SSH requires the .pem file to have restricted permissions. Run:

chmod 400 ~/Downloads/AMI-Source-Server-Key.pem

Step 3: Find Your EC2 Instance’s Public IP

  1. Go to AWS EC2 Dashboard > Instances
  2. Select your instance
  3. Copy the Public IPv4 address (e.g., 47.129.46.47)

Step 4: Run the SSH Command

ssh -i ~/Downloads/AMI-Source-Server-Key.pem ec2-user@47.129.46.47

Customizations (Examples)

  • Install software (sudo yum install -y nginx for Amazon Linux)
  • Copy application files
  • Configure users, permissions, and services
  • Apply security patches (sudo yum update -y)

3. Stop the Instance for Data Integrity

  1. Go to EC2 Dashboard > Instances
  2. Select your instance
  3. Click “Instance State” > “Stop Instance” (not reboot)

4. Create an AMI (with EBS Snapshots)

  1. Select the stopped instance
  2. Click Actions > Image and templates > Create image

3. Configure:

  • Name: my-custom-ami-v1
  • Description: (Optional)
  • No reboot: Unchecked (since we stopped it manually)
  • Click “Create Image”

AWS will:

  • Create snapshots of all attached EBS volumes
  • Register the AMI (visible in AMIs > Owned by me)

5. Launch New Instances from the AMI

  1. Go to EC2 > AMIs
  2. Select your custom AMI
  3. Click “Launch instance from AMI”
  4. Follow the standard EC2 launch process

6. Copy AMI and Launch EC2 in Another Region

Cleanup (Optional)

  • Deregister AMI: EC2 > AMIs > Select AMI > Actions > Deregister
  • Delete Snapshots: EC2 > Snapshots > Select associated snapshots > Delete

To stay informed on the latest technical insights and tutorials, connect with me on Medium and LinkedIn. For professional inquiries or technical discussions, please contact me via email. I welcome the opportunity to engage with fellow professionals and address any questions you may have.

--

--

Paul issack minoltan
Paul issack minoltan

Written by Paul issack minoltan

I am a Professional Software Engineer

No responses yet