Skip to content

Auto Scaling

CloudMock emulates Amazon EC2 Auto Scaling, supporting launch configurations, auto scaling groups with min/max/desired capacity enforcement, scaling policies (Simple, Step, and Target Tracking), scheduled actions, lifecycle hooks, metrics collection, and instance lifecycle operations.

OperationStatusNotes
CreateLaunchConfigurationSupported
DescribeLaunchConfigurationsSupported
DeleteLaunchConfigurationSupported
CreateAutoScalingGroupSupportedEnforces min/max/desired capacity
DescribeAutoScalingGroupsSupported
UpdateAutoScalingGroupSupported
DeleteAutoScalingGroupSupported
SetDesiredCapacitySupportedClamped to min/max
DescribeAutoScalingInstancesSupported
AttachInstancesSupported
DetachInstancesSupported
PutScalingPolicySupportedSimpleScaling, StepScaling, TargetTrackingScaling
DescribePoliciesSupportedFilter by ASG name or policy names
DeletePolicySupported
ExecutePolicySupportedApplies scaling adjustment; clamps to min/max
PutScheduledUpdateGroupActionSupportedCron-based scheduled scaling
DescribeScheduledActionsSupportedFilter by ASG name
DeleteScheduledActionSupported
EnableMetricsCollectionSupportedNo-op acknowledgment in mock
DisableMetricsCollectionSupportedNo-op acknowledgment in mock
PutLifecycleHookSupportedLAUNCHING and TERMINATING transitions
DescribeLifecycleHooksSupportedFilter by ASG name or hook names
DeleteLifecycleHookSupported
CompleteLifecycleActionSupportedNo-op (lifecycle completion acknowledged)
CreateOrUpdateTagsSupported
DescribeTagsSupported
DeleteTagsSupported
import {
AutoScalingClient,
CreateLaunchConfigurationCommand,
CreateAutoScalingGroupCommand,
PutScalingPolicyCommand,
PutLifecycleHookCommand,
} from '@aws-sdk/client-auto-scaling';
const client = new AutoScalingClient({
endpoint: 'http://localhost:4566',
region: 'us-east-1',
credentials: { accessKeyId: 'test', secretAccessKey: 'test' },
});
await client.send(new CreateLaunchConfigurationCommand({
LaunchConfigurationName: 'my-lc',
ImageId: 'ami-12345678',
InstanceType: 't3.micro',
}));
await client.send(new CreateAutoScalingGroupCommand({
AutoScalingGroupName: 'my-asg',
LaunchConfigurationName: 'my-lc',
MinSize: 1,
MaxSize: 5,
DesiredCapacity: 2,
AvailabilityZones: ['us-east-1a'],
}));
await client.send(new PutLifecycleHookCommand({
AutoScalingGroupName: 'my-asg',
LifecycleHookName: 'launch-hook',
LifecycleTransition: 'autoscaling:EC2_INSTANCE_LAUNCHING',
DefaultResult: 'CONTINUE',
HeartbeatTimeout: 300,
}));
import boto3
client = boto3.client('autoscaling',
endpoint_url='http://localhost:4566',
region_name='us-east-1',
aws_access_key_id='test',
aws_secret_access_key='test')
client.create_launch_configuration(
LaunchConfigurationName='my-lc',
ImageId='ami-12345678',
InstanceType='t3.micro')
client.create_auto_scaling_group(
AutoScalingGroupName='my-asg',
LaunchConfigurationName='my-lc',
MinSize=1, MaxSize=5, DesiredCapacity=2,
AvailabilityZones=['us-east-1a'])
client.put_scheduled_update_group_action(
AutoScalingGroupName='my-asg',
ScheduledActionName='nightly-scale-down',
DesiredCapacity=1,
Recurrence='0 2 * * *')
cloudmock.yml
services:
autoscaling:
enabled: true
  • Scaling policies are stored but automatic metric-based scaling is not performed
  • ExecutePolicy applies the adjustment once on demand
  • Lifecycle hooks are stored but do not intercept actual instance launch/termination
  • EnableMetricsCollection/DisableMetricsCollection are no-ops (acknowledged, not enforced)
  • Instance reconciliation is simulated and does not launch real EC2 instances