ec2ssh 3.1.0.rc1 → 5.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.
- checksums.yaml +5 -5
- data/.travis.yml +9 -3
- data/ChangeLog.md +23 -0
- data/Gemfile +6 -2
- data/README.md +27 -24
- data/Rakefile +3 -0
- data/bash/ec2ssh.bash +4 -11
- data/ec2ssh.gemspec +6 -5
- data/example/example.ec2ssh +2 -2
- data/fixtures/vcr_cassettes/ec2-instances.yml +178 -0
- data/lib/ec2ssh/builder.rb +12 -2
- data/lib/ec2ssh/cli.rb +4 -23
- data/lib/ec2ssh/command.rb +1 -1
- data/lib/ec2ssh/command/init.rb +3 -9
- data/lib/ec2ssh/command/update.rb +0 -5
- data/lib/ec2ssh/dsl.rb +15 -0
- data/lib/ec2ssh/ec2_instances.rb +70 -16
- data/lib/ec2ssh/version.rb +1 -1
- data/spec/aws_sdk_compatibility_spec.rb +92 -0
- data/spec/lib/ec2ssh/builder_spec.rb +16 -14
- data/spec/lib/ec2ssh/command/remove_spec.rb +5 -4
- data/spec/lib/ec2ssh/command/update_spec.rb +14 -10
- data/spec/lib/ec2ssh/dsl_spec.rb +44 -11
- data/spec/lib/ec2ssh/ec2_instances_spec.rb +26 -8
- data/spec/lib/ec2ssh/ssh_config_spec.rb +2 -0
- data/spec/spec_helper.rb +5 -1
- data/zsh/_ec2ssh +8 -50
- metadata +44 -21
- data/lib/ec2ssh/command/migrate.rb +0 -34
- data/lib/ec2ssh/migrator.rb +0 -77
- data/spec/lib/ec2ssh/command/migrate_spec.rb +0 -111
- data/spec/lib/ec2ssh/migrator_spec.rb +0 -62
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 392df01c5d38c8c1dc5589258e885cd348646467303abc15cf346101e4a9d441
|
4
|
+
data.tar.gz: b9eb640b664ef6701e50754ff4cf3b3082c66d3132b94350f8a4eb398b764ace
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 331921d24eace17e5ebdfc94aec1c231e7ebd4e7b9fe1619b7e1c28b8f2fd288109530ea3a54eb3d830141d04f35ef43c777d9d4c2071080aaf745bac3b93dcf
|
7
|
+
data.tar.gz: 224f8d90beb435c656c0d50ae1edff0684ace90f4aa9d7a75c1c62f75bfc3aedee1a590deecb5d93f07d42d4c401775c9a892eee86643b169a13493b5473d46e
|
data/.travis.yml
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
- 2.
|
3
|
+
- 2.4
|
4
|
+
- 2.5
|
5
|
+
- 2.6
|
6
|
+
- 2.7
|
7
|
+
- ruby-head
|
6
8
|
script: 'bundle exec rspec spec'
|
9
|
+
before_install: gem install bundler -v 1.14.3
|
10
|
+
notifications:
|
11
|
+
slack:
|
12
|
+
secure: CYxJDs0jJkrgXfbOyHuF+gJtxgK5JjS0GAFRNOlkWlDUmpEErtcnPuBOrlzkIBJS4eXaDOuSvpyRJSuJZJjEhmp94GEI98GEcyvByHuaehUWhzhUrhXstX/gg/Ntt6jiFR5dC6NrRWAnmKb7cDsfvagGAVNAuNzAtX0Z9iXWQDo=
|
data/ChangeLog.md
CHANGED
@@ -1,6 +1,29 @@
|
|
1
1
|
# Change Log
|
2
|
+
|
3
|
+
## 5.0.0
|
4
|
+
* Remove `--aws-key` option and add `--path` option in shellcomp (#56)
|
5
|
+
* Use aws-sdk v3 and stop using v2 (#54)
|
6
|
+
* Delete `rubyforge_project=` in gemspec (#51)
|
7
|
+
* Relax thor and highline versions (#49)
|
8
|
+
* CI against Ruby 2.5, 2.6 and 2.7 (#45, #55)
|
9
|
+
* Drop support outdated Ruby 2.2 and 2.3 (#59)
|
10
|
+
|
11
|
+
## 4.0.0
|
12
|
+
* Use aws-sdk v2 and stop using v1 (#44)
|
13
|
+
* Support AssumeRole with `~/.aws/credentials` (#44)
|
14
|
+
* `aws_keys` requires region (#44)
|
15
|
+
Thanks to @yujideveloper
|
16
|
+
* Support `filters` for listing ec2 instances (#43)
|
17
|
+
Thanks to @satotakumi
|
18
|
+
|
19
|
+
## 3.1.1
|
20
|
+
* Fix a bug in `--verbose` option (#41)
|
21
|
+
Thanks to @adamlazz
|
22
|
+
|
2
23
|
## 3.1.0
|
3
24
|
* Use credentials from `~/.aws/credentials` as default. Credential profiles are set as `profiles` in dotfile.
|
25
|
+
* Revive path option for changing ssh config path (#34)
|
26
|
+
Thanks to @cynipe
|
4
27
|
|
5
28
|
## 3.0.3
|
6
29
|
* Use "%-" for ERB's trim\_mode at `host\_line` in dotfile (#29)
|
data/Gemfile
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
gemspec
|
3
3
|
|
4
|
+
gem 'rake', '>= 12.0.0'
|
4
5
|
gem 'rspec', '~> 3.0'
|
5
6
|
gem 'rspec-its', '~> 1.0'
|
6
7
|
gem 'guard-rspec', '~> 4.3'
|
7
8
|
gem 'webmock', '~> 1.9'
|
8
|
-
gem 'rb-fsevent', '~> 0.
|
9
|
+
gem 'rb-fsevent', '~> 0.10'
|
9
10
|
gem 'timecop', '~> 0.5'
|
10
|
-
gem 'fakefs', require: 'fakefs/safe'
|
11
|
+
gem 'fakefs', '~> 1.2', require: 'fakefs/safe'
|
12
|
+
gem 'vcr', '~> 3.0'
|
13
|
+
|
14
|
+
gem 'rexml' if RUBY_VERSION >= '2.8.0'
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
[](https://badge.fury.io/rb/ec2ssh)
|
2
|
+
[](https://travis-ci.org/mirakui/ec2ssh)
|
2
3
|
|
3
4
|
# Introduction
|
4
5
|
ec2ssh is a ssh_config manager for Amazon EC2.
|
@@ -41,17 +42,22 @@ $ ec2ssh init
|
|
41
42
|
```
|
42
43
|
$ vi ~/.ec2ssh
|
43
44
|
---
|
44
|
-
profiles 'default', 'myprofile'
|
45
|
-
regions 'us-east-1'
|
45
|
+
profiles 'default', 'myprofile', ...
|
46
|
+
regions 'us-east-1', 'ap-northeast-1', ...
|
46
47
|
|
47
48
|
# Ignore unnamed instances
|
48
|
-
reject {|instance| !instance.
|
49
|
+
reject {|instance| !instance.tag('Name') }
|
49
50
|
|
50
|
-
# You can
|
51
|
-
|
51
|
+
# You can specify filters on DescribeInstances (default: lists 'running' instances only)
|
52
|
+
filters([
|
53
|
+
{ name: 'instance-state-name', values: ['running', 'stopped'] }
|
54
|
+
])
|
55
|
+
|
56
|
+
# You can use methods of AWS::EC2::Instance and tag(key) method.
|
57
|
+
# See https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/EC2/Instance.html
|
52
58
|
host_line <<END
|
53
|
-
Host <%=
|
54
|
-
HostName <%=
|
59
|
+
Host <%= tag('Name') %>.<%= placement.availability_zone %>
|
60
|
+
HostName <%= public_dns_name || private_ip_address %>
|
55
61
|
END
|
56
62
|
```
|
57
63
|
|
@@ -115,26 +121,23 @@ Host db-server-1.ap-southeast-1
|
|
115
121
|
|
116
122
|
`ec2ssh remove` command removes the mark lines.
|
117
123
|
|
118
|
-
# How to upgrade from
|
119
|
-
|
120
|
-
So you need execute `ec2ssh init` once to create `~/.ec2ssh`, and edit it as you like.
|
121
|
-
|
122
|
-
```
|
123
|
-
$ ec2ssh init
|
124
|
-
$ vi ~/.ec2ssh
|
125
|
-
```
|
126
|
-
|
127
|
-
# How to upgrade from 2.x to 3.x
|
128
|
-
Dotfile (`.ec2ssh`) format has been changed from YAML to Ruby DSL.
|
124
|
+
# How to upgrade from 3.x
|
125
|
+
Dotfile (`.ec2ssh`) format has been changed from 3.x.
|
129
126
|
|
130
|
-
|
127
|
+
* A instance tag access I/F has been changed from `tags['Name']` to `tag('Name')`
|
128
|
+
* `Aws::EC2::Instance` methods have been changed to AWS SDK v3
|
129
|
+
* The `aws_keys` structure has been changed
|
130
|
+
* `aws_keys[profile_name][region] # => Aws::Credentials`
|
131
|
+
* For example:
|
131
132
|
|
132
133
|
```
|
133
|
-
|
134
|
+
aws_keys(
|
135
|
+
my_prof1: {
|
136
|
+
'ap-northeast-1' => Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'])
|
137
|
+
}
|
138
|
+
)
|
134
139
|
```
|
135
140
|
|
136
|
-
This command converts your existing `.ec2ssh` file into 3.x style.
|
137
|
-
|
138
141
|
# Notice
|
139
142
|
`ec2ssh` command updates your `.ssh/config` file default. You should make a backup of it.
|
140
143
|
|
@@ -142,4 +145,4 @@ This command converts your existing `.ec2ssh` file into 3.x style.
|
|
142
145
|
Use `zsh/_ec2ssh`.
|
143
146
|
|
144
147
|
# License
|
145
|
-
Copyright (c)
|
148
|
+
Copyright (c) 2020 Issei Naruta. ec2ssh is released under the MIT license.
|
data/Rakefile
CHANGED
data/bash/ec2ssh.bash
CHANGED
@@ -6,8 +6,8 @@ _ec2ssh() {
|
|
6
6
|
cur=$2
|
7
7
|
prev=$3
|
8
8
|
|
9
|
-
subcmds="help init
|
10
|
-
common_opts="--dotfile --verbose"
|
9
|
+
subcmds="help init remove update version"
|
10
|
+
common_opts="--path --dotfile --verbose"
|
11
11
|
|
12
12
|
# contextual completion
|
13
13
|
case $prev in
|
@@ -21,11 +21,7 @@ _ec2ssh() {
|
|
21
21
|
esac
|
22
22
|
return 0
|
23
23
|
;;
|
24
|
-
--
|
25
|
-
COMPREPLY=()
|
26
|
-
return 0;
|
27
|
-
;;
|
28
|
-
--dotfile)
|
24
|
+
--path | --dotfile)
|
29
25
|
COMPREPLY=( $(compgen -o default -- "$cur"))
|
30
26
|
return 0;
|
31
27
|
;;
|
@@ -35,9 +31,6 @@ _ec2ssh() {
|
|
35
31
|
subcmd=${COMP_WORDS[1]}
|
36
32
|
|
37
33
|
case $subcmd in
|
38
|
-
update)
|
39
|
-
COMPREPLY=( $(compgen -W "--aws-key $common_opts" -- "$cur") )
|
40
|
-
;;
|
41
34
|
help)
|
42
35
|
COMPREPLY=( $(compgen -W "$subcmds" $cur) )
|
43
36
|
;;
|
@@ -50,4 +43,4 @@ _ec2ssh() {
|
|
50
43
|
|
51
44
|
}
|
52
45
|
|
53
|
-
complete -F _ec2ssh ec2ssh
|
46
|
+
complete -F _ec2ssh ec2ssh
|
data/ec2ssh.gemspec
CHANGED
@@ -9,14 +9,15 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.authors = ["Issei Naruta"]
|
10
10
|
s.email = ["mimitako@gmail.com"]
|
11
11
|
s.homepage = "http://github.com/mirakui/ec2ssh"
|
12
|
+
s.license = "MIT"
|
12
13
|
s.summary = %q{A ssh_config manager for AWS EC2}
|
13
14
|
s.description = %q{ec2ssh is a ssh_config manager for AWS EC2}
|
14
|
-
s.required_ruby_version = ">= 2.
|
15
|
+
s.required_ruby_version = ">= 2.4.0"
|
15
16
|
|
16
|
-
s.
|
17
|
-
s.add_dependency "
|
18
|
-
s.add_dependency "
|
19
|
-
s.add_dependency
|
17
|
+
s.add_dependency "thor", ">= 0.14", "< 2.0"
|
18
|
+
s.add_dependency "highline", ">= 1.6", "< 3.0"
|
19
|
+
s.add_dependency "aws-sdk-core", "~> 3"
|
20
|
+
s.add_dependency "aws-sdk-ec2", "~> 1"
|
20
21
|
|
21
22
|
s.files = `git ls-files`.split("\n")
|
22
23
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/example/example.ec2ssh
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
path "#{ENV['HOME']}/.ssh/config"
|
2
2
|
profiles 'default', 'myprofile'
|
3
3
|
regions 'ap-northeast-1', 'us-east-1'
|
4
|
-
reject {|instance| instance.
|
4
|
+
reject {|instance| instance.tag('Name') =~ /.../ }
|
5
5
|
|
6
6
|
host_line <<END
|
7
|
-
Host <%=
|
7
|
+
Host <%= tag('Name') %>
|
8
8
|
HostName <%= private_ip_address %>
|
9
9
|
END
|
@@ -0,0 +1,178 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://ec2.us-west-1.amazonaws.com/
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: Action=DescribeInstances&Filter.1.Name=instance-state-name&Filter.1.Value.1=running&Timestamp=2017-02-11T09%3A25%3A44Z&Version=2014-10-01
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-www-form-urlencoded; charset=utf-8
|
12
|
+
Accept-Encoding:
|
13
|
+
- ''
|
14
|
+
Content-Length:
|
15
|
+
- '137'
|
16
|
+
User-Agent:
|
17
|
+
- aws-sdk-ruby/1.66.0 ruby/2.3.3 x86_64-darwin15 memoizing
|
18
|
+
Host:
|
19
|
+
- ec2.us-west-1.amazonaws.com
|
20
|
+
X-Amz-Date:
|
21
|
+
- 20170211T092544Z
|
22
|
+
X-Amz-Content-Sha256:
|
23
|
+
- b522eeb0f435881e058aaba87cf05aad80856e36205835b070f61e3a2cea2f66
|
24
|
+
Accept:
|
25
|
+
- "*/*"
|
26
|
+
response:
|
27
|
+
status:
|
28
|
+
code: 200
|
29
|
+
message: OK
|
30
|
+
headers:
|
31
|
+
Content-Type:
|
32
|
+
- text/xml;charset=UTF-8
|
33
|
+
Transfer-Encoding:
|
34
|
+
- chunked
|
35
|
+
Vary:
|
36
|
+
- Accept-Encoding
|
37
|
+
Date:
|
38
|
+
- Sat, 11 Feb 2017 09:25:44 GMT
|
39
|
+
Server:
|
40
|
+
- AmazonEC2
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: |-
|
44
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
45
|
+
<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2014-10-01/">
|
46
|
+
<requestId>9b40910f-51b7-44e2-b75b-96078a730000</requestId>
|
47
|
+
<reservationSet>
|
48
|
+
<item>
|
49
|
+
<reservationId>r-058c6185fab780000</reservationId>
|
50
|
+
<ownerId>000000000000</ownerId>
|
51
|
+
<groupSet/>
|
52
|
+
<instancesSet>
|
53
|
+
<item>
|
54
|
+
<instanceId>i-09e547eca106b0000</instanceId>
|
55
|
+
<imageId>ami-165a0000</imageId>
|
56
|
+
<instanceState>
|
57
|
+
<code>16</code>
|
58
|
+
<name>running</name>
|
59
|
+
</instanceState>
|
60
|
+
<privateDnsName>ip-172-31-9-193.us-west-1.compute.internal</privateDnsName>
|
61
|
+
<dnsName>ec2-54-215-142-250.us-west-1.compute.amazonaws.com</dnsName>
|
62
|
+
<reason/>
|
63
|
+
<keyName>aws.pem</keyName>
|
64
|
+
<amiLaunchIndex>0</amiLaunchIndex>
|
65
|
+
<productCodes/>
|
66
|
+
<instanceType>t2.micro</instanceType>
|
67
|
+
<launchTime>2017-02-11T09:22:47.000Z</launchTime>
|
68
|
+
<placement>
|
69
|
+
<availabilityZone>us-west-1c</availabilityZone>
|
70
|
+
<groupName/>
|
71
|
+
<tenancy>default</tenancy>
|
72
|
+
</placement>
|
73
|
+
<monitoring>
|
74
|
+
<state>disabled</state>
|
75
|
+
</monitoring>
|
76
|
+
<subnetId>subnet-b02b0000</subnetId>
|
77
|
+
<vpcId>vpc-f8790000</vpcId>
|
78
|
+
<privateIpAddress>172.31.9.193</privateIpAddress>
|
79
|
+
<ipAddress>54.215.142.250</ipAddress>
|
80
|
+
<sourceDestCheck>true</sourceDestCheck>
|
81
|
+
<groupSet>
|
82
|
+
<item>
|
83
|
+
<groupId>sg-a83f0000</groupId>
|
84
|
+
<groupName>default</groupName>
|
85
|
+
</item>
|
86
|
+
<item>
|
87
|
+
<groupId>sg-4db20000</groupId>
|
88
|
+
<groupName>ssh</groupName>
|
89
|
+
</item>
|
90
|
+
</groupSet>
|
91
|
+
<architecture>x86_64</architecture>
|
92
|
+
<rootDeviceType>ebs</rootDeviceType>
|
93
|
+
<rootDeviceName>/dev/xvda</rootDeviceName>
|
94
|
+
<blockDeviceMapping>
|
95
|
+
<item>
|
96
|
+
<deviceName>/dev/xvda</deviceName>
|
97
|
+
<ebs>
|
98
|
+
<volumeId>vol-02a0f01045aadbf7f</volumeId>
|
99
|
+
<status>attached</status>
|
100
|
+
<attachTime>2017-02-11T09:22:48.000Z</attachTime>
|
101
|
+
<deleteOnTermination>true</deleteOnTermination>
|
102
|
+
</ebs>
|
103
|
+
</item>
|
104
|
+
</blockDeviceMapping>
|
105
|
+
<virtualizationType>hvm</virtualizationType>
|
106
|
+
<clientToken>XDpiz1486804967277</clientToken>
|
107
|
+
<tagSet>
|
108
|
+
<item>
|
109
|
+
<key>Role</key>
|
110
|
+
<value>ec2ssh-test</value>
|
111
|
+
</item>
|
112
|
+
<item>
|
113
|
+
<key>Name</key>
|
114
|
+
<value>ec2ssh-test-02</value>
|
115
|
+
</item>
|
116
|
+
</tagSet>
|
117
|
+
<hypervisor>xen</hypervisor>
|
118
|
+
<networkInterfaceSet>
|
119
|
+
<item>
|
120
|
+
<networkInterfaceId>eni-f79a7ff6</networkInterfaceId>
|
121
|
+
<subnetId>subnet-b02b2ef6</subnetId>
|
122
|
+
<vpcId>vpc-f879939d</vpcId>
|
123
|
+
<description/>
|
124
|
+
<ownerId>000000000000</ownerId>
|
125
|
+
<status>in-use</status>
|
126
|
+
<macAddress>06:05:50:b3:b3:d8</macAddress>
|
127
|
+
<privateIpAddress>172.31.9.193</privateIpAddress>
|
128
|
+
<privateDnsName>ip-172-31-9-193.us-west-1.compute.internal</privateDnsName>
|
129
|
+
<sourceDestCheck>true</sourceDestCheck>
|
130
|
+
<groupSet>
|
131
|
+
<item>
|
132
|
+
<groupId>sg-a83f0000</groupId>
|
133
|
+
<groupName>default</groupName>
|
134
|
+
</item>
|
135
|
+
<item>
|
136
|
+
<groupId>sg-4db20000</groupId>
|
137
|
+
<groupName>ssh</groupName>
|
138
|
+
</item>
|
139
|
+
</groupSet>
|
140
|
+
<attachment>
|
141
|
+
<attachmentId>eni-attach-e6ce6187</attachmentId>
|
142
|
+
<deviceIndex>0</deviceIndex>
|
143
|
+
<status>attached</status>
|
144
|
+
<attachTime>2017-02-11T09:22:47.000Z</attachTime>
|
145
|
+
<deleteOnTermination>true</deleteOnTermination>
|
146
|
+
</attachment>
|
147
|
+
<association>
|
148
|
+
<publicIp>54.215.142.250</publicIp>
|
149
|
+
<publicDnsName>ec2-54-215-142-250.us-west-1.compute.amazonaws.com</publicDnsName>
|
150
|
+
<ipOwnerId>amazon</ipOwnerId>
|
151
|
+
</association>
|
152
|
+
<privateIpAddressesSet>
|
153
|
+
<item>
|
154
|
+
<privateIpAddress>172.31.9.193</privateIpAddress>
|
155
|
+
<privateDnsName>ip-172-31-9-193.us-west-1.compute.internal</privateDnsName>
|
156
|
+
<primary>true</primary>
|
157
|
+
<association>
|
158
|
+
<publicIp>54.215.142.250</publicIp>
|
159
|
+
<publicDnsName>ec2-54-215-142-250.us-west-1.compute.amazonaws.com</publicDnsName>
|
160
|
+
<ipOwnerId>amazon</ipOwnerId>
|
161
|
+
</association>
|
162
|
+
</item>
|
163
|
+
</privateIpAddressesSet>
|
164
|
+
</item>
|
165
|
+
</networkInterfaceSet>
|
166
|
+
<iamInstanceProfile>
|
167
|
+
<arn>arn:aws:iam::000000000000:instance-profile/ec2ssh-test-role</arn>
|
168
|
+
<id>AIPAJF7H4IAXZXXXXXXXX</id>
|
169
|
+
</iamInstanceProfile>
|
170
|
+
<ebsOptimized>false</ebsOptimized>
|
171
|
+
</item>
|
172
|
+
</instancesSet>
|
173
|
+
</item>
|
174
|
+
</reservationSet>
|
175
|
+
</DescribeInstancesResponse>
|
176
|
+
http_version:
|
177
|
+
recorded_at: Sat, 11 Feb 2017 09:25:45 GMT
|
178
|
+
recorded_with: VCR 3.0.3
|
data/lib/ec2ssh/builder.rb
CHANGED
@@ -26,19 +26,29 @@ module Ec2ssh
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def ec2s
|
29
|
-
@ec2s ||= Ec2Instances.new aws_keys,
|
29
|
+
@ec2s ||= Ec2Instances.new aws_keys, filters
|
30
30
|
end
|
31
31
|
|
32
32
|
def aws_keys
|
33
33
|
@aws_keys ||= if @container.profiles
|
34
34
|
keys = {}
|
35
35
|
@container.profiles.each do |profile_name|
|
36
|
-
keys[profile_name] =
|
36
|
+
keys[profile_name] = {}
|
37
|
+
@container.regions.each do |region|
|
38
|
+
keys[profile_name][region] = Ec2Instances.expand_profile_name_to_credential profile_name, region
|
39
|
+
end
|
37
40
|
end
|
38
41
|
keys
|
39
42
|
else
|
40
43
|
@container.aws_keys
|
41
44
|
end
|
42
45
|
end
|
46
|
+
|
47
|
+
def filters
|
48
|
+
@filters = @container.filters || [{
|
49
|
+
name: 'instance-state-name',
|
50
|
+
values: ['running']
|
51
|
+
}]
|
52
|
+
end
|
43
53
|
end
|
44
54
|
end
|