CloudAcademy

EC2 Compute Fundamentals

Contents

keyboard_tab
Scripted compute services
5
High Availability and Fault Tolerance
Conclusion
play-arrow
Start course
Overview
DifficultyBeginner
Duration44m
Students4429

Description

AWS 120, part of Cloud Academy's comprehensive Amazon Web Services learning tracks series, offers you a full introduction to AWS's cornerstone compute services.

Course creator David Robinson begins with the basics: configuring and launching virtual servers in Amazon's Elastic Compute Cloud (EC2). While in some cases, this could be all you'll need to get started, you will also want to at least be aware of some of the ways you can greatly expand the power and reliability of your AWS deployments. So AWS 120 covers tools like Auto Scaling, Load Balancing, Lambda (for event-generated deployments), and the EC2 Container Service, for launching fast and efficient container clusters.

AWS120 is part of the 100 level course series (the AWS Technical Foundation Track) which, in turn, lays the groundwork for our 200 series (intermediate level skills) and 300 series (advanced skills).

Transcript

Welcome to the Cloud Academy Amazon Web Services, AWS Compute Fundamentals course. This is an introductory course that will provide a high level overview of the offerings that make up AWS Compute Services and will give you a basic foundation to build upon your knowledge in future courses. During this course we will cover the basics of Amazon Elastic Compute Cloud (EC2), Amazon EC2 container Services (ECS), AWS Lambda, and finally we will touch on auto scaling and elastic load balancing.

Amazon EC2 was released in 2006 and has become the center of the Amazon.com cloud computing platform, AWS.

EC2 allows users to provision virtual computers called instances on a pay-per-use basis, so they can run their own computer applications. You can create, launch and terminate service instances as needed and pay only for what you use. You have full control over the geographical location where the instances are provisioned and you can take advantage of resiliency by deploying into different availability zones within each region.

Before we go any further, let's familiarize ourselves with the EC2 dashboard. From the AWS console, click on EC2 under the compute section to go to the EC2 dashboard. You can see that the dashboard is broken up into three columned sections, on the left hand side there's a menu bar that you can use to access configuration hubs, like instances, network and security and auto scaling. On the right hand side there is account information and links to resources like your VPC, which we'll cover in the intermediate network course and help documentation.

The center column provides an overview of the resources that are currently running. The create instance section where you can launch the EC2 wizard by clicking on the blue launch instance button and in the bottom half the service health of the region you have selected.

Launch an instance. The best way to familiarize yourself is to actually dive in and get working, so let's build an EC2 instance. From the EC2 dashboard click on the blue launch instance button, the first step in the process is to choose an Amazon machine image and on the left hand menu you have a choice of AMIs created by AWS, by the community or even images that you yourself have created. It is important that you select the right AMI for your needs and you have a choice of current supported Windows operating systems as well as a number of Linux distributions that you can choose from. You will also notice that there's an option to limit your selection to free tier only. This is part of AWS's free tier in which new customers can get started with Amazon EC2 for free. There are limits on this on a per month basis, however this is more than sufficient for you to become proficient in EC2. For the purpose of the demo, we will just select the first Linux distribution and click the blue select button. The next step is choose an instance type. AWS offers a wide selection of instance types grouped into families, defined by purpose, such as micro instances general purpose, compute optimized, memory optimized, storage optimized and GPU instances.

Instance types feature various combinations of CPU memory, storage and networking capacity and give you the flexibility to choose the appropriate mix of resources for your applications.

Each instance type includes one or more instance sizes allowing you to scale your resources to the requirements of your target workload. For the purpose of this demo, we will take advantage of the free tier and select T2.micro. This is the bare minimum of the input needed from us to launch an instance, however we will walk through the remaining steps to illustrate some more details of which you should be aware. Click next configure instance details, some of the details from this next steps are covered in more detail in intermediate and advanced courses. The first is that you can specify whether you'd like multiple instances to be deployed the other is the shutdown behavior. There are two options here which are shut down and terminate. When you terminate an EC2 instance the virtual machine will be shut down and destroyed and you will no longer be charged for instance usage. Any data that was stored locally on the instance will be lost and any attached EBS volumes will also be detached and deleted. On the other hand, when you stop and EC2 instance the virtual machine will be shut down and you will no longer be charged for instance usage, however any attached bootable EBS volumes will not be deleted, the data on your EBS volume will remain after stopping, while all information on the local, ephemeral disk will be lost. The EBS volume will continue to persist in its availability zone and standard charges will be applied.

Please note that the ability to stop an instance is only supported on instances that were launched on an attached EBS volume, as an EBS boot partition instead of being stored on a local instance.

When you restart a stopped instance, the original virtual EBS volume is simply attached to the newly provision instance.

If you want to prevent accidental termination of the EC2 instance you can select the checkbox for enable termination protection. Click next add storage. Here you have the option of adding additional storage to your EC2 instance. The type of storage that you can add is instance storage, which is ephemeral storage, and only exist as long as the instance is running. The other type is elastic block storage, EBS, which is persistent storage.

