-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.rb
38 lines (32 loc) · 1.02 KB
/
worker.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
CloudFormation {
# Template metadata
AWSTemplateFormatVersion '2010-09-09'
# Parameters
Parameter("EnvironmentName"){ Type 'String' }
LaunchConfiguration("LaunchConfig") {
ImageId 'ami-48d38c2b'
InstanceType 't2.micro'
}
Resource("ElasticLoadBalancer") {
Type 'AWS::ElasticLoadBalancing::LoadBalancer'
Property('Listeners', [ { 'LoadBalancerPort' => '80', 'InstancePort' => '80', 'Protocol' => 'HTTP' } ] )
Property('LoadBalancerName',FnJoin('', [ Ref('EnvironmentName'), '-worker' ]))
Property('AvailabilityZones', [
FnSelect('0',FnGetAZs(Ref('AWS::Region'))),
FnSelect('1',FnGetAZs(Ref('AWS::Region')))
])
}
AutoScalingGroup("AutoScaleGroup") {
AvailabilityZones [
FnSelect('0',FnGetAZs(Ref('AWS::Region'))),
FnSelect('1',FnGetAZs(Ref('AWS::Region')))
]
LaunchConfigurationName Ref('LaunchConfig')
LoadBalancerNames [ Ref('ElasticLoadBalancer') ]
MinSize "1"
MaxSize "1"
}
Output("AutoScaleGroup") {
Value(Ref('AutoScaleGroup'))
}
}