> ## Documentation Index
> Fetch the complete documentation index at: https://cloud-architect.ipoint-labs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Launching EC2 Machine and Connecting through Browser-Based SSH

> Hands-on lab · 15m

Launch this lab in the IP Lab Portal, then follow the steps below in the AWS console.

<a className="ip-lab-portal-btn" href="https://labs.intellectualpoint.com/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh" target="_blank" rel="noreferrer">
  Open IP Lab Portal
</a>

## Overview

### Lab details

1. This lab walks you through the steps to launch and configure a virtual machine in the Amazon cloud.
2. You will practice using Amazon Machine Images to launch an Amazon EC2 Instances.
3. You will connect to your Instance through Browser-Based SSH.
4. Duration: **15 minutes**
5. AWS Region: **US East (N. Virginia) us-east-1**

### Introduction

#### What is EC2?

An EC2 (Elastic Compute Cloud) instance is a virtual server provided by Amazon Web Services (AWS) that allows you to run applications and services in the cloud. EC2 instances are highly scalable, flexible, and can be easily configured to meet your computing requirements. To connect to an EC2 instance, AWS provides a browser-based SSH (Secure Shell) client called EC2 Instance Connect, which allows you to establish a secure shell connection to your instance directly from the AWS Management Console.

#### Here are some additional tips:

* You can also connect to an EC2 instance using a traditional SSH client.
* You can generate a new SSH key pair and upload it to AWS. This will allow you to connect to your instances without having to type in your password.
* You can use EC2 Instance Connect to connect to instances that have private IP addresses.

### Architecture diagram

<img src="https://mintcdn.com/ip-cloud-architect-pathway/sjxZZnuQfFzzjiqS/images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/001.png?fit=max&auto=format&n=sjxZZnuQfFzzjiqS&q=85&s=895bd154bb9e0d493903a708f6909f5f" alt="" width="911" height="1034" data-path="images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/001.png" />

### Task details

1. Sign into AWS Management Console.
2. Launch an Amazon Linux Instance from an Amazon Linux AMI 2
3. Find your instance in the AWS Management Console.
4. Connecting to your Instance through EC2 Instance Connect.
5. Validation of the lab

### Launching the lab environment

1. To launch the lab environment, Click on the **Launch lab** button.
2. Please wait until the cloud environment is provisioned. It will take less than a minute to provision.
3. Once the Lab is started, you will be provided with **IAM user name**, **Password**, **Access** **Key**, and **Secret** **Access** **Key**.

<Note>
  You can only start one lab at any given time
</Note>

## Lab guide

### Lab steps

#### Task 1: Sign in to AWS Management Console

1. Click on the **Open console**, and you will get redirected to AWS Console in a new browser tab.
2. On the AWS sign-in page,

   * Leave the Account ID as default. Never edit/remove the 12 digit Account ID present in the AWS Console. otherwise, you cannot proceed with the lab.
   * Now copy your **User Name** and **Password** in the Lab Console to the **IAM Username and Password** in AWS Console and click on the **Sign in** button
3. Once Signed In to the AWS Management Console, Make the default AWS Region as **US East (N. Virginia) us-east-1.**

#### Task 2: Launching an EC2 Instance

1. Make sure you are in the **US East (N. Virginia) us-east-1 Region**.

2. Navigate to **EC2** by clicking on the **Services** menu in the top, then click on **EC2** in the **Compute** section.

3. Click on **Instances** in the left side panel and click on  **Launch Instance.**

4. Enter **Name** as **whizlabs.**

5. Choose an Amazon Machine Image (AMI): Select **Amazon Linux 2023 kernel-6.1 AMI** in the drop-down.

* Choose **architecture** as **64-bit(x86)**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/sjxZZnuQfFzzjiqS/images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/002.png?fit=max&auto=format&n=sjxZZnuQfFzzjiqS&q=85&s=7fc47dffc2770f4d2c47c551bf858efc" alt="" width="1179" height="587" data-path="images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/002.png" />

6. Choose an **Instance Type**: Select ***t2.micro***\*\*.\*\*

<img src="https://mintcdn.com/ip-cloud-architect-pathway/sjxZZnuQfFzzjiqS/images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/003.png?fit=max&auto=format&n=sjxZZnuQfFzzjiqS&q=85&s=a09f43626a29bfa39733b8a791add5e2" alt="" width="970" height="240" data-path="images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/003.png" />

7. Key Pair: Select **Proceed without a Key Pair**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/sjxZZnuQfFzzjiqS/images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/004.png?fit=max&auto=format&n=sjxZZnuQfFzzjiqS&q=85&s=7921e5e0c4137f8f656c5ed260b615c5" alt="" width="978" height="242" data-path="images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/004.png" />

8. In Network Settings Click on **Edit** Button:

* Auto-assign public IP: **Enable**
* Select **Create new Security group**
* Security group name : Enter ***MyEC2Server\_SG***
* Description : Enter ***Security Group to allow traffic to EC2***

<img src="https://mintcdn.com/ip-cloud-architect-pathway/sjxZZnuQfFzzjiqS/images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/005.png?fit=max&auto=format&n=sjxZZnuQfFzzjiqS&q=85&s=fb28a6f462268a7c45e87015a1c52101" alt="" width="975" height="472" data-path="images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/005.png" />

* To add **SSH**,

  1. Choose Type: **SSH**
  2. Source: Select **Anywhere**

9. Click on the **Launch Instance** button. Your instance is now launching. Click on **View Instances.** In the dashboard find your instance and wait for complete initialization of the instance until the instance state changes to running.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/sjxZZnuQfFzzjiqS/images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/006.jpg?fit=max&auto=format&n=sjxZZnuQfFzzjiqS&q=85&s=dc462970ecadaf5ea83a110ba25b6393" alt="" width="1154" height="83" data-path="images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/006.jpg" />

10. Your instance is successfully launched and running.

#### Task 3: EC2 Instance Connect

1. By using EC2 Instance Connect, we can directly connect to our instance from the console.

2. Select your instance.

3. Click on **Connect**.

4. You will see 4 types of Connection methods. Choose **EC2 Instance Connect (browser-based SSH connection)** and click on **Connect**.

   <img src="https://mintcdn.com/ip-cloud-architect-pathway/sjxZZnuQfFzzjiqS/images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/007.png?fit=max&auto=format&n=sjxZZnuQfFzzjiqS&q=85&s=8b21d6423d4c331ac7d7e762765eeb6b" alt="" width="1866" height="690" data-path="images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/007.png" />

5. Your Instance will be connected to SSH through your Browser.

6. Please follow the steps in [SSH into EC2 Instance](/aws-cp/support/ssh-into-ec2-instance) for more options to SSH.

   <img src="https://mintcdn.com/ip-cloud-architect-pathway/sjxZZnuQfFzzjiqS/images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/008.png?fit=max&auto=format&n=sjxZZnuQfFzzjiqS&q=85&s=162f6a170a575cd98ae9594b1ed617c6" alt="" width="1502" height="591" data-path="images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/008.png" />

#### Task 4: Running Commands

1. Switch to root user:

   ```
   sudo -s
   ```
2. Run updates using the following command:

   ```
   sudo dnf update -y
   ```
3. To find your current working directory, enter the command **pwd**
4. Enter the **exit** command then again **exit** to log out.

In this way, you can connect to your instance using SSH from your console without using a key pair.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/sjxZZnuQfFzzjiqS/images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/009.png?fit=max&auto=format&n=sjxZZnuQfFzzjiqS&q=85&s=bd987f9945fa95c4bc9ec2a05fcc39c5" alt="" width="1871" height="592" data-path="images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/009.png" />

<Tip>
  **Do you know?**

  The browser-based SSH connection provides a secure and auditable method for accessing your EC2 instances. All session data, including input and output, is logged and can be audited later for compliance and troubleshooting purposes.
</Tip>

#### Task 5: Validation Test

1. Once the lab steps are completed, please click on the **Check my work** button on the right side panel.
2. This will validate the resources in the AWS account and shows you whether you have completed this lab successfully or not.
3. Sample output :

   <img src="https://mintcdn.com/ip-cloud-architect-pathway/sjxZZnuQfFzzjiqS/images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/010.gif?s=7f4b2d9fdb5714672f2695bd554756f0" alt="" width="800" height="397" data-path="images/labs/launching-ec2-machine-and-connecting-through-browser-based-ssh/010.gif" />

### Completion and conclusion

1. You have successfully launched an EC2 Instance.
2. You have connected to the Instance through Browser without using a key pair.
3. You ran a few other helpful commands.

### End lab

1. Sign out of the AWS Account.
2. You have successfully completed the lab.
3. Once you have completed the steps, click on **End lab** in the IP Lab Portal.

## What gets checked

When you press **Check my work**, the platform verifies each of these:

* **Launch an EC2 Instance** — Check whether an EC2 Instance is launched or not.

## Related help

* [FAQs and Troubleshooting](/aws-cp/support/faqs-and-troubleshooting)
