ebook img

Amazon EC2 Instances PDF

691 Pages·2014·10.72 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Amazon EC2 Instances

Amazon Elastic Compute Cloud User Guide API Version 2014-02-01 Amazon Elastic Compute Cloud User Guide Amazon Web Services Amazon Elastic Compute Cloud User Guide Amazon Elastic Compute Cloud: User Guide Amazon Web Services Copyright © 2014 Amazon Web Services, Inc. and/or its affiliates. All rights reserved. The following are trademarks of Amazon Web Services, Inc.: Amazon, Amazon Web Services Design, AWS, Amazon CloudFront, Cloudfront, Amazon DevPay, DynamoDB, ElastiCache, Amazon EC2, Amazon Elastic Compute Cloud, Amazon Glacier, Kindle, Kindle Fire, AWS Marketplace Design, Mechanical Turk, Amazon Redshift, Amazon Route 53, Amazon S3, Amazon VPC. In addition, Amazon.com graphics, logos, page headers, button icons, scripts, and service names are trademarks, or trade dress of Amazon in the U.S. and/or other countries. Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon. Amazon Elastic Compute Cloud User Guide What Is Amazon EC2? ........................................................................................................................... 1 Instances and AMIs................................................................................................................................4 Regions and Availability Zones...............................................................................................................7 Root Device Volume ............................................................................................................................. 13 Setting Up.............................................................................................................................................19 Getting Started ..................................................................................................................................... 24 Step 1: Launch an Instance..................................................................................................................25 Step 2: Connect to Your Instance..........................................................................................................26 Step 3: Add a Volume...........................................................................................................................29 Step 4: Clean Up .................................................................................................................................. 32 Best Practices.......................................................................................................................................33 Tutorial: Installing a LAMP Web Server.................................................................................................34 Tutorial: Hosting a WordPress Blog......................................................................................................40 Amazon Machine Images..................................................................................................................... 48 AMI Types ............................................................................................................................................. 50 Finding a Suitable AMI..........................................................................................................................53 Shared AMIs.........................................................................................................................................54 Finding Shared AMIs...................................................................................................................54 Making an AMI Public..................................................................................................................57 Sharing an AMI with Specific AWS Accounts..............................................................................59 Using Bookmarks ........................................................................................................................ 60 Guidelines for Shared Linux AMIs...............................................................................................61 Paid AMIs ............................................................................................................................................. 64 Creating an Amazon EBS-Backed Linux AMI.......................................................................................69 Creating an Instance Store-Backed Linux AMI.....................................................................................72 Copying an AMI .................................................................................................................................... 80 Deregistering Your AMI.........................................................................................................................83 Amazon Linux....................................................................................................................................... 84 Using Your Own Linux Kernels..............................................................................................................91 Instances .............................................................................................................................................. 97 Instance Types......................................................................................................................................97 Micro Instances ........................................................................................................................... 99 I2 Instances...............................................................................................................................106 HI1 Instances ............................................................................................................................ 107 HS1 Instances...........................................................................................................................109 R3 Instances ............................................................................................................................. 110 GPU Instances .......................................................................................................................... 112 Amazon EBS-Optimized Instances ........................................................................................... 114 Placement Groups.....................................................................................................................115 Resizing Instances .................................................................................................................... 118 Spot Instances....................................................................................................................................121 Getting Started with Spot Instances..........................................................................................122 Viewing Spot Instance Pricing History.............................................................................125 Creating a Spot Instance Request...................................................................................127 Finding Running Spot Instances......................................................................................130 Canceling Spot Instance Requests..................................................................................132 Fundamentals of Spot Instances...............................................................................................134 Placing Spot Requests.....................................................................................................135 Spot Instance Limits............................................................................................... 135 Customizing Your Spot Requests ........................................................................... 136 Tracking Spot Requests with Bid Status Codes......................................................138 Tagging Spot Instance Requests.....................................................................................144 Understanding Spot Instance Provisioning, Pricing, and Interruption..............................145 Protecting Your Spot Instance Data Against Interruptions...............................................147 Planning for Interruptions ....................................................................................... 148 Persisting Your Root EBS Partition.........................................................................148 Walkthroughs: Using Spot Instances with AWS Services.........................................................149 Managing Spot Instances with Auto Scaling....................................................................149 API Version 2014-02-01 4 Amazon Elastic Compute Cloud User Guide Tools for Managing Auto Scaling with Spot Instances............................................150 Launching Spot Instances with Auto Scaling..........................................................151 Obtaining Information About the Instances Launched by Auto Scaling..................154 Updating the Bid Price for the Spot Instances........................................................158 Scheduling Spot Bid Requests...............................................................................161 Using Auto Scaling to Get Notifications for Spot Instances....................................161 Using CloudFormation Templates to Launch Spot Instances..........................................164 Launching Amazon Elastic MapReduce Job Flows with Spot Instances.........................165 Launching Spot Instances in Amazon Virtual Private Cloud............................................165 Advanced Tasks ........................................................................................................................ 168 Subscribe to Your Spot Instance Data Feed....................................................................168 Programming Spot Instances the with AWS Java SDK...................................................171 Tutorial: Amazon EC2 Spot Instances....................................................................172 Tutorial: Advanced Amazon EC2 Spot Request Management...............................180 Starting Clusters on Spot Instances................................................................................196 Reserved Instances............................................................................................................................198 Getting Started with Reserved Instances..................................................................................199 Tools for Working with Reserved Instances.....................................................................202 Reserved Instance Fundamentals.............................................................................................204 Choosing Reserved Instances Based on Your Usage Plans............................................204 Understanding Reserved Instance Pricing Tiers..............................................................205 Understanding the Pricing Benefit of Reserved Instances..............................................210 Reserved Instances and Consolidated Billing........................................................212 Reserved Instance Marketplace ...................................................................................... 212 Buying Reserved Instances.......................................................................................................215 Becoming a Buyer............................................................................................................216 Purchasing Reserved Instances......................................................................................217 Reading Your Statement (Invoice)....................................................................................223 Obtaining Information About Your Reserved Instances.............................................................225 Modifying Your Reserved Instances.......................................................................................... 230 Changing the Instance Type of Your Reservations...........................................................233 Submitting Modification Requests....................................................................................236 Selling in the Reserved Instance Marketplace..........................................................................240 Registering as a Seller.....................................................................................................241 Selling Your Reserved Instances......................................................................................245 After Your Reserved Instance Is Sold...............................................................................264 Requirements Checklist for Reserved Instances.......................................................................266 Instance Metadata and User Data......................................................................................................268 Importing and Exporting Instances.....................................................................................................279 Prerequisites ............................................................................................................................. 280 Importing a VM into Amazon EC2.............................................................................................282 Step 1: Install the Amazon EC2 CLI.................................................................................283 Step 2: Prepare Your VM..................................................................................................283 Step 3: Export Your VM from Its Virtual Environment.......................................................284 Step 4: Importing Your VM into Amazon EC2...................................................................284 Checking on the Status of Your Import Task...........................................................286 Importing Your Volumes into Amazon EBS.............................................................288 Resuming an Upload..............................................................................................289 Canceling an Upload.............................................................................................. 290 Cleaning Up After an Upload..................................................................................290 Step 5: Launch the instance in Amazon EC2...................................................................291 Exporting Amazon EC2 Instances ............................................................................................ 291 Troubleshooting ......................................................................................................................... 292 Instance Lifecycle ............................................................................................................................... 297 Launch ................................................................................................................................................ 300 Launching an Instance..............................................................................................................300 Launching an Instance from a Backup......................................................................................305 Launching an AWS Marketplace Instance.................................................................................306 API Version 2014-02-01 5 Amazon Elastic Compute Cloud User Guide Connect .............................................................................................................................................. 308 Connect Using SSH .................................................................................................................. 308 Connect Using PuTTY...............................................................................................................312 Connect Using MindTerm..........................................................................................................316 Connect Using RDP.................................................................................................................. 317 Stop and Start.....................................................................................................................................319 Reboot ................................................................................................................................................ 322 Retire .................................................................................................................................................. 322 Terminate............................................................................................................................................ 325 Configure Instances............................................................................................................................331 Managing Software.............................................................................................................................332 Updating Instance Software...................................................................................................... 332 Adding Repositories .................................................................................................................. 336 Finding Software Packages.......................................................................................................337 Installing Software Packages .................................................................................................... 338 Preparing to Compile Software................................................................................................. 339 Managing Users..................................................................................................................................340 Set the Time for an Instance...............................................................................................................341 Changing the Hostname.....................................................................................................................344 Using Dynamic DNS...........................................................................................................................347 Launching Instances with User Data..................................................................................................349 Monitoring ........................................................................................................................................... 353 Automated and Manual Monitoring.....................................................................................................354 Best Practices for Monitoring..............................................................................................................356 Monitoring the Status of Your Instances.............................................................................................356 Monitoring Instances with Status Checks..................................................................................356 Monitoring Events for Your Instances........................................................................................361 Monitoring Your Instances with CloudWatch.......................................................................................364 Enabling or Disabling Detailed Monitoring on an Amazon EC2 Instance..................................365 View Amazon EC2 Metrics........................................................................................................368 Get Statistics for Metrics ........................................................................................................... 373 Get Statistics for a Specific EC2 Instance.......................................................................374 Aggregating Statistics Across Instances..........................................................................378 Get Statistics Aggregated by Auto Scaling Group...........................................................383 Get Statistics Aggregated by Image (AMI) ID..................................................................385 Graphing Metrics.......................................................................................................................390 Graph a Metric................................................................................................................. 390 Graph a Metric Across Resources...................................................................................391 Create a CloudWatch Alarm......................................................................................................394 Send Email Based on CPU Usage Alarm........................................................................394 Send Email Based on Load Balancer Alarm....................................................................396 Send Email Based on Storage Throughput Alarm...........................................................399 Create Alarms That Stop or Terminate an Instance..................................................................401 Monitoring Scripts for Amazon EC2 Instances...................................................................................416 Amazon CloudWatch Monitoring Scripts for Linux....................................................................416 Amazon CloudWatch Monitoring Scripts for Windows..............................................................422 Network and Security ......................................................................................................................... 432 Key Pairs.............................................................................................................................................433 Security Groups..................................................................................................................................440 Controlling Access..............................................................................................................................448 IAM Policies...............................................................................................................................450 Supported Resources and Conditions.............................................................................456 Example Policies..............................................................................................................463 IAM Roles..................................................................................................................................477 Network Access.........................................................................................................................483 Amazon VPC ...................................................................................................................................... 485 Supported Platforms ................................................................................................................. 487 Instance IP Addressing.......................................................................................................................489 API Version 2014-02-01 6 Amazon Elastic Compute Cloud User Guide Multiple Private IP Addresses ................................................................................................... 494 Elastic IP Addresses...........................................................................................................................498 Elastic Network Interfaces .................................................................................................................. 503 Enhanced Networking ........................................................................................................................ 516 Storage ............................................................................................................................................... 521 Amazon EBS ...................................................................................................................................... 523 EBS Volumes.............................................................................................................................524 EBS Volume Types...........................................................................................................525 Creating a Volume............................................................................................................526 Restoring from a Snapshot..............................................................................................528 Attaching a Volume to an Instance...................................................................................529 Making a Volume Available for Use..................................................................................532 Volume Information .......................................................................................................... 536 Monitoring the Status of Your Volumes.............................................................................536 Detaching a Volume from an Instance.............................................................................546 Deleting a Volume............................................................................................................547 Expanding a Volume ........................................................................................................ 548 Expanding a Linux Partition.............................................................................................554 EBS Snapshots ......................................................................................................................... 559 Creating a Snapshot........................................................................................................ 559 Deleting a Snapshot.........................................................................................................560 Copying a Snapshot.........................................................................................................561 Snapshot Information.......................................................................................................562 Sharing Snapshots .......................................................................................................... 563 EBS Performance......................................................................................................................564 EC2 Configuration............................................................................................................565 I/O Characteristics ........................................................................................................... 566 Workload Demand ........................................................................................................... 567 Pre-Warm Volumes .......................................................................................................... 568 RAID Configuration.......................................................................................................... 572 Benchmark Volumes ........................................................................................................ 577 API and Command Overview....................................................................................................580 Instance Store.....................................................................................................................................582 Amazon S3 ......................................................................................................................................... 590 Block Device Mapping ........................................................................................................................ 592 Using Public Data Sets.......................................................................................................................603 Resources and Tags........................................................................................................................... 606 Resource Locations............................................................................................................................606 Listing and Filtering Your Resources.................................................................................................. 607 Tagging Your Resources..................................................................................................................... 610 Usage Reports....................................................................................................................................618 Instance Usage ......................................................................................................................... 620 Reserved Instance Utilization....................................................................................................624 Troubleshooting .................................................................................................................................. 630 Launching Your Instance.....................................................................................................................630 Connecting to Your Instance...............................................................................................................631 Stopping Your Instance....................................................................................................................... 636 Terminating Your Instance...................................................................................................................637 Failed Status Checks..........................................................................................................................638 Instance Capacity ............................................................................................................................... 661 General ............................................................................................................................................... 662 Making API Requests.........................................................................................................................664 Query Requests..................................................................................................................................665 Troubleshooting API Request Errors .................................................................................................. 668 Ensuring Idempotency........................................................................................................................670 SOAP Requests..................................................................................................................................672 Document History............................................................................................................................... 673 API Version 2014-02-01 7 Amazon Elastic Compute Cloud User Guide Features of Amazon EC2 What Is Amazon EC2? Amazon Elastic Compute Cloud (Amazon EC2) provides resizable computing capacity in the Amazon Web Services (AWS) cloud. Using Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications faster.You can use Amazon EC2 to launch as many or as few virtual servers as you need, configure security and networking, and manage storage. Amazon EC2 enables you to scale up or down to handle changes in requirements or spikes in popularity, reducing your need to forecast traffic. Features of Amazon EC2 Amazon EC2 provides the following features: • Virtual computing environments, known as instances • Pre-configured templates for your instances, known as Amazon Machine Images (AMIs), that package the bits you need for your server (including the operating system and additional software) • Various configurations of CPU, memory, storage, and networking capacity for your instances, known as instance types • Secure login information for your instances using key pairs (AWS stores the public key, and you store the private key in a secure place) • Storage volumes for temporary data that's deleted when you stop or terminate your instance, known as instance store volumes • Persistent storage volumes for your data using Amazon Elastic Block Store (Amazon EBS), known as Amazon EBS volumes • Multiple physical locations for your resources, such as instances and Amazon EBS volumes, known as regions and Availability Zones • A firewall that enables you to specify the protocols, ports, and source IP ranges that can reach your instances using security groups • Static IP addresses for dynamic cloud computing, known as Elastic IP addresses • Metadata, known as tags, that you can create and assign to your Amazon EC2 resources • Virtual networks you can create that are logically isolated from the rest of the AWS cloud, and that you can optionally connect to your own network, known as virtual private clouds (VPCs) For more information about the features of Amazon EC2, see the Amazon EC2 product page. API Version 2014-02-01 1 Amazon Elastic Compute Cloud User Guide How to Get Started with Amazon EC2 How to Get Started with Amazon EC2 The first thing you need to do is get set up to use Amazon EC2. After you are set up, you are ready to complete the Getting Started tutorial for Amazon EC2.Whenever you need more information about a feature of Amazon EC2, you can read the technical documentation. Getting Started • Setting Up with Amazon EC2 (p.19) • Getting Started with Amazon EC2 Linux Instances (p.24) • Getting Started with Amazon EC2 Windows Instances Basics • Instances and AMIs (p.4) • Instance Types (p.97) • Regions and Availability Zones (p.7) • Tags (p.610) Networking and Security • Amazon EC2 Key Pairs (p.433) • Security Groups (p.440) • Elastic IP Addresses (EIP) (p.498) • Amazon EC2 and Amazon VPC (p.485) Storage • Amazon EBS (p.523) • Instance Store (p.582) If you have questions about whether AWS is right for you, Contact AWS Sales. If you have technical questions about Amazon EC2, use the Amazon EC2 forum. Related Services You can provision Amazon EC2 resources, such as instances and volumes, directly using Amazon EC2. You can also provision Amazon EC2 resources using other services in AWS. For more information, see the following documentation: • Auto Scaling Developer Guide • AWS CloudFormation User Guide • AWS Elastic Beanstalk Developer Guide • AWS OpsWorks User Guide API Version 2014-02-01 2 Amazon Elastic Compute Cloud User Guide Accessing Amazon EC2 To automatically distribute incoming application traffic across multiple instances, use Elastic Load Balancing. For more information, see Elastic Load Balancing Developer Guide. To monitor basic statistics for your instances and Amazon EBS volumes, use Amazon CloudWatch. For more information, see Monitoring Your Instances with CloudWatch (p.364). To monitor the calls made to the Amazon EC2 API for your account, including calls made by the AWS Management Console, command line tools, and other services, use AWS CloudTrail. For more information, see the AWS CloudTrail User Guide. To get a managed relational database in the cloud, use Amazon Relational Database Service (Amazon RDS) to launch a database instance. Although you can set up a database on an EC2 instance, Amazon RDS offers the advantage of handling your database management tasks, such as patching the software, backing up, and storing the backups. For more information, see Amazon Relational Database Service Developer Guide. Accessing Amazon EC2 Amazon EC2 provides a web-based user interface, the Amazon EC2 console. If you've signed up for an AWS account, you can access the Amazon EC2 console by signing into the AWS Management Console and selecting EC2 from the console home page. If you prefer to use a command line interface, you have several options: AWS Command Line Interface (CLI) Provides commands for a broad set of AWS products, and is supported on Windows, Mac, and Linux/Unix.To get started, see AWS Command Line Interface User Guide. For more information about the commands for Amazon EC2, see ec2. Amazon EC2 Command Line Interface (CLI) Tools Provides commands for Amazon EC2, Amazon EBS, and Amazon VPC, and is supported on Windows, Mac, and Linux/Unix.To get started, see Setting Up the Amazon EC2 Command Line Interface Tools on Linux and Commands (CLI Tools) in the Amazon Elastic Compute Cloud Command Line Reference. AWS Tools for Windows PowerShell Provides commands for a broad set of AWS products for those who script in the PowerShell environment.To get started, see AWS Tools for Windows PowerShell User Guide. Amazon EC2 provides a Query API.These requests are HTTP or HTTPS requests that use the HTTP verbs GET or POST and a Query parameter named Action. For more information about the API actions for Amazon EC2, see Actions in the Amazon Elastic Compute Cloud API Reference. If you prefer to build applications using language-specific APIs instead of submitting a request over HTTP or HTTPS, AWS provides libraries, sample code, tutorials, and other resources for software developers. These libraries provide basic functions that automatically take care of tasks such as cryptographically signing your requests, retrying requests, and handling error responses, so that it is easier for you to get started. For more information about downloading the AWS SDKs, see AWS SDKs and Tools. For a list of available APIs for Amazon EC2, see Available APIs for Amazon EC2 (p.664). Pricing for Amazon EC2 When you sign up for AWS, you can get started with Amazon EC2 for free using the AWS Free Usage Tier. Amazon EC2 provides the following purchasing options for instances: API Version 2014-02-01 3

Description:
Amazon Elastic Compute Cloud: User Guide Cloudfront, Amazon DevPay, DynamoDB, ElastiCache, Amazon EC2, Amazon Elastic Compute Cloud,
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.