Launch a Linux Virtual Machine

Launch a Linux Virtual Machine

with Amazon EC2

Amazon Elastic Compute Cloud (EC2) is the Amazon Web Service you use to create and run virtual machines in the cloud. AWS calls these virtual machines ‘instances’. This step-by-step guide will help you successfully launch a Linux virtual machine on Amazon EC2 within our AWS Free Tier.

Did you know? AWS made it even easier to launch a Linux virtual private server. Jumpstart your virtual machine with Amazon Lightsail >>

Manage Your AWS Resources

Sign in to the Console

Step 1: Launch an Amazon EC2 Instance


a. Click here to open the Amazon EC2 console and then click Launch Instance to create and configure your virtual machine.

launch-instance
(click to zoom)

Step 2: Configure your Instance

You are now in the EC2 Launch Instance Wizard, which will help you configure and launch your instance.


a. In this screen, you are shown options to choose an Amazon Machine Image (AMI). AMIs are preconfigured server templates you can use to launch an instance. Each AMI includes an operating system, and can also include applications and application servers.

For this tutorial, find Amazon Linux AMI and click Select.

amazon-linux-ami
(click to zoom)

b. You will now choose an instance type. Instance types comprise of varying combinations of CPU, memory, storage, and networking capacity so you can choose the appropriate mix for your applications. For more information, see Amazon EC2 Instance Types.

The default option of t2.micro should already be checked.  This instance type is covered within the Free Tier and offers enough compute capacity to tackle simple workloads. Click Review and Launch at the bottom of the page.

ec2-t2-micro
(click to zoom)

c. You can review the configuration, storage, tagging, and security settings that have been selected for your instance. While you have the option to customize these settings, we recommend accepting the default values for this tutorial.

Click Launch at the bottom of the page.

review-launch
(click to zoom)

d. On the next screen you will be asked to choose an existing key pair or create a new key pair. A key pair is used to securely access your Linux instance using SSH. AWS stores the public part of the key pair which is just like a house lock. You download and use the private part of the key pair which is just like a house key.

Select Create a new key pair and give it the name MyKeyPair. Next click the Download Key Pair button.

After you download the MyKeyPair key, you will want to store your key in a secure location. If you lose your key, you won’t be able to access your instance. If someone else gets access to your key, they will be able to access your instance.

Select your operating system below to see instructions on where to save your SSH key.

  • Windows

    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.

  • Mac / Linux

After you have stored your key pair, click Launch Instance to start your Linux instance.

Getting-Started-VM9
(click to zoom)



e. Click View Instances on the next screen to view your instances and see the status of the instance you have just started.

Getting-Started-VM8
(click to zoom)

f. In a few minutes, the Instance State column on your instance will change to “running” and a Public IP address will be shown. You can refresh these Instance State columns by pressing the refresh button on the right just above the table. Copy the Public IP address of your AWS instance, so you can use it when we connect to the instance using SSH in Step 3.

Getting-Started-VM6
(click to zoom)

Step 3: Connect to your Instance


After launching your instance, it’s time to connect to it using SSH.

Windows users:  Select Windows below to see instructions for installing Git Bash which includes SSH.

Mac/Linux user: Select Mac / Linux below to see instructions for opening a terminal window.

  • Windows

    a. Download Git for Windows here. Run the downloaded installer accepting the default settings (this will install Git Bash as part of Git).

    Getting-Started-VM1
    (click to zoom)

    b. Right click on your desktop (not on an icon or file) and select Git Bash Here to open a Git Bash command prompt.

    Getting-Started-VM2
    (click to zoom)

    c. 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}.

    Enter ssh -i ‘c:\Users\yourusername\.ssh\MyKeyPair.pem’ ec2-user@{IP_Address} (ex. ssh -i ‘c:\Users\adamglic\.ssh\MyKeyPair.pem’ ec2-user@52.27.212.125)

    You’ll see a response similar to the following:

    The authenticity of host ‘ec2-198-51-100-1.compute-1.amazonaws.com (10.254.142.33)’ can’t be established. RSA key fingerprint is 1f:51:ae:28:df:63:e9:d8:cf:38:5d:87:2d:7b:b8:ca:9f:f5:b1:6f. Are you sure you want to continue connecting (yes/no)?

    Type yes and press enter.

    Getting-Started-VM4
    (click to zoom)

    You’ll see a response similar to the following:

    Warning: Permanently added ‘ec2-198-51-100-1.compute-1.amazonaws.com’ (RSA) to the list of known hosts.

    You should then see the welcome screen for your instance and you are now connected to your AWS Linux virtual machine in the cloud.

    Getting-Started-VM7
    (click to zoom)
  • Mac / Linux

    Getting-Started-CLI-OSX1

    Getting-Started-VM3

    Getting-Started-VM4

    Getting-Started-VM7

