COST08-BP03 Deploy resources dynamically
With static capacity, you either pay for peak demand around the clock or you fail when demand climbs past what you provisioned. Deploying resources dynamically avoids both problems by adjusting capacity as demand changes. Some demand is predictable by time of day or week. The rest varies with real-time conditions. Match the provisioning method to the type of demand.
Desired outcome:
-
Your capacity rises and falls with demand automatically, without manual provisioning.
-
You meet predictable demand with scheduled or predictive provisioning that has capacity ready before the peak arrives.
-
You meet variable demand with reactive scaling driven by workload metrics.
-
You pay only for resources in use, because idle capacity is released when demand subsides.
Common anti-patterns:
-
Provisioning and deprovisioning resources manually as demand changes.
-
Setting scaling policies so aggressive that capacity oscillates, adding cost and instability.
-
Using reactive scaling for demand that is predictable by time, so capacity arrives after the peak.
-
Running non-production environments at full capacity outside the hours they are in use.
Benefits of establishing this best practice:
-
Costs fall, because resources run only when demand requires them.
-
Performance holds during peaks, because capacity scales to meet demand.
-
Operations need less manual effort, because scaling responds to demand automatically.
-
Resource management simplifies, because policies replace manual adjustments.
-
Energy use drops, because idle capacity is released.
Level of risk exposed if this best practice is not established: Low
Implementation guidance
You supply resources to meet demand in two forms: start and stop fixed resources on a schedule, or scale a managed group of resources up or down. AWS Instance Scheduler handles the first form. It starts and stops existing Amazon EC2 and Amazon RDS instances at set times. This suits resources with consistent daily patterns, such as instances that staff use during business hours. Instance Scheduler does not manage instances inside an Auto Scaling group or services such as Amazon Redshift and Amazon OpenSearch Service, because those manage their own capacity. You can configure schedules across accounts and Regions with AWS Systems Manager Quick Setup.
AWS Instance Scheduler starting and stopping instances on a schedule
AWS Auto Scaling
Demand-based supply reacts to near real-time demand. It uses metrics to vary resource count, adding capacity during spikes to hold performance and removing capacity when demand falls to save cost. Simple or step scaling adds or removes instances according to thresholds you define. Target tracking adjusts capacity to keep a metric at a target value. Weigh how quickly you can provision new resources and how wide the supply-demand gap will grow during that delay.
Demand-based supply reacting to real-time demand
Time-based supply aligns capacity to demand that is predictable by time, independent of current utilization. It makes resources available exactly when they are needed, without waiting for start-up and health checks. Scheduled scaling changes capacity at set times, such as the start of business hours. Predictive scaling learns daily and weekly patterns and scales ahead of them. Assess how consistent the pattern is, plan for pattern changes, and refine the schedule as monitoring reveals drift.
Time-based supply aligning capacity to predictable demand
Use launch templates instead of launch configurations. Templates expose the latest features, support mixing Spot and On-Demand Instances and multiple instance types, and can be versioned. Use attribute-based instance type selection to specify requirements such as vCPU, memory, and storage instead of naming instance types. This approach broadens available capacity and adopts newer instance generations automatically.
You can also scale vertically by changing an instance size or
class, or by modifying an Amazon EBS Elastic Volume in place. You
can provision or decommission whole environments with
AWS APIs and SDKs
Implementation steps
-
Schedule fixed resources for predictable idle periods: Identify resources used on a consistent schedule, such as development and test instances that sit idle outside business hours. Configure AWS Instance Scheduler to stop and start those Amazon EC2 and Amazon RDS instances at the required times. Exclude instances managed by an Auto Scaling group, which scales on its own policies.
-
Configure scheduled and predictive scaling for predictable demand: For demand that follows the clock, configure time-based scaling in AWS Auto Scaling. Use scheduled scaling when peak times are known, such as the start of business hours. Use predictive scaling when traffic follows recurring daily or weekly patterns, or when instances take long enough to start that reactive scaling would arrive late.
-
Configure dynamic scaling for variable demand: For demand that cannot be predicted by time, configure dynamic scaling driven by workload metrics with Amazon EC2 Auto Scaling. Set target tracking or step policies on the metrics that reflect load, and confirm the group scales within the response time the workload requires. Launch On-Demand and Spot Instances within one group, and apply Reserved Instances or a Savings Plan to the steady baseline to lower cost further.
Resources
Related best practices:
Related documents:
Related videos:
Related examples:
Related services: