auto scaling

9
Auto Scaling Getting Started Guide API Version 2011-01-01

Upload: salam78au

Post on 18-Jan-2016

4 views

Category:

Documents


0 download

DESCRIPTION

aws

TRANSCRIPT

Auto ScalingGetting Started Guide

API Version 2011-01-01

Auto Scaling: Getting Started GuideCopyright © 2015 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,AWS CloudTrail, AWS CodeDeploy, Amazon Cognito, Amazon DevPay, DynamoDB, ElastiCache, Amazon EC2, Amazon ElasticCompute Cloud, Amazon Glacier, Amazon Kinesis, Kindle, Kindle Fire, AWS Marketplace Design, Mechanical Turk, Amazon Redshift,Amazon Route 53, Amazon S3, Amazon VPC, and Amazon Zocalo. In addition, Amazon.com graphics, logos, page headers, buttonicons, scripts, and service names are trademarks, or trade dress of Amazon in the U.S. and/or other countries. Amazon's trademarksand 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 causeconfusion 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, connectedto, or sponsored by Amazon.

Auto Scaling Getting Started Guide

Table of ContentsGet Started with Auto Scaling .......................................................................................................... 1Create an Auto Scaling Group ......................................................................................................... 2

Create a Launch Configuration ................................................................................................ 2Create an Auto Scaling Group ................................................................................................. 3Verify Auto Scaling Group Creation ........................................................................................... 3

Delete an Auto Scaling Group .......................................................................................................... 4Where Do I Go from Here? ............................................................................................................. 5

Resources ........................................................................................................................... 5

API Version 2011-01-01iii

Auto Scaling Getting Started Guide

Get Started with Auto Scaling

Auto Scaling is designed to launch or terminate EC2 instances automatically based on user-definedpolicies, schedules, and health checks. This tutorial walks you through the process of creating an AutoScaling group and then deleting it.

Prerequisites

Before you start this tutorial, complete Setting Up in the Auto Scaling Developer Guide.

API Version 2011-01-011

Auto Scaling Getting Started Guide

Create an Auto Scaling Group

Let's create a simple Auto Scaling group designed to contain exactly one EC2 instance. First, you'll createa launch configuration that specifies the type of EC2 instance that you want Auto Scaling to create. Next,you'll create an Auto Scaling group that references your launch configuration. Finally, you'll verify thatthe Auto Scaling group is functioning.

If you haven't done so already, you must create a virtual private cloud (VPC) and a security group foryour VPC. For more information, see Setting Up in the Amazon EC2 User Guide for Linux Instances.

Create a Launch ConfigurationThe launch configuration specifies the type of EC2 instance that Auto Scaling creates for you. To createa launch configuration, you must specify an Amazon Machine Image (AMI) ID and an EC2 instance type.

To create a launch configuration

1. Open the Amazon EC2 console.

2. In the navigation pane, click Launch Configurations. If you are new to Auto Scaling, you see awelcome page; click Create Auto Scaling group.

3. Click Create launch configuration.

4. On the Choose AMI page, click Free tier only, and then select an Amazon Linux AMI with the HVMvirtualization type.

5. On the Choose Instance Type page, select the General purpose tab, select the t2.micro instancetype, and then click Next: Configure details.

6. On the Configure details page, do the following:

a. Under Create Launch Configuration, enter a name for your launch configuration (for example,my-lc).

b. Expand Advanced Details, and then select Assign a public IP address to every instance.

c. Click Skip to review.

7. On the Review page, click Edit security groups. Click Select an existing security group, selectthe security group that you created for your VPC, and then click Review.

8. On the Review page, click Create launch configuration.

API Version 2011-01-012

Auto Scaling Getting Started GuideCreate a Launch Configuration

9. In the Select an existing key pair or create a new key pair dialog box, select Choose an existingkey pair, then select an existing key pair. Click the acknowledgment check box, and then click Createlaunch configuration.

TipIf you don't plan to log in to your instance, you can select Proceed without a key pairinstead. If you'd like to log in to your instance but don't have a key pair already, follow thedirections to create one.

