capistrano-elb-autoscaling 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +26 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.md +97 -0
  7. data/Rakefile +5 -0
  8. data/elbas.gemspec +31 -0
  9. data/lib/elbas/aws/ami.rb +71 -0
  10. data/lib/elbas/aws/autoscale_group.rb +52 -0
  11. data/lib/elbas/aws/base.rb +39 -0
  12. data/lib/elbas/aws/instance.rb +29 -0
  13. data/lib/elbas/aws/instance_collection.rb +35 -0
  14. data/lib/elbas/aws/launch_template.rb +39 -0
  15. data/lib/elbas/aws/snapshot.rb +21 -0
  16. data/lib/elbas/aws/taggable.rb +18 -0
  17. data/lib/elbas/capistrano.rb +34 -0
  18. data/lib/elbas/errors/no_launch_template.rb +6 -0
  19. data/lib/elbas/logger.rb +38 -0
  20. data/lib/elbas/retryable.rb +41 -0
  21. data/lib/elbas/tasks/elbas.rake +38 -0
  22. data/lib/elbas/version.rb +3 -0
  23. data/lib/elbas.rb +21 -0
  24. data/spec/aws/ami_spec.rb +140 -0
  25. data/spec/aws/autoscale_group_spec.rb +67 -0
  26. data/spec/aws/instance_collection_spec.rb +38 -0
  27. data/spec/aws/instance_spec.rb +30 -0
  28. data/spec/aws/launch_template_spec.rb +52 -0
  29. data/spec/aws/taggable_spec.rb +53 -0
  30. data/spec/capistrano_spec.rb +77 -0
  31. data/spec/spec_helper.rb +27 -0
  32. data/spec/support/stubs/CreateImage.200.xml +4 -0
  33. data/spec/support/stubs/CreateLaunchConfiguration.200.xml +5 -0
  34. data/spec/support/stubs/CreateLaunchTemplateVersion.200.xml +16 -0
  35. data/spec/support/stubs/CreateTags.200.xml +5 -0
  36. data/spec/support/stubs/DeleteLaunchConfiguration.200.xml +5 -0
  37. data/spec/support/stubs/DeleteSnapshot.200.xml +4 -0
  38. data/spec/support/stubs/DeregisterImage.200.xml +4 -0
  39. data/spec/support/stubs/DescribeAutoScalingGroups.200.xml +60 -0
  40. data/spec/support/stubs/DescribeImages.200.xml +70 -0
  41. data/spec/support/stubs/DescribeInstances.200.xml +231 -0
  42. data/spec/support/stubs/DescribeInstances_Empty.200.xml +17 -0
  43. data/spec/support/stubs/DescribeInstances_MultipleReservations.200.xml +243 -0
  44. data/spec/support/stubs/DescribeInstances_MultipleRunning.200.xml +338 -0
  45. data/spec/support/stubs/DescribeLaunchConfigurations.200.xml +29 -0
  46. data/spec/support/stubs/DescribeSnapshots.200.xml +18 -0
  47. data/spec/support/stubs/DescribeTags.200.xml +17 -0
  48. data/spec/support/stubs/UpdateAutoScalingGroup.200.xml +5 -0
  49. data/spec/support/stubs/security-credentials.200.json +9 -0
  50. metadata +243 -0
