awsam 0.0.1 → 0.0.2
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.
- data/README.md +2 -1
- data/bin/ascp +2 -1
- data/bin/assh +5 -3
- data/lib/awsam/account.rb +4 -0
- data/lib/awsam/ec2.rb +11 -2
- data/lib/awsam/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -119,7 +119,8 @@ will be marked with an asterisk.
|
|
119
119
|
### Import a key pair
|
120
120
|
|
121
121
|
Add a key to the default account, or the specified account. Defaults
|
122
|
-
chosen from current environment if set.
|
122
|
+
chosen from current environment if set. IMPORTANT: `my-key-name` must
|
123
|
+
match the logical name of the AWS EC2 keypair.
|
123
124
|
|
124
125
|
$ aem key add my-key-name /path/to/my-keypair.pem
|
125
126
|
Imported key pair my-key-name for account staging [Staging account]
|
data/bin/ascp
CHANGED
@@ -46,7 +46,8 @@ keyfile = nil
|
|
46
46
|
exit 1
|
47
47
|
end
|
48
48
|
|
49
|
-
|
49
|
+
hostname = Awsam::Ec2::instance_hostname(inst)
|
50
|
+
args[i] = args[i].gsub(instance_id, hostname)
|
50
51
|
|
51
52
|
key = acct.find_key(inst[:ssh_key_name])
|
52
53
|
keyfile = key.path if key
|
data/bin/assh
CHANGED
@@ -57,15 +57,17 @@ if inst[:aws_state] != "running"
|
|
57
57
|
exit 1
|
58
58
|
end
|
59
59
|
|
60
|
-
|
60
|
+
hostname = Awsam::Ec2::instance_hostname(inst)
|
61
|
+
|
62
|
+
puts "Logging in as #{user} to #{hostname}"
|
61
63
|
puts
|
62
64
|
|
63
65
|
key = acct.find_key(inst[:ssh_key_name])
|
64
66
|
|
65
67
|
if key
|
66
|
-
exec "ssh -i #{key.path} -o IdentitiesOnly=yes #{user}@#{
|
68
|
+
exec "ssh -i #{key.path} -o IdentitiesOnly=yes #{user}@#{hostname}"
|
67
69
|
else
|
68
|
-
exec "ssh #{user}@#{
|
70
|
+
exec "ssh #{user}@#{hostname}"
|
69
71
|
end
|
70
72
|
|
71
73
|
# Local Variables:
|
data/lib/awsam/account.rb
CHANGED
data/lib/awsam/ec2.rb
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
module Awsam
|
2
2
|
module Ec2
|
3
3
|
|
4
|
-
LOOKUP_TAGS = ["Name", "aws:autoscaling:groupName"].freeze
|
4
|
+
LOOKUP_TAGS = ["Name", "aws:autoscaling:groupName", "AlsoKnownAs"].freeze
|
5
|
+
|
6
|
+
def self.instance_hostname(inst)
|
7
|
+
hostname = inst[:dns_name]
|
8
|
+
# Are we in a VPC?
|
9
|
+
if inst[:vpc_id]
|
10
|
+
hostname = inst[:private_ip_address]
|
11
|
+
end
|
12
|
+
hostname
|
13
|
+
end
|
5
14
|
|
6
15
|
def self.find_instance(acct, instance_id)
|
7
16
|
logger = Logger.new(File.open("/dev/null", "w"))
|
8
|
-
ec2 = RightAws::Ec2.new(acct.access_key, acct.secret_key, :logger => logger)
|
17
|
+
ec2 = RightAws::Ec2.new(acct.access_key, acct.secret_key, :logger => logger, :region => acct.aws_region)
|
9
18
|
|
10
19
|
unless ec2
|
11
20
|
puts "Unable to connect to EC2"
|
data/lib/awsam/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awsam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-11-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: right_aws
|
@@ -119,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
segments:
|
121
121
|
- 0
|
122
|
-
hash:
|
122
|
+
hash: -1303385006306844615
|
123
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
124
|
none: false
|
125
125
|
requirements:
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
version: '0'
|
129
129
|
segments:
|
130
130
|
- 0
|
131
|
-
hash:
|
131
|
+
hash: -1303385006306844615
|
132
132
|
requirements: []
|
133
133
|
rubyforge_project:
|
134
134
|
rubygems_version: 1.8.23.2
|