Create an Auto Scaling GroupAfter you have defined your launch configuration, you are automatically taken to the page to create anAuto Scaling group. To create an Auto Scaling group, you must specify a name for your group, a launchconfiguration, one or more Availability Zones, a minimum group size, and a maximum group size. Usethe launch configuration that you created in the previous procedure. The Availability Zones you choosedetermine the physical location of your Auto Scaling instances. For this example, specify a single zone.Set the minimum and maximum size of your Auto Scaling group to 1. Because the minimum size of thegroup is 1, Auto Scaling begins creating an EC2 instance immediately.

To create an Auto Scaling group

1. On the Configure Auto Scaling group details page, do the following:

a. Enter a name for the Auto Scaling group. For example, my-asg.

b. In Group size, type 1 in the text box.

c. T2 instances must be launched into a subnet. Select your VPC from the Network list and thepublic subnet from the Subnet list.

d. Click Next: Configure scaling policies.

2. On the Configure scaling policies page, click Review.

3. On the Review page, click Create Auto Scaling group.

4. Click View your Auto Scaling groups.

Verify Auto Scaling Group CreationFirst, verify that your instance is ready. From the Auto Scaling Groups page, select your Auto Scalinggroup, and then select the Instances tab. Initially, your instance is in the Pending state. When the stateis InService, it is ready for use.

API Version 2011-01-013

Auto Scaling Getting Started GuideCreate an Auto Scaling Group

Delete an Auto Scaling Group

When you are finished, delete the Auto Scaling group. Deleting an Auto Scaling group using the consoleterminates all EC2 instances in the Auto Scaling group. After you delete the Auto Scaling group, you candelete the launch configuration.

To delete the Auto Scaling group

1. Open the Amazon EC2 console.

2. In the navigation pane, click Auto Scaling Groups.

3. Select your Auto Scaling group, click Actions, and then click Delete.

4. When prompted for confirmation, click Yes, Delete.The values of the Desired, Min, and Max columnschange to 0 and the EC2 instances enter the terminating state.

To delete the launch configuration

1. In the navigation pane, click Launch Configurations.

2. Select your launch configuration, click Actions, and then click Delete launch configuration.

3. When prompted for confirmation, click Yes, Delete.

API Version 2011-01-014

Auto Scaling Getting Started Guide

Where Do I Go from Here?

Auto Scaling offers features we haven't covered in this guide, such as setting the desired capacity, creatingscaling policies, and integrating with CloudWatch, Elastic Load Balancing, and Amazon Simple NotificationService.You can also get more information about features like the following in the Auto Scaling DeveloperGuide:

Health ChecksA health check is a call to check on the health status of each instance in an Auto Scaling group. Ifan instance reports degraded performance, Auto Scaling terminates the instance and launchesanother one to take its place.

TriggersA trigger is a combination of an Auto Scaling policy and an CloudWatch alarm.You can create alarmsthat monitor specific metrics gathered from an EC2 instance. When paired with an alarm, a policycan initiate an Auto Scaling action when a CloudWatch metric breaches a specific threshold.

Scheduled UpdatesA scheduled update is a call to Auto Scaling that is scheduled for a future time.

Suspending and Resuming ProcessesYou can suspend scaling processes at any time. When you're ready, you can resume any or all ofthe suspended processes. When an Auto Scaling group's scaling processes are suspended, AutoScaling creates no new scaling activities for that group for any reason. Scaling activities that werealready in progress before the group was suspended continue until complete.

ResourcesThe following related resources can help you as you work with this service.

• Auto Scaling – The primary web page for information about Auto Scaling.

• Auto Scaling Technical FAQ – The FAQ covers questions developers have asked about Auto Scaling.

• Amazon EC2 Discussion Forum – Get help from the community of developers.

• AWS Developer Tools – Links to developer tools and resources that provide documentation, codesamples, release notes, and other information to help you build innovative applications with AWS.

• AWS Support Center – The hub for creating and managing your AWS Support cases. Also includeslinks to other helpful resources, such as forums, technical FAQs, service health status, and AWSTrusted Advisor.

API Version 2011-01-015

Auto Scaling Getting Started GuideResources

• AWS Support – The primary web page for information about AWS Support, a one-on-one, fast-responsesupport channel to help you build and run applications in the cloud.

• Contact Us – A central contact point for inquiries concerning AWS billing, account, events, abuse, andother issues.

• AWS Site Terms – Detailed information about our copyright and trademark; your account, license, andsite access; and other topics.

API Version 2011-01-016

Auto Scaling Getting Started GuideResources