data/lib/elbas.rb ADDED
@@ -0,0 +1,21 @@
1
+ require 'capistrano/all'
2
+ require 'aws-sdk-autoscaling'
3
+ require 'aws-sdk-ec2'
4
+
5
+ require 'elbas/version'
6
+ require 'elbas/logger'
7
+ require 'elbas/retryable'
8
+
9
+ require 'elbas/errors/no_launch_template'
10
+
11
+ require 'elbas/aws/base'
12
+ require 'elbas/aws/taggable'
13
+ require 'elbas/aws/instance_collection'
14
+ require 'elbas/aws/instance'
15
+ require 'elbas/aws/autoscale_group'
16
+ require 'elbas/aws/launch_template'
17
+ require 'elbas/aws/ami'
18
+ require 'elbas/aws/snapshot'
19
+
20
+ module Elbas
21
+ end
@@ -0,0 +1,140 @@
1
+ describe Elbas::AWS::AMI do
2
+ subject { Elbas::AWS::AMI.new 'test' }
3
+
4
+ describe '#initialize' do
5
+ it 'sets the id' do
6
+ expect(subject.id).to eq 'test'
7
+ end
8
+
9
+ it 'has an aws-sdk counterpart' do
10
+ expect(subject.aws_counterpart).to be_a_kind_of ::Aws::EC2::Image
11
+ expect(subject.aws_counterpart.id).to eq 'test'
12
+ end
13
+
14
+ context 'with snapshots' do
15
+ subject do
16
+ Elbas::AWS::AMI.new 'test', [
17
+ double(:bdm, ebs: double(:ebs, snapshot_id: 'snap-1'))
18
+ ]
19
+ end
20
+
21
+ it 'sets snapshots to Snapshot objects' do
22
+ expect(subject.snapshots.size).to eq 1
23
+ expect(subject.snapshots[0]).to be_a_kind_of Elbas::AWS::Snapshot
24
+ end
25
+
26
+ it 'sets the ID on the Snapshots' do
27
+ expect(subject.snapshots[0].id).to eq 'snap-1'
28
+ end
29
+ end
30
+ end
31
+
32
+ describe '#deploy_id' do
33
+ it 'returns the ELBAS-Deploy-id tag, if set' do
34
+ webmock :post, /ec2/ => 201, with: Hash[body: /Action=CreateTags/]
35
+ subject.tag 'ELBAS-Deploy-id', 'test'
36
+ expect(subject.deploy_id).to eq 'test'
37
+ end
38
+
39
+ it 'returns nil if the tag was never set' do
40
+ expect(subject.deploy_id).to be_nil
41
+ end
42
+ end
43
+
44
+ describe '#deploy_group' do
45
+ it 'returns the ELBAS-Deploy-group tag, if set' do
46
+ webmock :post, /ec2/ => 201, with: Hash[body: /Action=CreateTags/]
47
+ subject.tag 'ELBAS-Deploy-group', 'test'
48
+ expect(subject.deploy_group).to eq 'test'
49
+ end
50
+
51
+ it 'returns nil if the tag was never set' do
52
+ expect(subject.deploy_group).to be_nil
53
+ end
54
+ end
55
+
56
+ describe '#ancestors' do
57
+ before do
58
+ webmock :post, /ec2/ => 201, with: Hash[body: /Action=CreateTags/]
59
+ subject.tag 'ELBAS-Deploy-group', 'test'
60
+ subject.tag 'ELBAS-Deploy-id', 'test'
61
+
62
+ webmock :post, %r{ec2.(.*).amazonaws.com\/\z} => 'DescribeImages.200.xml',
63
+ with: Hash[body: /Action=DescribeImages/]
64
+ end
65
+
66
+ it 'includes AMIs from the same deploy group, different deploy ID' do
67
+ expect {
68
+ subject.tag 'ELBAS-Deploy-id', 'not-test'
69
+ }.to change {
70
+ subject.ancestors.size
71
+ }.by 1
72
+ end
73
+ end
74
+
75
+ describe '#delete' do
76
+ before do
77
+ webmock :post, /ec2/ => 201, with: Hash[body: /Action=DeregisterImage/]
78
+ end
79
+
80
+ it 'calls the deregister AMI API' do
81
+ subject.delete
82
+ expect(WebMock)
83
+ .to have_requested(:post, /ec2/)
84
+ .with body: /Action=DeregisterImage&ImageId=test/
85
+ end
86
+
87
+ context 'with snapshots' do
88
+ subject do
89
+ Elbas::AWS::AMI.new 'test', [
90
+ double(:bdm, ebs: double(:ebs, snapshot_id: 'snap-1'))
91
+ ]
92
+ end
93
+
94
+ it 'deletes the AMIs snapshots too' do
95
+ webmock :post, /ec2/ => 201, with: Hash[body: /Action=DeleteSnapshot/]
96
+
97
+ subject.delete
98
+ expect(WebMock)
99
+ .to have_requested(:post, /ec2/)
100
+ .with body: /Action=DeleteSnapshot&SnapshotId=snap-1/
101
+ end
102
+ end
103
+ end
104
+
105
+ describe '.create' do
106
+ subject { described_class }
107
+ let(:instance) { Elbas::AWS::Instance.new 'i-1234567890', nil, nil }
108
+
109
+ before do
110
+ webmock :post, %r{ec2.(.*).amazonaws.com\/\z} => 'CreateImage.200.xml',
111
+ with: Hash[body: /Action=CreateImage/]
112
+ end
113
+
114
+ it 'calls the API with the instance given' do
115
+ subject.create instance
116
+ expect(WebMock)
117
+ .to have_requested(:post, /ec2/)
118
+ .with body: /Action=CreateImage&InstanceId=i-1234567890&Name=ELBAS-ami-(\d+)/
119
+ end
120
+
121
+ it 'uses the no_reboot option by default' do
122
+ subject.create instance
123
+ expect(WebMock)
124
+ .to have_requested(:post, /ec2/)
125
+ .with(body: /NoReboot=true/)
126
+ end
127
+
128
+ it 'uses no_reboot as false, if given' do
129
+ subject.create instance, no_reboot: false
130
+ expect(WebMock)
131
+ .to have_requested(:post, /ec2/)
132
+ .with(body: /NoReboot=false/)
133
+ end
134
+
135
+ it 'returns the an AMI object with the new id' do
136
+ ami = subject.create instance
137
+ expect(ami.id).to eq 'ami-4fa54026' # from stub
138
+ end
139
+ end
140
+ end
@@ -0,0 +1,67 @@
1
+ describe Elbas::AWS::AutoscaleGroup do
2
+ subject { Elbas::AWS::AutoscaleGroup.new 'test-asg' }
3
+
4
+ before do
5
+ webmock :post, %r{autoscaling.(.*).amazonaws.com\/\z} => 'DescribeAutoScalingGroups.200.xml',
6
+ with: Hash[body: /Action=DescribeAutoScalingGroups/]
7
+
8
+ webmock :post, %r{ec2.(.*).amazonaws.com\/\z} => 'DescribeInstances.200.xml',
9
+ with: Hash[body: /Action=DescribeInstances/]
10
+ end
11
+
12
+ describe '#initialize' do
13
+ it 'sets the name' do
14
+ expect(subject.name).to eq 'test-asg'
15
+ end
16
+
17
+ it 'has an aws-sdk counterpart' do
18
+ expect(subject.aws_counterpart).to be_a_kind_of ::Aws::AutoScaling::Types::AutoScalingGroup
19
+ expect(subject.aws_counterpart.auto_scaling_group_name).to eq 'test-asg'
20
+ end
21
+ end
22
+
23
+ describe '#instance_ids' do
24
+ it 'returns every instance ID in the ASG' do
25
+ expect(subject.instance_ids).to eq ['i-1234567890', 'i-500']
26
+ end
27
+ end
28
+
29
+ describe '#instances' do
30
+ it 'returns an instance collection with all instances' do
31
+ instances = subject.instances
32
+ expect(instances.count).to eq 2
33
+ end
34
+ end
35
+
36
+ describe '#launch_template' do
37
+ it 'throws an error if there is no launch template' do
38
+ expect { subject.launch_template }.to raise_error(Elbas::Errors::NoLaunchTemplate)
39
+ end
40
+
41
+ it 'returns a LaunchTemplate object with the id/name/version set' do
42
+ allow(subject.aws_counterpart).to receive(:launch_template) do
43
+ double(:lt, launch_template_id: 'test-1', launch_template_name: 'Test', version: '$Latest')
44
+ end
45
+
46
+ expect(subject.launch_template.id).to eq 'test-1'
47
+ expect(subject.launch_template.name).to eq 'Test'
48
+ expect(subject.launch_template.version).to eq '$Latest'
49
+ end
50
+
51
+ it 'returns a LauchTemplate object for fleet composition' do
52
+ allow(subject.aws_counterpart).to receive(:launch_template) { nil }
53
+ allow(subject.aws_counterpart).to receive_message_chain(
54
+ :mixed_instances_policy, :launch_template,
55
+ :launch_template_specification) do
56
+ double(launch_template_id: 'test-2',
57
+ launch_template_name: 'mixed_instance',
58
+ version: '$Latest')
59
+ end
60
+
61
+ expect(subject.launch_template.id).to eq 'test-2'
62
+ expect(subject.launch_template.name).to eq 'mixed_instance'
63
+ expect(subject.launch_template.version).to eq '$Latest'
64
+ end
65
+
66
+ end
67
+ end
@@ -0,0 +1,38 @@
1
+ describe Elbas::AWS::InstanceCollection do
2
+ subject { Elbas::AWS::InstanceCollection.new ['i-1234567890', 'i-500'] }
3
+
4
+ scenarios = [
5
+ { context: 'Single AWS reservation', mock_response_file: 'DescribeInstances.200.xml' },
6
+ { context: 'Multiple AWS reservation', mock_response_file: 'DescribeInstances_MultipleReservations.200.xml' }
7
+ ]
8
+
9
+ scenarios.each do |scenario|
10
+ context scenario[:context] do
11
+ before do
12
+ webmock :post, %r{ec2.(.*).amazonaws.com\/\z} => scenario[:mock_response_file],
13
+ with: Hash[body: /Action=DescribeInstances/]
14
+ end
15
+
16
+ describe '#instances' do
17
+ it 'returns Instance objects with name/hostname/state' do
18
+ expect(subject.instances[0].id).to eq 'i-1234567890'
19
+ expect(subject.instances[0].hostname).to eq 'ec2-1234567890.amazonaws.com'
20
+ expect(subject.instances[0].state).to eq 16
21
+
22
+ expect(subject.instances[1].id).to eq 'i-500'
23
+ expect(subject.instances[1].hostname).to eq 'ec2-500.amazonaws.com'
24
+ expect(subject.instances[1].state).to eq 32
25
+ end
26
+ end
27
+
28
+ describe '#running' do
29
+ it 'returns only running instances' do
30
+ expect(subject.instances.size).to eq 2
31
+ expect(subject.running.size).to eq 1
32
+ expect(subject.running[0].id).to eq 'i-1234567890'
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ end
@@ -0,0 +1,30 @@
1
+ describe Elbas::AWS::Instance do
2
+ subject { Elbas::AWS::Instance.new 'i-1234567890', 'ec2-1234567890.amazonaws.com', 16 }
3
+
4
+ describe '#initialize' do
5
+ it 'sets the AWS counterpart' do
6
+ expect(subject.aws_counterpart).to be_a_kind_of ::Aws::EC2::Instance
7
+ expect(subject.aws_counterpart.id).to eq 'i-1234567890'
8
+ end
9
+ end
10
+
11
+ describe '#hostname' do
12
+ it 'returns the public DNS' do
13
+ expect(subject.hostname).to eq 'ec2-1234567890.amazonaws.com'
14
+ end
15
+ end
16
+
17
+ describe '#running?' do
18
+ it 'returns true if the state code is 16 ("running")' do
19
+ expect(subject).to receive(:state) { 16 }
20
+ expect(subject).to be_running
21
+ end
22
+
23
+ it 'returns false for every other state code' do
24
+ [0, 32, 48, 64, 80].each do |code|
25
+ expect(subject).to receive(:state) { code }
26
+ expect(subject).to_not be_running
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,52 @@
1
+ describe Elbas::AWS::LaunchTemplate do
2
+ subject { Elbas::AWS::LaunchTemplate.new 'test-lt', 'test', '1' }
3
+
4
+ before do
5
+ webmock :post, %r{ec2.(.*).amazonaws.com\/\z} => 'CreateLaunchTemplateVersion.200.xml',
6
+ with: Hash[body: /Action=CreateLaunchTemplateVersion/]
7
+ end
8
+
9
+ describe '#initialize' do
10
+ it 'sets the id' do
11
+ expect(subject.id).to eq 'test-lt'
12
+ end
13
+
14
+ it 'sets the name' do
15
+ expect(subject.name).to eq 'test'
16
+ end
17
+
18
+ it 'sets the version' do
19
+ expect(subject.version).to eq '1'
20
+ end
21
+ end
22
+
23
+ describe '#update' do
24
+ it 'hits the CreateLaunchTemplateVersion API' do
25
+ subject.update double(:ami, id: 'ami-123')
26
+ expect(WebMock)
27
+ .to have_requested(:post, /ec2/)
28
+ .with(body: %r{Action=CreateLaunchTemplateVersion})
29
+ end
30
+
31
+ it 'creates a new launch template from the given AMI' do
32
+ subject.update double(:ami, id: 'ami-123')
33
+ expect(WebMock)
34
+ .to have_requested(:post, /ec2/)
35
+ .with(body: %r{LaunchTemplateData.ImageId=ami-123})
36
+ end
37
+
38
+ it 'uses itself as the source' do
39
+ subject.update double(:ami, id: 'ami-123')
40
+ expect(WebMock)
41
+ .to have_requested(:post, /ec2/)
42
+ .with(body: %r{LaunchTemplateId=test-lt&SourceVersion=1})
43
+ end
44
+
45
+ it 'returns a new launch template' do
46
+ launch_template = subject.update double(:ami, id: 'ami-123')
47
+ expect(launch_template.id).to eq 'lt-1234567890'
48
+ expect(launch_template.name).to eq 'elbas-test'
49
+ expect(launch_template.version).to eq 123
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,53 @@
1
+ describe Elbas::AWS::Taggable do
2
+ TestTaggable = Class.new do
3
+ include Elbas::AWS::Taggable
4
+
5
+ def aws_counterpart
6
+ @aws_counterpart ||= ::Aws::EC2::Instance.new 'test'
7
+ end
8
+ end
9
+
10
+ let(:subject) { TestTaggable.new }
11
+
12
+
13
+
14
+ context 'Tagging fails because resource is not created yet' do
15
+ before do
16
+ stub_request(:post, %r{amazonaws.com\/\z}).
17
+ to_raise(StandardError).then.
18
+ to_raise(StandardError).then.
19
+ to_return(body: '')
20
+ end
21
+
22
+ describe '#tag' do
23
+ it 'retries the tag up to 3 times' do
24
+ expect(subject.aws_counterpart).to receive(:create_tags).exactly(3).times.and_call_original
25
+ subject.tag 'test', 'true'
26
+ end
27
+ end
28
+
29
+ end
30
+
31
+ context 'Tagging succeeds' do
32
+ before do
33
+ webmock :post, %r{amazonaws.com\/\z} => 'CreateTags.200.xml',
34
+ with: Hash[body: /Action=CreateTags/]
35
+ end
36
+
37
+ describe '#tag' do
38
+ it 'hits the CreateTags API' do
39
+ subject.tag 'test', 'true'
40
+ expect(WebMock)
41
+ .to have_requested(:post, /aws/)
42
+ .with body: /Action=CreateTags/
43
+ end
44
+
45
+ it 'sends the resource, key, and value' do
46
+ subject.tag 'test', 'true'
47
+ expect(WebMock)
48
+ .to have_requested(:post, /aws/)
49
+ .with body: /ResourceId.1=test&Tag.1.Key=test&Tag.1.Value=true/
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,77 @@
1
+ require 'elbas/capistrano'
2
+
3
+ describe '#autoscale' do
4
+ before do
5
+ Capistrano::Configuration.reset!
6
+ Rake::Task.define_task('deploy') {}
7
+
8
+ webmock :post, %r{autoscaling.(.*).amazonaws.com\/\z} => 'DescribeAutoScalingGroups.200.xml',
9
+ with: Hash[body: /Action=DescribeAutoScalingGroups/]
10
+ end
11
+
12
+ context 'one server' do
13
+ before do
14
+ webmock :post, %r{ec2.(.*).amazonaws.com\/\z} => 'DescribeInstances.200.xml',
15
+ with: Hash[body: /Action=DescribeInstances/]
16
+ end
17
+
18
+ it 'adds the server hostname' do
19
+ autoscale 'test-asg'
20
+ expect(env.servers.count).to eq 1
21
+ expect(env.servers.first.hostname).to eq 'ec2-1234567890.amazonaws.com'
22
+ end
23
+
24
+ it 'passes along the properties' do
25
+ autoscale 'test-asg', roles: [:db], primary: true
26
+ expect(env.servers.first.properties.roles).to match_array [:db]
27
+ expect(env.servers.first.properties.primary).to eq true
28
+ end
29
+ end
30
+
31
+ context 'multiple servers' do
32
+ before do
33
+ webmock :post, %r{ec2.(.*).amazonaws.com\/\z} => 'DescribeInstances_MultipleRunning.200.xml',
34
+ with: Hash[body: /Action=DescribeInstances/]
35
+ end
36
+
37
+ it 'adds multiple server hostnames' do
38
+ autoscale 'test-asg'
39
+ expect(env.servers.count).to eq 2
40
+ expect(env.servers.map(&:hostname)).to match_array ['ec2-1234567890.amazonaws.com', 'ec2-1122334455.amazonaws.com']
41
+ end
42
+
43
+ it 'passes along the properties' do
44
+ autoscale 'test-asg', roles: [:db], primary: true
45
+ count = 0
46
+ env.servers.each do |server|
47
+ count = count + 1
48
+ expect(server.properties.roles).to match_array [:db]
49
+ expect(server.properties.primary).to eq true
50
+ end
51
+ expect(count).to eq 2
52
+ end
53
+
54
+ it 'yields to find properties if a block is given' do
55
+ autoscale 'test-asg', roles: [:web] do |server, i|
56
+ { roles: [:web, :db], primary: true } if i == 0
57
+ end
58
+
59
+ expect(env.servers.to_a[0].properties.roles).to match_array [:web, :db]
60
+ expect(env.servers.to_a[0].properties.primary).to eq true
61
+
62
+ expect(env.servers.to_a[1].properties.roles).to match_array [:web]
63
+ expect(env.servers.to_a[1].properties.keys).to_not include :primary
64
+ end
65
+ end
66
+
67
+ context 'no servers' do
68
+ before do
69
+ webmock :post, %r{ec2.(.*).amazonaws.com\/\z} => 'DescribeInstances_Empty.200.xml',
70
+ with: Hash[body: /Action=DescribeInstances/]
71
+ end
72
+
73
+ it 'logs as an error' do
74
+ expect { autoscale 'test-asg' }.to output.to_stderr
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,27 @@
1
+ require 'webmock'
2
+ require 'capistrano/all'
3
+ require 'byebug'
4
+
5
+ ENV['AWS_REGION'] = 'us-east-1'
6
+ ENV['AWS_ACCESS_KEY_ID'] = 'test-access'
7
+ ENV['AWS_SECRET_ACCESS_KEY'] = 'test-secret'
8
+
9
+ require 'elbas'
10
+ require 'webmock/rspec'
11
+
12
+ # Hack for webmock-rspec-helper
13
+ Rails = Class.new do
14
+ def self.root
15
+ Pathname.new(__dir__).join('..')
16
+ end
17
+ end
18
+
19
+ require 'webmock-rspec-helper'
20
+
21
+ WebMock.disable_net_connect!
22
+
23
+ Dir[File.join(File.expand_path('../..', __FILE__), 'spec', 'support', '**', '*.rb')].each { |f| require f }
24
+
25
+ RSpec.configure do |c|
26
+ c.include Capistrano::DSL
27
+ end
@@ -0,0 +1,4 @@
1
+ <CreateImageResponse xmlns="http://ec2.amazonaws.com/doc/2014-10-01/">
2
+ <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
3
+ <imageId>ami-4fa54026</imageId>
4
+ </CreateImageResponse>
@@ -0,0 +1,5 @@
1
+ <CreateLaunchConfigurationResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
2
+ <ResponseMetadata>
3
+ <RequestId>7c6e177f-f082-11e1-ac58-3714bEXAMPLE</RequestId>
4
+ </ResponseMetadata>
5
+ </CreateLaunchConfigurationResponse>
@@ -0,0 +1,16 @@
1
+ <CreateLaunchTemplateVersionResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
2
+ <requestId>6657423a-2616-461a-9ce5-3c65example</requestId>
3
+ <launchTemplateVersion>
4
+ <createTime>2017-10-31T11:56:00.000Z</createTime>
5
+ <createdBy>arn:aws:iam::123456789012:root</createdBy>
6
+ <defaultVersion>false</defaultVersion>
7
+ <launchTemplateData>
8
+ <imageId>ami-aabbccdd</imageId>
9
+ <instanceType>t2.micro</instanceType>
10
+ </launchTemplateData>
11
+ <launchTemplateId>lt-1234567890</launchTemplateId>
12
+ <launchTemplateName>elbas-test</launchTemplateName>
13
+ <versionDescription>VersionWithNewAMI</versionDescription>
14
+ <versionNumber>123</versionNumber>
15
+ </launchTemplateVersion>
16
+ </CreateLaunchTemplateVersionResponse>
@@ -0,0 +1,5 @@
1
+ <CreateTagsResponse
2
+ xmlns="http://ec2.amazonaws.com/doc/2014-10-01/">
3
+ <requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId>
4
+ <return>true</return>
5
+ </CreateTagsResponse>
@@ -0,0 +1,5 @@
1
+ <DeleteLaunchConfigurationResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
2
+ <ResponseMetadata>
3
+ <RequestId>7347261f-97df-11e2-8756-35eEXAMPLE</RequestId>
4
+ </ResponseMetadata>
5
+ </DeleteLaunchConfigurationResponse>
@@ -0,0 +1,4 @@
1
+ <DeleteSnapshotResponse xmlns="http://ec2.amazonaws.com/doc/2016-09-15/">
2
+ <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
3
+ <return>true</return>
4
+ </DeleteSnapshotResponse>
@@ -0,0 +1,4 @@
1
+ <DeregisterImageResponse xmlns="http://ec2.amazonaws.com/doc/2014-10-01/">
2
+ <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
3
+ <return>true</return>
4
+ </DeregisterImageResponse>
@@ -0,0 +1,60 @@
1
+ <DescribeAutoScalingGroupsResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
2
+ <DescribeAutoScalingGroupsResult>
3
+ <AutoScalingGroups>
4
+ <member>
5
+ <HealthCheckType>ELB</HealthCheckType>
6
+ <LoadBalancerNames>
7
+ <member>my-loadbalancer</member>
8
+ </LoadBalancerNames>
9
+ <Instances>
10
+ <member>
11
+ <LaunchConfigurationName>my-lc</LaunchConfigurationName>
12
+ <LifecycleState>InService</LifecycleState>
13
+ <InstanceId>i-1234567890</InstanceId>
14
+ <ProtectedFromScaleIn>false</ProtectedFromScaleIn>
15
+ <AvailabilityZone>us-east-1c</AvailabilityZone>
16
+ </member>
17
+ <member>
18
+ <LaunchConfigurationName>my-lc</LaunchConfigurationName>
19
+ <LifecycleState>Terminating</LifecycleState>
20
+ <InstanceId>i-500</InstanceId>
21
+ <ProtectedFromScaleIn>false</ProtectedFromScaleIn>
22
+ <AvailabilityZone>us-east-1c</AvailabilityZone>
23
+ </member>
24
+ </Instances>
25
+ <TerminationPolicies>
26
+ <member>Default</member>
27
+ </TerminationPolicies>
28
+ <DefaultCooldown>300</DefaultCooldown>
29
+ <AutoScalingGroupARN>arn:aws:autoscaling:us-east-1:123456789012:autoScalingGroup:12345678-1234-1234-1234-123456789012:autoScalingGroupName/test-asg</AutoScalingGroupARN>
30
+ <EnabledMetrics />
31
+ <AvailabilityZones>
32
+ <member>us-east-1b</member>
33
+ <member>us-east-1a</member>
34
+ </AvailabilityZones>
35
+ <Tags>
36
+ <member>
37
+ <ResourceId>test-asg</ResourceId>
38
+ <PropagateAtLaunch>true</PropagateAtLaunch>
39
+ <Value>test</Value>
40
+ <Key>environment</Key>
41
+ <ResourceType>auto-scaling-group</ResourceType>
42
+ </member>
43
+ </Tags>
44
+ <LaunchConfigurationName>my-lc</LaunchConfigurationName>
45
+ <AutoScalingGroupName>test-asg</AutoScalingGroupName>
46
+ <HealthCheckGracePeriod>300</HealthCheckGracePeriod>
47
+ <NewInstancesProtectedFromScaleIn>false</NewInstancesProtectedFromScaleIn>
48
+ <SuspendedProcesses />
49
+ <CreatedTime>2015-05-06T17:47:15.107Z</CreatedTime>
50
+ <MinSize>2</MinSize>
51
+ <MaxSize>10</MaxSize>
52
+ <DesiredCapacity>2</DesiredCapacity>
53
+ <VPCZoneIdentifier>subnet-12345678,subnet-98765432</VPCZoneIdentifier>
54
+ </member>
55
+ </AutoScalingGroups>
56
+ </DescribeAutoScalingGroupsResult>
57
+ <ResponseMetadata>
58
+ <RequestId>7c6e177f-f082-11e1-ac58-3714bEXAMPLE</RequestId>
59
+ </ResponseMetadata>
60
+ </DescribeAutoScalingGroupsResponse>