Skip to content

giuseppe-trisciuoglio/developer-kit / plugins/developer-kit-aws/skills/aws-cloudformation/aws-cloudformation-auto-scaling

aws-cloudformation-auto-scaling

Flagged

Provides AWS CloudFormation patterns for Auto Scaling including EC2, ECS, and Lambda. Use when creating Auto Scaling groups, launch configurations, launch templates, scaling policies, lifecycle hooks, and predictive scaling. Covers template structure with Parameters, Outputs, Mappings, Conditions, cross-stack references, and best practices for high availability and cost optimization.

FileKindSize
SKILL.mdskill md12.5 KB
references/constraints.mdmarkdown5.6 KB
references/examples.mdmarkdown41.1 KB
references/reference.mdmarkdown19.1 KB

references/constraints.md

View on GitHub
# AWS Auto Scaling Constraints and Limitations

## Resource Limits

### Auto Scaling Group Limits

```yaml
# Maximum 100 Auto Scaling Groups per region per AWS account
# Maximum 500 step adjustments in step scaling policy
# Lifecycle hooks limits vary by instance type

Parameters:
  MaxAutoScalingGroups:
    Type: Number
    Default: 50
    MaxValue: 100
    Description: Expected number of Auto Scaling Groups

Resources:
  AutoScalingGroup:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      AutoScalingGroupName: !Sub "${AWS::StackName}-asg"
      MinSize: 1
      MaxSize: 10
      DesiredCapacity: 2
      # Cannot exceed 100 ASGs per region
```

## Scaling Constraints

### Cooldown Periods

```yaml
# Scaling cooldowns prevent rapid oscillations
# Can delay response to demand changes

Parameters:
  DefaultCooldown:
    Type: Number
    Default: 300
    Description: Default cooldown in seconds

  ScaleInCooldown:
    Type: Number
    Default: 300
    Description: Scale-in cooldown in seconds

Resources:
  AutoScalingGroup:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      DefaultCooldown: !Ref DefaultCooldown
```

### Health Check Grace Period

```yaml
# Too short grace period may terminate bootstrapping instances
# Set appropriate grace period for application startup

Resources:
  AutoScalingGroup:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      HealthCheckGracePeriod: 300
      HealthCheckType: ELB
      # Give instances time to start before health checks
```

## Operational Constraints

### Instance Termination

```yaml
# Scale-in terminates instances without graceful shutdown by default
# Implement lifecycle hooks for graceful shutdown

Resources:
  LifecycleHook:
    Type: AWS::AutoScaling::LifecycleHook
    Properties:
      LifecycleHookName: shutdown-hook
      AutoScalingGroupName: !Ref AutoScalingGroup
      LifecycleTransition: autoscaling:EC2_INSTANCE_TERMINATING
      HeartbeatTimeout: 300
      NotificationTargetARN: !Ref SNSTopic
      RoleARN: !Ref LifecycleHookRole
      # Enables graceful shutdown
```

### Mixed Instances Policy

```yaml
# Not all instance types support on-demand/Spot allocation
# Check instance type compatibility

Resources:
  AutoScalingGroup:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      MixedInstancesPolicy:
        InstancesDistribution:
          OnDemandBaseCapacity: 1
          OnDemandPercentageAboveBaseCapacity: 50
          SpotAllocationStrategy: capacity-optimized
        LaunchTemplate:
          LaunchTemplateSpecification:
            InstanceType: t3.micro
            # Verify instance type supports Spot
```

## Cost Considerations

### Spot Instance Termination

```yaml
# Spot instances can be terminated with 2-minute notice
# Not suitable for stateful workloads

Resources:
  AutoScalingGroup:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      MixedInstancesPolicy:
        InstancesDistribution:
          SpotAllocationStrategy: capacity-optimized
      # Spot instances can be interrupted
```

### Over-Provisioning

```yaml
# Setting minimum capacity too high leads to unnecessary costs
# Use predictive scaling for demand forecasting

Resources:
  AutoScalingGroup:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      MinSize: 1  # Avoid over-provisioning
      MaxSize: 10
```

## Best Practices to Avoid Constraints

### Use Multiple Scaling Policies

```yaml
# Combine different scaling strategies for optimal response

Resources:
  CPUPolicy:
    Type: AWS::AutoScaling::ScalingPolicy
    Properties:
      PolicyName: cpu-scaling
      AutoScalingGroupName: !Ref AutoScalingGroup
      ScalingAdjustmentType: ChangeInCapacity
      StepAdjustments:
        - MetricIntervalLowerBound: 30
          ScalingAdjustment: -1
        - MetricIntervalUpperBound: 70
          ScalingAdjustment: 1

  NetworkPolicy:
    Type: AWS::AutoScaling::ScalingPolicy
    Properties:
      PolicyName: network-scaling
      AutoScalingGroupName: !Ref AutoScalingGroup
      ScalingAdjustmentType: ChangeInCapacity
      StepAdjustments:
        - MetricIntervalLowerBound: 40
          ScalingAdjustment: 1
        - MetricIntervalUpperBound: 80
          ScalingAdjustment: -1
```

### Implement Predictive Scaling

```yaml
# Requires 24 hours of metric data before accurate predictions
# Use for predictable workload patterns

Resources:
  ScalingPolicy:
    Type: AWS::AutoScaling::ScalingPolicy
    Properties:
      PolicyName: predictive-scaling
    PolicyType: PredictiveScaling
    AutoScalingGroupName: !Ref AutoScalingGroup
    PredictiveScalingConfiguration:
      MetricSpecification:
        - TargetValue: 1000
          PredefinedMetricSpecification:
            PredefinedMetricType: ASGAverageCPUUtilization
      SchedulingBufferTime: 300
```

### Configure Lifecycle Hooks

```yaml
# Enable graceful shutdown for stateful applications

Resources:
  TerminationHook:
    Type: AWS::AutoScaling::LifecycleHook
    Properties:
      LifecycleHookName: termination-hook
      AutoScalingGroupName: !Ref AutoScalingGroup
      LifecycleTransition: autoscaling:EC2_INSTANCE_TERMINATING
      HeartbeatTimeout: 300
      DefaultResult: CONTINUE
      NotificationTargetARN: !Ref SNSTopic
      RoleARN: !Ref LifecycleHookRole
```

## Quota Management

### Request Quota Increases

```yaml
# Auto Scaling group limits can be increased
# Service-linked roles may be required

Outputs:
  QuotaIncreaseRequest:
    Description: Link to request quota increase
    Value: !Sub "https://console.aws.amazon.com/support/home#/case/create?issueType=service-limit-increase&serviceCode=amazon-autoscaling"
```
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall