How to Launch and Connect to an EC2 Instance on AWS











Amazon EC2 (Elastic Compute Cloud) allows you to create virtual servers in the cloud. This guide will walk you through launching an EC2 instance, creating a key pair, and securely connecting to the instance via SSH.

Step 1: Log in to AWS as Root or IAM User

First, log in to your AWS account. If you are using an IAM user instead of the root account, ensure that you have the necessary permissions to launch and manage EC2 instances.

Step 2: Navigate to EC2 Services

  • Open the AWS Management Console.
  • In the search bar, type EC2 and click on EC2 Instances.
  • This will take you to the EC2 dashboard, where you can create and manage instances.



Step 3: Launch a New EC2 Instance

  • Click on Launch Instance.


  • Enter a name for your instance to easily identify it later.
  • Select an Ubuntu machine for your operating system.

Choosing the Right OS

- If you are using the AWS Free Tier, ensure that the selected OS is Free Tier eligible.

- For this guide, we select Ubuntu 24.04 LTS.

- Check that your chosen version is eligible for Free Tier to avoid unexpected charges.




Step 4: Create a Key Pair for Secure Authentication

A key pair is essential for secure SSH access to your instance.

  • Click Create New Key Pair.
  • Enter a name for your key pair.
  • Choose RSA as the encryption type.
  • Select the key file format:
    • .pem for Linux/macOS users.
    • .ppk for Windows users who will use PuTTY.
  • Click Create Key Pair, and a .pem file will be downloaded.
  • Store this file securely, as it will be required for authentication when connecting to the instance.


Step 5: Configure Instance Storage and Launch

  • By default, the EC2 instance comes with 8GB of storage.
  • Free Tier users can increase this up to 30GB.
  • Leave other configurations as default and click Launch Instance.

Step 6: Connect to Your EC2 Instance

After launching the instance:

  • Open the EC2 dashboard and wait for your instance to appear in the list.
  • Select your instance and click on Connect.


  • Choose SSH Client as the connection method.

  • Update the key file permissions by running in your terminal:
chmod 400 your-key-filename.pem
  • Paste the SSH command into the terminal and press Enter.
  • You may see a security prompt:
Are you sure you want to continue connecting (yes/no/[fingerprint])?
    Type yes and press Enter.

Step 7: Successfully Connected to Your EC2 Instance


Once connected, you will have full access to your Ubuntu EC2 instance. From here, you can install software, configure the server, and start deploying applications.



Post a Comment

0 Comments