GithubHelp home page GithubHelp logo

hl-component-az-asg's Introduction

az-asg CfHighlander component

Creates an identical AutoScaling Group per AWS Availability Zone with a shared IAM role and security group.

Parameters

Name Use Default Global Type Allowed Values
EnvironmentName Tagging dev true string
EnvironmentType Tagging development true string ['development','production']
RoleName Tagging component_name false string
SubnetIds comma delimited list of 2 subnets to place the directory in false comma delimited list
AvailabilityZones Set the availability zone count for the autoscaling groups false number
VPCId VPC Id false AWS::EC2::VPC::Id
KeyPair Key pair for ssh access. if none is supplied the instance is launched without one false string
Ami Amazon machine image false AWS::EC2::Image::Id
AsgDesired the desired instance count for the ASGs false number
AsgMax the maximum instance count for the ASGs false number
AsgMin the minimum instance count for the ASGs false number
HealthCheckType how the instance health is evaluated either by EC2 or ELB health checks EC2 false string ['EC2','ELB']
HealthCheckGracePeriod the period in seconds before a new instances health is evaluated 500 false number
InstanceType EC2 instance type such as t3.small t3.small false string
Spot enable spot instances on the ASG false false boolean

Configuration

Max Availability Zones

Determines the maximum amount of availability zones this component can create an ASG for. This value is used to generate the Cloudformation conditions on the Autoscaling resources.

max_availability_zones: 3

AutoScaling Update Policy

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html

asg_update_policy:
  min: 0
  batch_size: 1
  suspend:
    - HealthCheck
    - ReplaceUnhealthy
    - AZRebalance
    - AlarmNotification
    - ScheduledActions
  pause_time: PT05
  wait_on_signals: 'false'

IAM

to alter the asg IAM role change the following config under iam_policies:asg:

iam_policies:
  asg:
    ec2-describe:
      action:
        - ec2:Describe*

Userdata

the component supports both windows and linux userdata with linux being the default.

to set it to windows alter the operating_system: config

operating_system: linux #| windows

linux_user_data: |
  #!/bin/bash
  hostname ${EnvironmentName}-${RoleName}-`/opt/aws/bin/ec2-metadata --instance-id|/usr/bin/awk '{print $2}'`
  sed '/HOSTNAME/d' /etc/sysconfig/network > /tmp/network && mv -f /tmp/network /etc/sysconfig/network && echo "HOSTNAME=${EnvironmentName}-`/opt/aws/bin/ec2-metadata --instance-id|/usr/bin/awk '{print $2}'`" >>/etc/sysconfig/network && /etc/init.d/network restart

windows_user_data: |
  <powershell>
  $instanceId = invoke-restmethod -uri http://169.254.169.254/latest/meta-data/instance-id
  cfn-signal.exe -e $lastexitcode --region ${AWS::Region} --stack ${AWS::StackName} --resource 'AutoScaleGroup'
  </powershell>

Termination Policy

termination_policies:
  - Default
  # - OldestInstance
  # - NewestInstance
  # - OldestLaunchConfiguration
  # - ClosestToNextInstanceHour

hl-component-az-asg's People

Contributors

guslington avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.