Auto Scaling Flashcards Preview

AWS Developer > Auto Scaling > Flashcards

Flashcards in Auto Scaling Deck (10)
Loading flashcards...
1

Auto Scaling

Auto Scaling resizes your computer clusters (Amazon EC2 instances) based on demand.

Auto Scaling

Auto Scaling resizes your computer clusters (Amazon EC2 instances) based on demand.

2

Auto Scaling components

  • Launch configuration: defines how Auto Scaling should launch your Amazon EC2 instances (similar to creating EC2 instances)
  • Auto Scaling group: uses a launch configuration to launch Amazon EC2 instances
  • Auto Scaling policy: uses a combination of policies and alarms to determine when the specified conditions for launching and terminating instances are met
  • Scheduled action: allows you to scale your application in response to predictable load changes

Auto Scaling components

  • Launch configuration: defines how Auto Scaling should launch your Amazon EC2 instances (similar to creating EC2 instances)
  • Auto Scaling group: uses a launch configuration to launch Amazon EC2 instances
  • Auto Scaling policy: uses a combination of policies and alarms to determine when the specified conditions for launching and terminating instances are met
  • Scheduled action: allows you to scale your application in response to predictable load changes

3

How does Auto Scaling work?

How does Auto Scaling work?

4

Auto Scaling Group

Auto Scaling Group

5

Auto Scaling Policies

Auto Scaling Policies

6

Elastic Load Balancing, CloudWatch, and Auto Scaling

Elastic Load Balancing, CloudWatch, and Auto Scaling

7

Auto Scaling Consideration

  • Avoid Auto Scaling thrashing
    • Be more cautious about scaling in ( = you are decreasing the computing capacity due to low utilization); avoid aggressive instance termination
    • Scale out early, scale in slowly
  • Set the min, max, and desired capacity parameter values carefully
    • Desired capacity determines how many instances will be running whenever there are no scaling policies being applied
  • You cannot modify a Launch Configuration. If you want to modify the LC for a running Auto Scaling Group, you need to create a new LC and then assign it to the ASG. New instances will use the new LC and previous instances will still be running.
  • Auto Scaling cannot span multiple regions

Auto Scaling Consideration

  • Avoid Auto Scaling thrashing
    • Be more cautious about scaling in ( = you are decreasing the computing capacity due to low utilization); avoid aggressive instance termination
    • Scale out early, scale in slowly
  • Set the min, max, and desired capacity parameter values carefully
    • Desired capacity determines how many instances will be running whenever there are no scaling policies being applied
  • You cannot modify a Launch Configuration. If you want to modify the LC for a running Auto Scaling Group, you need to create a new LC and then assign it to the ASG. New instances will use the new LC and previous instances will still be running.
  • Auto Scaling cannot span multiple regions

8

Auto Scaling - Loose Coupling

State information that contains information that is unique to the user (HTTP session information) is often used when generating dynamic content.

State sharing pattern lets you maintain state information in a scale-out structure. The state information is referenced by multiple servers. This makes the server "stateless", having no state information. 

Stateless Application: An application that needs no knowledge of previous interactions and stores no session information.

Auto Scaling - Loose Coupling

State information that contains information that is unique to the user (HTTP session information) is often used when generating dynamic content.

State sharing pattern lets you maintain state information in a scale-out structure. The state information is referenced by multiple servers. This makes the server "stateless", having no state information. 

Stateless Application: An application that needs no knowledge of previous interactions and stores no session information.

9

Auto Scaling Lifecycle Hooks

  1. Auto Scaling responds to scale out events by launching instances and scale in events by terminating instances.
  2. Auto Scaling puts the instance into a wait state (Pending:Wait or Terminating:Wait). The instance remains in this state until either you tell Auto Scaling to continue or the timeout period ends.
  3. You can perform a custom action using one or more of the following options:
  • Define a CloudWatch Events target to invoke a Lambda function when a lifecycle action occurs. The Lambda function is invoked when Auto Scaling submits an event for a lifecycle action to CloudWatch Events. The event contains information about the instance that is launching or terminating, and a token that you can use to control the lifecycle action.
  • Define a notification target for the lifecycle hook. Auto Scaling sends a message to the notification target. The message contains information about the instance that is launching or terminating, and a token that you can use to control the lifecycle action.
  • Create a script that runs on the instance as the instance starts. The script can control the lifecycle action using the ID of the instance on which it runs.
  1. By default, the instance remains in a wait state for one hour, and then Auto Scaling continues the launch or terminate process (Pending:Proceed or Terminating:Proceed). If you need more time, you can restart the timeout period by recording a heartbeat. If you finish before the timeout period ends, you can complete the lifecycle action, which continues the launch or termination process.

Auto Scaling Lifecycle Hooks

  1. Auto Scaling responds to scale out events by launching instances and scale in events by terminating instances.
  2. Auto Scaling puts the instance into a wait state (Pending:Wait or Terminating:Wait). The instance remains in this state until either you tell Auto Scaling to continue or the timeout period ends.
  3. You can perform a custom action using one or more of the following options:
  • Define a CloudWatch Events target to invoke a Lambda function when a lifecycle action occurs. The Lambda function is invoked when Auto Scaling submits an event for a lifecycle action to CloudWatch Events. The event contains information about the instance that is launching or terminating, and a token that you can use to control the lifecycle action.
  • Define a notification target for the lifecycle hook. Auto Scaling sends a message to the notification target. The message contains information about the instance that is launching or terminating, and a token that you can use to control the lifecycle action.
  • Create a script that runs on the instance as the instance starts. The script can control the lifecycle action using the ID of the instance on which it runs.
  1. By default, the instance remains in a wait state for one hour, and then Auto Scaling continues the launch or terminate process (Pending:Proceed or Terminating:Proceed). If you need more time, you can restart the timeout period by recording a heartbeat. If you finish before the timeout period ends, you can complete the lifecycle action, which continues the launch or termination process.

10

Auto Scaling Lifecycle Hooks

Auto Scaling lifecycle hooks enable you to perform custom actions as Auto Scaling launches or terminates instances. For example, you could install or configure software on newly launched instances, or download log files from an instance before it terminates.

Each Auto Scaling group can have multiple lifecycle hooks. However, there is a limit on the number of hooks per Auto Scaling group.