First steps on EC2
Your first webserver on EC2
A deeper look
Learn how to launch a new Elastic Compute Cloud (EC2) Instance in your AWS account. EC2, the core service of the AWS suite, allows you to create virtual compute instances, paying only for the time you run them. In this course we'll skip the theory, and jump straight to practice: showing you how to set up and configure a simple instance and install everything you'll need for a "Hello Word" web server.
Welcome to Amazon EC2 101 course. In the next few minutes, we're going to explain to you some basic concepts about the Amazon EC2 Compute Service. We'll show you how to launch an Instance and publish a Hello World page so that you can start using EC2 in a surprisingly short time. Okay. It's now time to launch our first Instance. Open the EC2 page to the AWS console and choose from the top menu, the region you want to launch your Instance into. We're going to place our servers in the Oregon region. If you're unsure, do the same, as this will make it easier for you to follow this tutorial.
Click on the blue Launch Instance button to start the Launch Wizard in the first page and select the 64 byte Amazon Linux AMI. This is a pre-configured harden scent OS based image. In the next screen, choose the T1.micro Instance type. It's the cheapest Instance type and comes with two shared CPU cores, 600 MB of RAM and EBS storage. This is enough for our purposes.
When you're done, click on next. Okay. This page is a little bit complicated, but fortunately we, at this point, don't need to understand every single item in there.
Let's start with the networking settings. Since the second half of 2013 AWS is creating Instances for new customers in a default VPC, we'll speak about the VPC service in the next courses. You don't need to understand how it works now. Just remember that you have a virtual private network in each region with a different subnet for each availability zone. Your Instance, by default, has a single Ethernet interface with an internal IP in that subnet. But in this page, you can also attach it to a natted public IP. This IP will be linked to the I stance, and you will lose it when terminating the VM. We don't actually need it, as we'll set up the elastic IP later to reach the server from the internet. Another useful setting here is the termination protection. It avoids the accidental termination of your Instance asking you for confirmation before you delete it. It's better if we check this and click on next. On EC2, you have access to two different storage types, EBS, the persistent and redundant storage that persist to the termination of your Instance, and that can be moved between Instances and the local Instance storage. This last one is most performance but without any warranty. You could lose data stored in it at any time. Set the volume size to 10 GB and check delete on termination, if you want AWS to automatically remove this volume when you delete the associated Instance. Click on next. Here, you can add some tags that basically are key valve pairs that make it easier for you manage in group Instances.
We don't need to set tags in this tutorial. So ignore this page and click on next. Now we're asked to configure a security group. You can consider it as an inbound, external firewall dedicated to a single or multiple Instance. We need to open the HTTP and SSH ports to our Instance. SSH is already configured. So simply chose HTTP from the protocol drop down menu, leave anywhere as source. You can now set a name and a description for your security group an click on review and launch. We're almost done. Click on the blue launch button. We're now required to generate and download a key pair that we will use to access our Instance later on.
Select create a new key pair, give it a name and click on the download key pair button. Keep the private key in a safe place on your computer, as you won't be able to download it again. Complete the process by clicking on launch Instance.
Your Instance is now being created . Let's go back to the EC2 main console page by clicking on view Instances. It's time for us to allocate and associate an elastic IP. It can be moved between Instances because it's associated to the account, not to the single virtual machine. From the left menu, click on elastic IPs and then on allocate new address, confirm, then select it and click on associated address. Select your Instance and confirm by clicking on associate. Note down the elastic IP or the public DNS shown here, because we will need them in the next steps.
About the Author
In the last years Giorgio spent much of his time on the design and deployment of platforms based on new technologies like NoSQL Databases (MongoDB, HBase, Cassandra), Software Defined Networking (OpenFlow, Open vSwitch), Virtualization (Xen, Linux KVM, VMware) and Cloud Computing (OpenStack, Eucalyptus). He has a very deep knowledge of Amazon Web Services (AWS), RackSpace Cloud and related services, and has worked with many other IaaS / PaaS platforms (Google Cloud, Heroku, AppFog etc.).