Creating your first virtual machines

The first step is to go to http://aws.amazon.com/ and create an account. These steps are similar to any other online service. A single machine is free, but to get more you will need a credit card. In this example, we will use a few machines, so it may cost you a few dollars if you want to run through it. If you are not ready to take out a credit card just yet, you can certainly read the chapter to learn what AWS provides, without going through the examples. Then you can make a more informed decision on whether to sign up:

  1. Once you sign up for AWS and log in, you will be taken to the console. Here, you will see the many services that AWS provides, as depicted in the following screenshot (this is the panel shown as it was when this book was written. Amazon regularly makes minor changes, so you may see something slightly different from what we present in the book):
  1. You must first create a user using the Identity and Access Management service. Add a user, which in the screenshot is called aws_ml, and assign it programmatic access:
  1. We create a group for the user (called EC2_FULL in the following screenshot) and give it the AmazonEC2FullAccess permissions. Assigning the right permissions is very important, or later steps will fail with permission errors:
  1. Finally, at the very end, you must copy the information, namely, the access key. You can simply download the CSV file and save. Again, if you do not save this information, later steps will fail:
  1. Now, we go back to the console and this time, we pick and click on EC2 (the top element in the Compute column). We now see the EC2 management console, as shown in the following screenshot:
  1. In the top-right corner, you can pick your region (see the Amazon regions information box). Note that you will only see information about the region that you have selected. Thus, if you mistakenly select the wrong region (or have machines running in multiple regions), your machines may not appear (this seems to be a common pitfall of using the EC2 web management console).
  2. In EC2 parlance, a running server is called an instance. We select Launch Instance, which leads to the following screen asking us to select the operating system to use:
  1. Select the Amazon Linux option (if you are familiar with one of the other offered Linux distributions, such as Red Hat, SUSE, or Ubuntu, you can also select one of them, but the configurations will be slightly different). Now that you have selected the software, you will need to select the hardware. On the next screen, you will be asked to select which type of machine to use:
  1. We will start with one instance of the t2.micro type (the t1.micro type was an older, even less powerful machine). This is the smallest possible machine and it's free. Keep clicking on Next and accept all of the defaults until you come to the screen mentioning a key pair:
  1. We will pick the name awskeys for the key pair. Then check Create a new key pair. Name the key pair file awskeys.pem. Download and save this file somewhere safe! This is the Secure Shell (SSH) key that will enable you to log in to your cloud machine. Accept the remaining defaults and your instance will launch.
  2. You will now need to wait a few minutes for your instance to come up. Eventually, the instance will be shown in green with the status as running:
  1. In the preceding screenshot, you should see the Public IP which can be used to log in to the instance as follows:
$ ssh -i awskeys.pem [email protected]  
  1. Therefore, we will be calling the ssh command and passing it the key files that we downloaded earlier as the identity (using the -i option). We are logging in as the user ec2-user on the machine with the IP address 54.93.165.5. This address will, of course, be different in your case. If you choose another distribution for your instance, the username may also change. In this case, try logging in as root, ubuntu (for Ubuntu distribution), or fedora (for Fedora distribution).
  2. Finally, if you are running a Unix-style operating system (including macOS), you may have to tweak its permissions by calling the following command:
$ chmod 600 awskeys.pem  

This sets the read/write permission for the current user only. SSH will otherwise give you an ugly warning.

  1. Now you should be able to log in to your machine. If everything is okay, you should see the banner, as shown in the following screenshot:

This is a regular Linux box where you have sudo permission: you can run any command as a superuser by prefixing it with sudo. You can run the update command it recommends to get your machine up to speed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset