Skip to content

Instantly share code, notes, and snippets.

@ryan-lane
Last active June 3, 2017 02:45
Show Gist options
  • Save ryan-lane/03be13fe571ac81836f764a3860e5b75 to your computer and use it in GitHub Desktop.
Save ryan-lane/03be13fe571ac81836f764a3860e5b75 to your computer and use it in GitHub Desktop.
Example override for scaling policy
Ensure {{ grains.workers.web.cluster_name }} asg exists:
boto_asg.present:
- name: {{ grains.workers.web.cluster_name }}
- launch_config_name: {{ grains.workers.web.cluster_name }}
- launch_config:
- image_id: {{ pillar.ec2_ami.iad.ubuntu14.hvm_ssd }}
- key_name: sshunusablekey
- security_groups:
- {{ grains.service_name }}
- instance_profile_name: {{ grains.workers.web.cluster_name }}
- instance_type: c4.xlarge
- block_device_mappings:
- "/dev/sda1":
size: 20
volume_type: gp2
delete_on_termination: true
- instance_monitoring: true
- vpc_zone_identifier: {{ pillar.vpc.vpc_subnets }}
- availability_zones: {{ pillar.vpc.availability_zones }}
- min_size: {{ 3 * pillar.vpc.availability_zones|length }}
- max_size: {{ 30 * pillar.vpc.availability_zones|length }}
- alarms:
autoscale up alarm:
attributes:
threshold: 50.0
- scaling_policies:
- name: ScaleUp
adjustment_type: PercentChangeInCapacity
scaling_adjustment: 20
min_adjustment_step: {{ 6 * pillar.vpc.availability_zones|length }}
cooldown: 1800
- name: ScaleDown
adjustment_type: ChangeInCapacity
scaling_adjustment: -2
cooldown: 300
- tags:
- key: Name
value: {{ grains.workers.web.cluster_name }}
propagate_at_launch: true
- profile: primary_profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment