Development Notes
  • Introduction
  • Programming Langauges
    • Java
      • Cache
      • Java Fundamentals
      • Multithreading & Concurrency
      • Spring Boot
        • Spring Security
        • Development tips
      • ORM
        • Mybatis
      • Implementation & Testing
    • Node.js
      • Asynchronous Execution
      • Node.js Notes
    • Python
      • Memo
  • Data Structure & Algorithm
  • Database
  • Design Pattern
  • AWS Notes
    • Services
      • API Gateway
      • CloudHSM
      • Compute & Load Balancing
        • Auto Scaling Group
        • EC2
        • ECS
        • ELB
        • Lambda
      • Data Engineering
        • Athena
        • Batch
        • EMR
        • IoT
        • Kinesis
        • Video Streaming
        • Quicksight
      • Deployment
        • CloudFormation
        • Code Deploy
        • Elastic Beanstalk
        • OpsWorks
        • SAM
        • SSM
      • ElasticSearch
      • Identity & Federation
        • Directory Service
        • IAM
        • Organizations
        • Resource Access Manager (RAM)
        • SSO
        • STS
      • KMS
      • Management Tools
        • Catalog
        • CloudTrail
        • CloudWatch
        • Config
        • Cost Allocation Tags
        • GuardDuty
        • Savings Plans
        • Trusted Advisor
        • X-Ray
      • Migration
        • Cloud Migration: The 6R
        • Disaster Recovery
        • DMS
        • VM Migrations
      • Networking
        • ACM
        • CloudFront
        • Direct Connect
        • EIP & ENI
        • Network Security
        • PrivateLink
        • Route53
        • VPC
        • VPN
      • Service Commnucation
        • Amazon MQ
        • SNS
        • SQS
        • Step Functions
        • SWF
      • Storage
        • Aurora
        • DynamoDB
        • EBS
        • EFS
        • ElastiCache
        • RDS
        • Redshift
        • S3
        • Storage Gateway
      • Other Services
        • Alexa for Business, Lex, Connect
        • AppStream 2.0
        • CloudSearch
        • Comprehend
        • Data Tools
        • Elastic Transcoder
        • Mechanical Turk
        • Rekognition
        • WorkDocs
        • WorkSpaces
    • Well Architect Framework
      • Security
      • Reliability
      • Performance Effeciency
      • Cost Optimization
      • Operational Excellence
    • Labs
      • Webserver Implementation
      • ELB Implementation
      • Auto-scaling Implementation
      • A 3-tier Architecture In VPC
  • Architecture
    • Security
  • Spark
    • Memo
  • Conference Notes
    • Notes of JCConf 2017
  • AI Notes
Powered by GitBook
On this page

Was this helpful?

  1. AWS Notes
  2. Services
  3. Compute & Load Balancing

Auto Scaling Group

PreviousCompute & Load BalancingNextEC2

Last updated 4 years ago

Was this helpful?

Scaling Policies

  • Simple / step scaling: increase or decrease based on CloudWatch alarms.

  • Target tracking: select a metric and a target value, ASG will smartly adjust it.

    • keep average CPU at 40%

    • keep request count per target at 1000

  • To scale based on RAM, must use a custom CloudWatch metric.

Feature

  • Launch configuration once created cannot be changed

  • To upgrade an AMI, must re-associate the launch configuration / template.

    • must terminate instances manually.

    • CloudFormation can help with the step.

  • Enable CloudWatch detailed monitoring which is disabled in creation

    • ​Create a new Launch Config with detail monitoring enabled

    • Associate it to the Auto Scaling Group

  • Scheduled scaling actions:

    • Modify the ASG settings (min / max / desired) at pre-defined time

    • Helpful when patterns are known in advance

  • Lifecycle Hooks:

    • Perform actions before an instance is in service, or before it is terminated.

    • Ex. cleanup, log extraction, special health checks.

  • AZ Rebalance

    • Be mindful of unfinished tasks

Scaling Processes

  • Launch: Add a new EC2 to the group, increasing the capacity.

  • Terminate: Removes an EC2 instance from the group, decreasing its capacity.

  • HealthCheck: Checks the health of the instances.

  • ReplaceUnhealthty: Terminate unhealthy instances and re-create them.

  • AZRebalance: Balance the number of EC2 instances across AZs.

  • AlarmNotification: Accepts notification from CloudWatch.

  • ScheduledActions: Performs scheduled actions that you create.

  • AddToLoadBalancer: Adds instances to the load balancer or target group.

Health Checks

  • Types:

    • EC2 status checks (default)

      • The health of EC2 instance doesn't equal to the health of ELB. Change health check targets to terminate instances correctly.

    • ELB health checks (HTTP)

  • ASG will launch a new instance after terminating an unhealthy one.

    • With Grace Period: 300s to wait for the health of new instance

    • With Cooldown Period: 300s to wait for another scaling / termination

Comparison of Auto Scaling update stratigies

  • Use the same ASG with new EC2 Launch Template

    • No chance to test the service in new version.

    • requests are handled by different version of service.

  • Create another ASG, EC2 Launch Template but use the same ALB.

    • Can send small traffic from ALB to new Scaling Group to verify the service in new version.

  • Create another ALB, ASG, EC2 Launch Template, and use Route53 to change the routing.

    • Relying customers on good behavior about DNS queries and respecting TTL.

    • Can test service in new version with a different ALB before update the Route53.

Spot Fleet (mix on Spot and On-demand instances) supports 3 types of ASG