Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save antklim/74faca4ee3d22def13e4c116f0993a2d to your computer and use it in GitHub Desktop.
Save antklim/74faca4ee3d22def13e4c116f0993a2d to your computer and use it in GitHub Desktop.
AutoScalingGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
VPCZoneIdentifier:
- !Ref PrivateSubnet1
- !Ref PrivateSubnet2
LaunchConfigurationName: !Ref LaunchConfiguration
MinSize: 4
MaxSize: 4
DesiredCapacity: 4
Tags:
- Key: Name
Value: !Sub ${Namespace}-${Environment}-EC2-host
PropagateAtLaunch: true
TargetGroupARNs:
- !Ref SimpleApiTargetGroup
CreationPolicy:
ResourceSignal:
Timeout: PT5M
UpdatePolicy:
AutoScalingRollingUpdate:
MinInstancesInService: 1
MaxBatchSize: 1
PauseTime: PT5M
SuspendProcesses:
- HealthCheck
- ReplaceUnhealthy
- AZRebalance
- AlarmNotification
- ScheduledActions
WaitOnResourceSignals: true
SimpleApiTargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
VpcId: !Ref VPC
Port: 3000
Protocol: HTTP
Matcher:
HttpCode: 200-299
HealthCheckIntervalSeconds: 10
HealthCheckPath: /healthcheck
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 5
HealthyThresholdCount: 2
SimpleApiListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref LoadBalancerListener
Priority: 2
Conditions:
- Field: path-pattern
Values:
- /echo
Actions:
- TargetGroupArn: !Ref SimpleApiTargetGroup
Type: forward
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment