Amazon EC2
Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale computing easier for developers.Amazon EC2’s simple web service interface allows you to obtain and configure capacity with minimal friction. It provides you with complete control of your computing resources and lets you run on Amazon’s proven computing environment. Amazon EC2 reduces the time required to obtain and boot new server instances to minutes, allowing you to quickly scale capacity, both up and down, as your computing requirements change. Amazon EC2
changes the economics of computing by allowing you to pay only for capacity that you actually use.
Technical Knowledge Prerequisites
To successfully complete this lab, you should be familiar with basic Linux server administration and comfortable using the Linux command-line tools.Basics: Creating EC2 Resources
Step by Step Guide “Creating EC2 Resources” takes you through thesteps to get your first AWS Linux instance up and running. In this lab session, you will cover:
• Key Pair creation
• Security groups
• Instance launch
• Instance bootstrapping
• Machine images, and
• Elastic IP addresses
At the end of this lab you'll have a simple web server running and displaying unique information about your instance.
Elastic Compute Cloud (EC2) Overview and Essentials
Amazon Machine Images (AMIs)
Amazon EC2 provides templates known as Amazon Machine Images (AMIs) that contain a software configuration (for example, an operating system, an application server, and applications). You use these templates to launch an instance, which is a copy of the AMI running as a virtual server in the cloud. You can launch different types of instances from a single AMI. An instance type essentially determines the hardware capabilities of the virtual host computer for your instance. Each instance type offers different compute and memory capabilities. Select an instance type based on the amount of memory and computing power that you need for the application or software that you plan to run on the instance. You can launch multiple instances from an AMI.
Your instance keeps running until you stop or terminate it, or until it fails. If an instance fails, you can launch a new one from the AMI.
Regions and Availability Zones (AZs)
Amazon EC2 provides the ability to place instances in multiple locations. Amazon EC2 locations are composed of Availability Zones and Regions. Regions are dispersed and located in separate geographic areas (US, EU, etc.). Availability Zones are distinct locations within a Region that are engineered to be isolated from failures in other Availability Zones and provide inexpensive, low latency network connectivity to other Availability Zones in the same Region.
By launching instances in separate Regions, you can design your application to be closer to specific customers or to meet legal or other requirements. By launching instances in separate Availability Zones, you can protect your applications from localized regional failures.
By launching instances in separate Regions, you can design your application to be closer to specific customers or to meet legal or other requirements. By launching instances in separate Availability Zones, you can protect your applications from localized regional failures.
Instance Store and EBS-Backed Instances
When you launch an Amazon EC2 instance, the root device volume contains the image used to boot the instance. When we introduced Amazon EC2, all AMIs were backed by Amazon EC2 instance store, which means the root device for an instance launched from the AMI is an instance store volume created from a template stored in Amazon S3. After we introduced Amazon EBS, we introduced AMIs that are backed by Amazon EBS. This means that the root device for an instance launched from the AMI is an Amazon EBS volume created from an Amazon EBS snapshot.
You can choose between Amazon EC2 instance store and Amazon EBS as the root device for
your AMI. AMIs backed by EBS launch faster and use persistent storage.
your AMI. AMIs backed by EBS launch faster and use persistent storage.
Instances that use instance store for the root device automatically have instance store volumes available, with a separate root partition. When an instance is launched, the image that is used to boot the instance is copied to the root partition. Any data on the instance store volumes persists as long as the instance is running and is deleted when the instance fails or terminates.
Instances that use Amazon EBS for the root device automatically have an Amazon EBS volume attached. When an Amazon EBS-backed instance is launched, an EBS volume is created for each EBS snapshot referenced by the AMI. You must have at least one snapshot that denotes the root device; the others are optional and denote additional volumes to be created from other snapshots.
Amazon EC2 also provides an internal DNS name and a public DNS name that map to the private and public IP addresses respectively. The internal DNS name can only be resolved within Amazon EC2. The public DNS name resolves to the public IP address outside the Amazon EC2 network and the private IP address within the Amazon EC2 network.
1. Select EC2 from the Console Home
2. Select or confirm your AWS Region is correct.
In this example we will launch a default Amazon Linux Instance with an Apache PHP web server installed on
initialization.
1) Click Launch Instance in the middle of the dashboard.
2) Step 1: Choose an Amazon Machine Image (AMI). As we require a Linux instance, select the basic 64-bit
Amazon Linux AMI.
Tip: Depending upon the resources or OS your instance requires, you may select another type.
Public and Private IP Addresses
All Amazon EC2 instances are assigned two IP addresses at launch: a private IP address (RFC 1918) and a public IP address that are directly mapped to each other through Network Address Translation (NAT). Private IP addresses are only reachable from within the Amazon EC2 network. Public addresses are reachable from the Internet.Amazon EC2 also provides an internal DNS name and a public DNS name that map to the private and public IP addresses respectively. The internal DNS name can only be resolved within Amazon EC2. The public DNS name resolves to the public IP address outside the Amazon EC2 network and the private IP address within the Amazon EC2 network.
Security Groups
A security group acts as a firewall that controls the traffic allowed into a group of instances. When you launch an Amazon EC2 instance, you can assign it to one or more security groups. For each security group, you add rules that govern the allowed inbound traffic to instances in the group. All other inbound traffic is discarded. You can modify rules for a security group at any time. The new rules are automatically enforced for all existing and future instances in the group.Elastic IP Addresses (EIPs)
Elastic IP addresses are static IP addresses designed for dynamic cloud computing. An Elastic IP address is associated with your account, not a particular instance. You control addresses associated with your account until you choose to explicitly release them.
Amazon Virtual Private Cloud (VPC)
Amazon Virtual Private Cloud enables you to create a virtual network in the AWS cloud. With a Virtual Private Cloud (VPC), you can define a virtual network that closely resembles a traditional data center. You have complete control over your virtual networking environment, including selection of your own IP address range, creation of subnets, and configuration of routing and access control lists.
Login to the AWS Management Console
AWS Management Console
1. Select EC2 from the Console Home
Hands-on: Creating EC2 Resources
In this example we will launch a default Amazon Linux Instance with an Apache PHP web server installed on
initialization.
1) Click Launch Instance in the middle of the dashboard.
2) Step 1: Choose an Amazon Machine Image (AMI). As we require a Linux instance, select the basic 64-bit
Amazon Linux AMI.
Tip: Depending upon the resources or OS your instance requires, you may select another type.