Automatic Scaling

Scale your Private Access Connector VM instances based on metric thresholds by creating dynamic scaling policies.

  1. Verify that EC2 detailed monitoring is enabled for your Auto Scaling group.
    Important:

    Automatic scaling requires EC2 detailed monitoring which incurs charges. For more information, see Amazon CloudWatch documentation.

    1. On the stack screen you just created, click the Resources tab, and then click the Physical ID in the LaunchConfig row.
    2. On the Launch configurations screen that appears, view the Monitoring status in the Details section.
      • True: EC2 detailed monitoring is enabled. Go to step 3.

      • False: EC2 detailed monitoring is not enabled. Go to step 2.

  2. (Optional) Perform the following substeps to enable EC2 detailed monitoring for your Auto Scaling group and for the two existing instances in the group.
    1. In the left navigation, go to Auto Scaling > Launch Configurations.
    2. Select the launch configuration of the desired Auto Scaling group, and then click Copy launch configuration in the Details section.
    3. On the Create launch configuration screen that appears, specify a name, and then select Enable EC2 instance detailed monitoring within CloudWatch in the Additional configuration - optional section.
    4. Confirm your key pair settings, select the acknowledgement checkbox, and then click Create launch configuration.
    5. Go back to the overview screen of the desired Auto Scaling group.
    6. On the Details tab, click Edit in the Launch configuration section.
    7. On the Launch configuration screen that appears, select the newly created launch configuration from the Launch configuration drop-down list, and then click Update.

      EC2 detailed monitoring is enabled for your Auto Scaling group.

    8. On the overview screen of the Auto Scaling group, click the Instance Management tab.
    9. Click the instance ID of the instance you want to update.
    10. On the instance summary page, click the Monitoring tab, and then click Manage detailed monitoring in the upper right.
    11. On the Detailed monitoring screen that appears, select Enable detailed monitoring, and click Confirm.
    12. Repeat steps i to k to enable detailed monitoring for all existing instances.
  3. Go to the CloudWatch service and create two CloudWatch alarms for scaling out and scaling in.

    The CloudWatch alarms are used to create dynamic scaling policies in the later step.

    1. On the Alarms screen, click Create alarm in the upper right.
    2. On the Specify metric and conditions screen, click Select metric, and then click EC2 in the Metrics section on the Browse tab.
    3. Click By Auto Scaling Group, locate and select CPUUtilization for the desired Auto Scaling group from the drop-down list, and then click Select metric.
    4. Specify the following field.

      Field

      Setting

      Metric

      Statistic

      Average

      Period

      1 minute

      Conditions

      Threshold type

      Static

      When CPUUtilization is

      Greater

      than...

      • 80 (suggested) for 2 virtual CPUs

      • 70 (suggested) for 4 virtual CPUs

      Datapoints to alarm

      5 out of 5

    5. Click Next.
    6. On the Configure actions screen, click Remove in the Notification section, and then click Next.
    7. On the Add name and description screen, specify a name and a description for the alarm, and then click Next.
    8. Confirm the settings and click Create alarm.
    9. Repeat steps a to h to create another alarm for scaling in with the following metric and condition field settings.

      Field

      Setting

      Metric

      Statistic

      Average

      Period

      1 minute

      Conditions

      Threshold type

      Static

      When CPUUtilization is

      Lower

      than...

      • 15 (suggested) for 2 virtual CPUs

      • 10 (suggested) for 4 virtual CPUs

      Datapoints to alarm

      10 out of 10

  4. Create dynamic scaling policies.
    1. Go back to the overview screen of the desired Auto Scaling group, and then click the Automatic scaling tab.
    2. Click Create dynamic scaling policy.
    3. Create a policy for scaling out by specifying the following fields and clicking Create.

      Field

      Setting

      Policy type

      Simple scaling

      Scaling policy name

      A unique name to identify the policy

      CloudWatch alarm

      The CloudWatch alarm created for scaling out

      Take the action

      Add 1 capacity units

      And then wait

      600

    4. Repeat steps b and c to create another policy for scaling in with the following field settings.

      Field

      Setting

      Policy type

      Simple scaling

      Scaling policy name

      A unique name to identify the policy

      CloudWatch alarm

      The CloudWatch alarm created for scaling in

      Take the action

      Remove 1 capacity units

      And then wait

      1200