Step 4: Terminate Your Instance

You can easily terminate the instance from the EC2 console. In fact, it is a best practice to terminate instances you are no longer using so you don’t keep getting charged for them.


a. Back on the EC2 Console, select the box next to the instance you created.  Then click the Actions button, navigate to Instance State, and click Terminate.

launch-windows-vm-18
(click to zoom)

b. You will be asked to confirm your termination – select Yes, Terminate.

Note: This process can take several seconds to complete.  Once your instance has been terminated, the Instance State will change to terminated on your EC2 Console.


Comments (18)

  • minecraft

    Hi! Do you know if they make any plugins to assist with Search Engine
    Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m
    not seeing very good gains. If you know of any
    please share. Many thanks!

  • minecraft

    I like the valuable info you provide in your
    articles. I’ll bookmark your weblog and check again here
    regularly. I am quite certain I will learn lots of
    new stuff right here! Good luck for the next!

    • zvodretiluret

      What i don’t realize is in reality how you’re now not actually much more well-favored than you might be right now. You’re so intelligent. You realize thus considerably in terms of this topic, produced me in my opinion believe it from so many various angles. Its like men and women are not involved except it is something to accomplish with Woman gaga! Your individual stuffs great. Always take care of it up!

  • minecraft

    Hi there! I just wish to offer you a big thumbs up
    for your excellent info you have got here on this post.
    I’ll be coming back to your website for more soon.

    • zvodret iluret

      Outstanding post however , I was wondering if you could write a litte more on this topic? I’d be very thankful if you could elaborate a little bit more. Appreciate it!

  • minecraft

    This design is spectacular! You certainly know how
    to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Fantastic job.
    I really loved what you had to say, and more than that, how you presented it.
    Too cool!

    • zvodretiluret

      Valuable information. Fortunate me I discovered your website accidentally, and I’m shocked why this accident didn’t came about in advance! I bookmarked it.

  • minecraft

    you’re actually a excellent webmaster. The website
    loading speed is amazing. It sort of feels that you are doing any
    unique trick. Also, The contents are masterwork.
    you’ve performed a fantastic job on this matter!

    • zvodretiluret

      I in addition to my guys were actually going through the excellent thoughts from your web blog and so then I had an awful suspicion I had not thanked the web site owner for those secrets. The young men were as a result very interested to study all of them and now have undoubtedly been making the most of them. We appreciate you being simply helpful and for deciding on these kinds of impressive topics most people are really needing to discover. My honest regret for not saying thanks to sooner.

  • minecraft

    Its like you read my mind! You seem to know a lot about this, like you wrote the book in it
    or something. I think that you can do with a few pics to drive the message
    home a little bit, but other than that, this is great blog.
    A fantastic read. I’ll certainly be back.

    • zvodretiluret

      hi!,I like your writing very much! share we communicate more about your post on AOL? I need a specialist on this area to solve my problem. Maybe that’s you! Looking forward to see you.

  • minecraft

    Hello I am so delighted I found your site, I really found you by mistake,
    while I was browsing on Yahoo for something else, Anyways
    I am here now and would just like to say many thanks for a remarkable post and a all
    round thrilling blog (I also love the theme/design), I don’t have
    time to read through it all at the minute but I have
    saved it and also added in your RSS feeds, so
    when I have time I will be back to read a
    great deal more, Please do keep up the awesome jo.

  • zvodret iluret

    We are a group of volunteers and starting a new scheme in our community. Your site provided us with valuable info to work on. You’ve done an impressive job and our entire community will be thankful to you.

  • NFL Jerseys

    NFL Jerseys

    While many were indeed designed and planned for ahead of the imposition of sanctions, Russia is clearly making a big effort to modernize its armed forces, especially its air force, and moving past older Soviet platforms. The Su-35 is a good example of…

  • cheapjerseysfromchina

    cheapjerseysfromchina

    Across town at UCLA, 853 students and seven faculty members might have been exposed to one measles patient, she said. Health officials verified immunization for hundreds, leaving 45 students and one faculty member under quarantine Friday, Ferrer said.

  • Google

    Google

    Always a large fan of linking to bloggers that I adore but really don’t get a lot of link adore from.

Leave a Reply