Both of these types of storage appear to the operating system as local storage, although they are a network attached volumes. A limitation of this type of storage is that it can only be attached to a single instance at a time. Click next tag instances to continue.

Tags are case sensitive key value pairs that you can assign to the instance, this is a good practice to get into as you can later filter from long lists of resources based on their tags for reporting purposes or assigning owners, roles etc. If you don't assign a tag at this stage you can add one later. Click next configure security group to continue. A security group is a firewall that controls traffic to your instance, at a minimum you should define a rule that allows SSH for Linux distributions over TCP 22 or RDP 3389 so that you can access the server. You need to be careful when you open the ports, as to where you can access them from as the default source is 0.0.0.0/0 which is from anywhere. It is a best practice to limit this to a dedicated IP address, or a trusted range.

You can add additional rules by clicking on the add rule button and when you have added the necessary rules for your instance then click review and launch. The final screen is review instance launch from where you can review all the settings that you have previously configured. Once you're satisfied that the settings are correct, click on the launch button and you will then be prompted to select a key pair and acknowledge that you have access to the selected private key. If you don't have the corresponding private key you won't be able to log in directly to your instance. Once you have confirmed, click launch instance and the instance will be started. Now that the instance has been launched we can access this from either terminal on Mac or Linux or from an SSH client, such as PuTTY on a Windows machine.

We have covered the provisioning of an instance from the AWS management console, which is very comprehensive. But this is not the only way, sometimes you'll wanna perform these tasks through the AWS command line interface, CLI. If you havn't installed the CLI on your local computer, we will soon cover the installation for the Windows and Mac Machines. You will use this to perform more advanced actions and to become comfortable with the skills you will need for AWS certification. In addition to using the management console and AWS CLI for provisioning instances, there is also Cloud formation that enables you to provision your environment from a JSON formatted template file, which describes the instance and is then uploaded to AWS Cloud formation. Finally programmatic access is also possible through AWS SDks that exist for most modern programming languages.

Manage the instance, now that your instance is running and you have full control, you need to ensure that you can properly manage the environment.

Either you or assisted min must be familiar with backing up, securing, and patching the system to name a few administrative tasks. You will recall from our introduction to AWS that Amazon uses a shared security model part of which expects you to take the necessary reactions to ensure that you system is up to date and secure and that proper measures have been taken to protect the instance.

When not to use EC2. So a logical question at this point has to be when wouldn't I use EC2? Some scenarios might include your application has a requirement to access such features as a physical USB or a serial dongle for licensing purposes, or you need direct physical access to the system, you need to run Unix, a non x86 architecture, or legacy and unsupported operating systems. Applications that can only work using multicast or by manipulating Layer 2 networking interfaces, for example Microsoft network load balancing. Applications that require the same disks being attached to multiple different virtual machines, for example Oracle RAC. You don't have the system's administrator skills or don't want to do them, and this also includes investing time to understand how to take advantage of EC2 architectures to make them highly available and scalable. The other reason I often hear is that the instances can't handle the workload, for example they can't vertically scale to do what is required. This is an advanced discussion but there are a number of things that can be done to overcome these limitations, and the vast majority of applications in the last 10 to 15 years will work fine.

Pricing. Pricing is something you really need to understand. As we previously mentioned if you are new to AWS, you are eligible for the free tier which gives you access to many EC2 resources. In general, EC2 pricing is based on instance hours consumed for each instance, which starts from the time an instance is launched until it is terminated or stopped, with each partial instance hour consumed billed as a full hour. There are different pricing schemes based on the type and size of the instance. The types of instances are, On-Demand. These instances allow you to pay for computing capacity by the hour with no long term commitments. Reserved instances. These instances allow you to reserve EC2 computing capacity for one or three years, in exchange for this commitment you can realize discounted hourly rate up to 75% compared to On-Demand instance pricing. Spot instances. This takes advantage of unused EC2 instances for which you can bid. The spot price is set by AWS which fluctuates in real-time based on supply and demand.

When your bid price is higher the instances are launched until the price exceeds your current bid, or you terminate the instance. This type of instance is ideal for tasks that can live with unexpected interruptions and is often used for big data or analytical type applications. Dedicated instances. If you wish to take advantage of dedicated instances there is a charge per instance as well as a per region instance charge.

To become familiar with the costing model you can use the AWS online calculator. Under EC2 enter the minimum values you'll need for instance type, storage and data transfer.

Amazon Elastic Compute Cloud is an important service that offers many benefits and this introduction has only scratched the surface of its capabilities.

To get a better understanding it is highly recommended that you undertake the intermediate and advanced compute courses offered by Cloud Academy.

About the Author

Students9841
Courses2
Learning paths1

David's acknowledged hands on experience in the IT industry has seen him speak at international conferences, operate in presales environments and conduct actual design and delivery services.

David also has extensive experience in delivery operations. David has worked in the financial, mining, state government, federal government and public sectors across Asia Pacific and the US