Recipe 4.1 Manually Launching an EC2 Instance

Problem

You wish to create an AWS Elastic Compute Cloud (EC2) instance.

Solution

  1. Log into your AWS Console, click the EC2 link to go to the EC2 Console, and click the blue “Launch Instance” button:
  2. Select an Amazon Machine Image (AMI) to run on your EC2 Instance. The AMI contains the software configuration (operating system, application server, and applications) that will be launched on your server. AWS offers many free and paid options, such as AMIs with Ubuntu, Windows, or MySQL pre-installed:
  3. Pick the Instance Type, which determines what kind of CPU, memory, storage, and network capacity your server will have. Then click the grey “Next: Configure Instance Details” button:
  4. Unless changes are needed keep the default options for Instance Details, Storage, and Tags, so keep clicking the grey “Next” button until you get to the “Configure Security Group” page.
  5. A Security Group is a set of firewall rules that control network traffic for your instance. By default, all incoming ports are blocked, so use this page to add rules that allow incoming SSH (TCP, port 22) and any other port(s) serving requests from source IP (e.g. use 0.0.0.0/0 for any source). Give the Security Group a name such as my-ec2-from-anywhere, and click the blue “Review and Launch” button:
  6. On the “Review Instance Launch” page, click the blue “Launch” button. This will pop up a modal that asks you to pick a Key Pair. A key pair consists of a public key and a private key file that you can use to connect to your EC2 Instance over SSH. Select “create a new key pair” from the drop-down, give the Key Pair a name like my-ec2-key-pair, and click “Download Key Pair”:
  7. Save the Key Pair .pem file to a safe and accessible location (once you close this modal, you will never be able to download this .pem file again, so make sure to save it!).
  8. Click the blue “Launch Instances” button in the bottom right of the modal. This takes you to a “Launch Status” page. Click the blue “View Instances” button in the bottom right of this page, and you’ll be taken to the EC2 Instances page:
  9. This page shows all the EC2 Instances you have running. Click on your newly created EC2 Instance to see more information about it in the section at the bottom of the page, such as its state (running, pending, or terminated), launch time, and public IP address. Copy the public IP address, as you’ll need it to SSH to the server.

Discussion

Amazon EC2 uses public–key cryptography to encrypt and decrypt login information. Public–key cryptography uses a public key to encrypt a piece of data, such as a password, then the recipient uses the private key to decrypt the data. The public and private keys are known as a key pair.

To log in to your instance, you must create a key pair, specify the name of the key pair when you launch the instance, and provide the private key when you connect to the instance. Linux instances have no password, and you use a key pair to log in using SSH.

results matching ""

    No results matching ""