LAB Amazon EC2 Linux Instances

LAB Amazon EC2 Linux Instances

Posted on Jan 17, 2020 (0)

LAB Amazon EC2 Linux Instances

Let's get started with Amazon Elastic Compute Cloud (Amazon EC2) by launching, connecting to, and using a Linux instance. An instance is a virtual server in the AWS cloud. With Amazon EC2, you can set up and configure the operating system and applications that run on your instance.


  • Step 1: Launch an Instance
  • Step 2: Connect to Your Instance
  • Step 3: Clean Up Your Instance

Step 1: Launch an Instance

  • Open the Amazon EC2 console at
  • From the console dashboard, choose Launch Instance.

  • The Choose an Amazon Machine Image (AMI)page displays a list of basic configurations, called Amazon Machine Images (AMIs) that serve as templates for your instance. Select the HVM edition of the Amazon Linux AMI or the AMI for Amazon Linux 2.Notice that these AMIs are marked "Free tier eligible."

  • On the Choose an Instance Type page, you can select the hardware configuration of your instance. Select the micro type, which is selected by default. Notice that this instance type is eligible for the free tier.

  • Choose Review and Launch to let the wizard complete the other configuration settings for you.
  • On the Review Instance Launch page, under Security Groups, you'll see that the wizard created and selected a security group for you. You can use this security group, or alternatively you can select the security group that you created when getting set up using the following steps:
    • Choose Edit security groups.
    • On the Configure Security Group page, ensure that select an existing security group is selected.
    • Select your security group from the list of existing security groups, and then choose Review and Launch.

  • On the Review Instance Launchpage, choose Launch.
  • When prompted for a key pair, select Choose an existing key pair, then select the key pair that you created when getting set up.

Alternatively, you can create a new key pair. Select Create a new key pair, enter a name for the key pair, and then choose Download Key Pair. This is the only chance for you to save the private key file, so be sure to download it. Save the private key file in a safe place. You'll need to provide the name of your key pair when you launch an instance and the corresponding private key each time you connect to the instance.

  • When you are ready, select the acknowledgement check box, and then choose Launch Instances.
  • A confirmation page lets you know that your instance is launching. Choose View Instancesto close the confirmation page and return to the console.
  • On the Instances screen, you can view the status of the launch. It takes a short time for an instance to launch. When you launch an instance, its initial state is pending. After the instance starts, its state changes to running and it receives a public DNS name. (If the Public DNS (IPv4) column is hidden, choose Show/Hide Columns (the gear-shaped icon) in the top right corner of the page and then select Public DNS (IPv4).)



Windows users: We recommend saving your key pair in your user directory in a sub-directory called .ssh (ex. C:\user\{yourusername}\.ssh\MyKeyPair.pem).

Tip: You can't use Windows Explorer to create a folder with a name that begins with a period unless you also end the folder name with a period. After you enter the name (.ssh.), the final period is removed automatically.

It can take a few minutes for the instance to be ready so that you can connect to it. Check that your instance has passed its status checks; you can view this information in the Status Checks column.

Step 2: Connect to Your Instance

There are several ways to connect to a Linux instance. In this procedure, you'll connect using your browser. Alternatively, you can connect using Putty or an SSH client. It's also assumed that you followed the steps earlier and launched an instance from an Amazon Linux AMI, which has a specific user name.

To connect to your Linux instance using a web browser

  • You must have Java installed and enabled in the browser. If you don't have Java already, you can contact your system administrator to get it installed, or follow the steps outlined in the following pages: Install Java and Enable Java in your web browser.
  • From the Amazon EC2 console, choose Instances in the navigation pane.
  • Select the instance, and then choose Connect.
  • Choose A Java SSH client directly from my browser (Java required).
  • Amazon EC2 automatically detects the public DNS name of your instance and populates Public DNS for you. It also detects the key pair that you specified when you launched the instance. Complete the following, and then choose Launch SSH Client.
    1. In User name, enter ec2-user.
    2. In Private key path, enter the fully qualified path to your private key (.pem) file, including the key pair name.
    3. (Optional) Choose Store in browser cache to store the location of the private key in your browser cache. This enables Amazon EC2 to detect the location of the private key in subsequent browser sessions, until you clear your browser's cache.
  • If necessary, choose Yes to trust the certificate, and choose Run to run the MindTerm client.
  • If this is your first time running MindTerm, a series of dialog boxes asks you to accept the license agreement, confirm setup for your home directory, and confirm setup of the known hosts directory. Confirm these settings.
  • A dialog prompts you to add the host to your set of known hosts. If you do not want to store the host key information on your local computer, choose No.
  • A window opens and you are connected to your instance.

Connect your Instance via SSH

After launching your instance, connect it using SSH.And if you are using the Windows machine to connect , Follow these steps:

  • Download the Git from following link :
  • Run the downloaded installer accepting the default settings
  • open a Git Bash command prompt
  • Use SSH to connect to your instance. In this case the user name is ec2-user, the SSH key is stored in the directory we saved it to in step 2 part d, and the IP address is from step 2 part f. The format is ssh -i {full path of your .pem file} ec2-user@{instance IP address}.

example: $ ssh -i 'C:\Users\alrastog\.ssh\dclessons-new-key.pem' ec2-user@

Step 3: To terminate your instance

  • In the navigation pane, choose Instances. In the list of instances, select the instance.
  • Choose ActionsInstance StateTerminate.
  • Choose Yes, Terminate when prompted for confirmation.

Amazon EC2 shuts down and terminates your instance. After your instance is terminated, it remains visible on the console for a short while, and then the entry is deleted.




    You are will be the first.


Please login here to comment.