ebook img

Launch an Amazon EC2 Instance PDF

683 Pages·2014·10.12 MB·English
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 Launch an Amazon EC2 Instance

Amazon Elastic Compute Cloud User Guide API Version 2014-05-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.......................................................................................................................................34 Tutorial: Installing a LAMP Web Server.................................................................................................35 Tutorial: Hosting a WordPress Blog......................................................................................................41 Amazon Machine Images..................................................................................................................... 49 AMI Types ............................................................................................................................................. 51 Finding a Suitable AMI..........................................................................................................................54 Shared AMIs.........................................................................................................................................55 Finding Shared AMIs...................................................................................................................55 Making an AMI Public..................................................................................................................58 Sharing an AMI with Specific AWS Accounts..............................................................................60 Using Bookmarks ........................................................................................................................ 61 Guidelines for Shared Linux AMIs...............................................................................................62 Paid AMIs ............................................................................................................................................. 65 Creating an Amazon EBS-Backed Linux AMI.......................................................................................70 Creating an Instance Store-Backed Linux AMI.....................................................................................73 Copying an AMI .................................................................................................................................... 81 Deregistering Your AMI.........................................................................................................................84 Amazon Linux....................................................................................................................................... 85 Using Your Own Linux Kernels..............................................................................................................92 Instances .............................................................................................................................................. 98 Instance Types......................................................................................................................................98 Micro Instances ......................................................................................................................... 100 I2 Instances...............................................................................................................................107 HI1 Instances ............................................................................................................................ 108 HS1 Instances...........................................................................................................................110 R3 Instances ............................................................................................................................. 111 GPU Instances .......................................................................................................................... 113 Amazon EBS-Optimized Instances ........................................................................................... 115 Placement Groups.....................................................................................................................116 Resizing Instances .................................................................................................................... 119 Spot Instances....................................................................................................................................122 Getting Started with Spot Instances..........................................................................................123 Viewing Spot Instance Pricing History.............................................................................126 Creating a Spot Instance Request...................................................................................128 Finding Running Spot Instances......................................................................................131 Canceling Spot Instance Requests..................................................................................133 Fundamentals of Spot Instances...............................................................................................135 Placing Spot Requests.....................................................................................................136 Spot Instance Limits............................................................................................... 136 Customizing Your Spot Requests ........................................................................... 137 Tracking Spot Requests with Bid Status Codes......................................................139 Tagging Spot Instance Requests.....................................................................................145 Understanding Spot Instance Provisioning, Pricing, and Interruption..............................146 Protecting Your Spot Instance Data Against Interruptions...............................................148 Planning for Interruptions ....................................................................................... 149 Persisting Your Root EBS Partition.........................................................................149 Walkthroughs: Using Spot Instances with AWS Services.........................................................150 Managing Spot Instances with Auto Scaling....................................................................150 API Version 2014-05-01 4 Amazon Elastic Compute Cloud User Guide Tools for Managing Auto Scaling with Spot Instances............................................151 Launching Spot Instances with Auto Scaling..........................................................152 Obtaining Information About the Instances Launched by Auto Scaling..................155 Updating the Bid Price for the Spot Instances........................................................159 Scheduling Spot Bid Requests...............................................................................162 Using Auto Scaling to Get Notifications for Spot Instances....................................162 Using CloudFormation Templates to Launch Spot Instances..........................................165 Launching Amazon Elastic MapReduce Job Flows with Spot Instances.........................166 Launching Spot Instances in Amazon Virtual Private Cloud............................................166 Advanced Tasks ........................................................................................................................ 169 Subscribe to Your Spot Instance Data Feed....................................................................169 Programming Spot Instances the with AWS Java SDK...................................................172 Starting Clusters on Spot Instances................................................................................172 Reserved Instances............................................................................................................................174 Getting Started with Reserved Instances..................................................................................175 Tools for Working with Reserved Instances.....................................................................178 Reserved Instance Fundamentals.............................................................................................180 Choosing Reserved Instances Based on Your Usage Plans............................................180 Understanding Reserved Instance Pricing Tiers..............................................................182 Understanding the Pricing Benefit of Reserved Instances..............................................187 Reserved Instances and Consolidated Billing........................................................189 Reserved Instance Marketplace ...................................................................................... 189 Buying Reserved Instances.......................................................................................................192 Becoming a Buyer............................................................................................................193 Purchasing Reserved Instances......................................................................................194 Reading Your Statement (Invoice)....................................................................................200 Obtaining Information About Your Reserved Instances.............................................................202 Modifying Your Reserved Instances.......................................................................................... 207 Changing the Instance Type of Your Reservations...........................................................210 Submitting Modification Requests....................................................................................213 Selling in the Reserved Instance Marketplace..........................................................................217 Registering as a Seller.....................................................................................................218 Selling Your Reserved Instances......................................................................................222 After Your Reserved Instance Is Sold...............................................................................241 Requirements Checklist for Reserved Instances.......................................................................243 Instance Metadata and User Data......................................................................................................245 Importing and Exporting Instances.....................................................................................................256 Prerequisites ............................................................................................................................. 257 Importing a VM into Amazon EC2.............................................................................................259 Step 1: Install the Amazon EC2 CLI.................................................................................260 Step 2: Prepare Your VM..................................................................................................261 Step 3: Export Your VM from Its Virtual Environment.......................................................261 Step 4: Importing Your VM into Amazon EC2...................................................................262 Checking on the Status of Your Import Task...........................................................264 Importing Your Volumes into Amazon EBS.............................................................265 Resuming an Upload..............................................................................................266 Canceling an Upload.............................................................................................. 267 Cleaning Up After an Upload..................................................................................268 Step 5: Launch the instance in Amazon EC2...................................................................268 Exporting Amazon EC2 Instances ............................................................................................ 268 Troubleshooting ......................................................................................................................... 270 Instance Lifecycle ............................................................................................................................... 275 Launch ................................................................................................................................................ 278 Launching an Instance..............................................................................................................279 Launching an Instance from a Backup......................................................................................284 Launching an AWS Marketplace Instance.................................................................................285 Connect .............................................................................................................................................. 287 Connect Using SSH .................................................................................................................. 287 API Version 2014-05-01 5 Amazon Elastic Compute Cloud User Guide Connect Using PuTTY...............................................................................................................291 Connect Using MindTerm..........................................................................................................295 Connect Using RDP.................................................................................................................. 296 Stop and Start.....................................................................................................................................298 Reboot ................................................................................................................................................ 301 Retire .................................................................................................................................................. 302 Terminate............................................................................................................................................ 304 Configure Instances............................................................................................................................310 Managing Software.............................................................................................................................311 Updating Instance Software...................................................................................................... 311 Adding Repositories .................................................................................................................. 315 Finding Software Packages.......................................................................................................316 Installing Software Packages .................................................................................................... 317 Preparing to Compile Software................................................................................................. 318 Managing Users..................................................................................................................................319 Set the Time for an Instance...............................................................................................................320 Changing the Hostname.....................................................................................................................323 Using Dynamic DNS...........................................................................................................................326 Launching Instances with User Data..................................................................................................328 Monitoring ........................................................................................................................................... 332 Automated and Manual Monitoring.....................................................................................................333 Best Practices for Monitoring..............................................................................................................335 Monitoring the Status of Your Instances.............................................................................................335 Monitoring Instances with Status Checks..................................................................................335 Monitoring Events for Your Instances........................................................................................340 Monitoring Your Instances with CloudWatch.......................................................................................343 Enabling or Disabling Detailed Monitoring on an Amazon EC2 Instance..................................344 View Amazon EC2 Metrics........................................................................................................347 Get Statistics for Metrics ........................................................................................................... 353 Get Statistics for a Specific EC2 Instance.......................................................................353 Aggregating Statistics Across Instances..........................................................................357 Get Statistics Aggregated by Auto Scaling Group...........................................................362 Get Statistics Aggregated by Image (AMI) ID..................................................................365 Graphing Metrics.......................................................................................................................370 Graph a Metric................................................................................................................. 370 Graph a Metric Across Resources...................................................................................371 Create a CloudWatch Alarm......................................................................................................374 Send Email Based on CPU Usage Alarm........................................................................374 Send Email Based on Load Balancer Alarm....................................................................376 Send Email Based on Storage Throughput Alarm...........................................................379 Create Alarms That Stop or Terminate an Instance..................................................................381 Monitoring Scripts for Amazon EC2 Instances...................................................................................396 Amazon CloudWatch Monitoring Scripts for Linux....................................................................396 Amazon CloudWatch Monitoring Scripts for Windows..............................................................402 Network and Security ......................................................................................................................... 412 Key Pairs.............................................................................................................................................413 Security Groups..................................................................................................................................420 Controlling Access..............................................................................................................................428 IAM Policies...............................................................................................................................430 Supported Resources and Conditions.............................................................................436 Example Policies for CLI or SDK.....................................................................................443 Example Policies for the Console....................................................................................450 IAM Roles..................................................................................................................................458 Network Access.........................................................................................................................464 Amazon VPC ...................................................................................................................................... 466 Supported Platforms ................................................................................................................. 468 Instance IP Addressing.......................................................................................................................470 Multiple Private IP Addresses ................................................................................................... 475 API Version 2014-05-01 6 Amazon Elastic Compute Cloud User Guide Elastic IP Addresses...........................................................................................................................479 Elastic Network Interfaces .................................................................................................................. 484 Enhanced Networking ........................................................................................................................ 497 Storage ............................................................................................................................................... 502 Amazon EBS ...................................................................................................................................... 504 EBS Volumes.............................................................................................................................505 EBS Volume Types...........................................................................................................507 Creating a Volume............................................................................................................509 Restoring from a Snapshot..............................................................................................511 Attaching a Volume to an Instance...................................................................................513 Making a Volume Available for Use..................................................................................515 Volume Information .......................................................................................................... 519 Monitoring the Status of Your Volumes.............................................................................519 Detaching a Volume from an Instance.............................................................................529 Deleting a Volume............................................................................................................530 Expanding a Volume ........................................................................................................ 531 Expanding a Linux Partition.............................................................................................537 EBS Snapshots ......................................................................................................................... 542 Creating a Snapshot........................................................................................................ 543 Deleting a Snapshot.........................................................................................................544 Copying a Snapshot.........................................................................................................544 Snapshot Information.......................................................................................................546 Sharing Snapshots .......................................................................................................... 546 EBS Encryption......................................................................................................................... 548 EBS Performance......................................................................................................................550 EC2 Configuration............................................................................................................551 I/O Characteristics ........................................................................................................... 552 Workload Demand ........................................................................................................... 553 Pre-Warm Volumes .......................................................................................................... 553 RAID Configuration.......................................................................................................... 557 Benchmark Volumes ........................................................................................................ 563 API and Command Overview....................................................................................................566 Instance Store.....................................................................................................................................567 Amazon S3 ......................................................................................................................................... 576 Block Device Mapping ........................................................................................................................ 578 Using Public Data Sets.......................................................................................................................589 Resources and Tags........................................................................................................................... 592 Resource Locations............................................................................................................................592 Listing and Filtering Your Resources.................................................................................................. 593 Tagging Your Resources..................................................................................................................... 596 Service Limits ..................................................................................................................................... 604 Usage Reports....................................................................................................................................605 Instance Usage ......................................................................................................................... 607 Reserved Instance Utilization....................................................................................................611 Troubleshooting .................................................................................................................................. 617 Launching Your Instance.....................................................................................................................617 Connecting to Your Instance...............................................................................................................618 Stopping Your Instance....................................................................................................................... 623 Terminating Your Instance...................................................................................................................624 Failed Status Checks..........................................................................................................................625 Instance Capacity ............................................................................................................................... 648 General ............................................................................................................................................... 649 Making API Requests.........................................................................................................................651 Query Requests..................................................................................................................................652 Troubleshooting API Request Errors .................................................................................................. 656 Ensuring Idempotency........................................................................................................................658 SOAP Requests..................................................................................................................................660 Logging API Calls...............................................................................................................................661 API Version 2014-05-01 7 Amazon Elastic Compute Cloud User Guide Document History............................................................................................................................... 664 API Version 2014-05-01 8 Amazon Elastic Compute Cloud User Guide Features of Amazon EC2 What Is Amazon EC2? Amazon Elastic Compute Cloud (Amazon EC2) provides scalable 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-05-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.98) • Regions and Availability Zones (p.7) • Tags (p.596) Networking and Security • Amazon EC2 Key Pairs (p.413) • Security Groups (p.420) • Elastic IP Addresses (EIP) (p.479) • Amazon EC2 and Amazon VPC (p.466) Storage • Amazon EBS (p.504) • Instance Store (p.567) 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-05-01 2

Description:
their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon. Amazon Elastic Compute Cloud User Guide
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.