Permalink
Browse files

Add ability to pass in security group name

  • Loading branch information...
1 parent e96593e commit 1d740b195b8a9c6d6825232c88b6695ae814d80f @kparlante kparlante committed Mar 8, 2013
Showing with 6 additions and 4 deletions.
  1. +3 −1 awsbox.js
  2. +2 −2 lib/sec.js
  3. +1 −1 lib/vm.js
View
4 awsbox.js
@@ -181,6 +181,7 @@ verbs['create'] = function(args) {
})
.describe('t', 'Instance type, dictates VM speed and cost. i.e. t1.micro or m1.large (see http://aws.amazon.com/ec2/instance-types/)')
.default('t', 't1.micro')
+ .describe('g', 'security group name, finds or creates a security group with this name')
.describe('p', 'public SSL key (installed automatically when provided)')
.describe('s', 'secret SSL key (installed automatically when provided)')
.check(function(argv) {
@@ -245,7 +246,8 @@ verbs['create'] = function(args) {
}
vm.startImage({
- type: opts.t
+ type: opts.t,
+ groupName: opts.g
}, function(err, r) {
checkErr(err);
console.log(" ... VM launched, waiting for startup (should take about 20s)");
View
4 lib/sec.js
@@ -13,8 +13,8 @@ function createError(msg, r) {
return msg;
}
-exports.getName = function(cb) {
- var groupName = "awsbox group v" + SECURITY_GROUP_VERSION;
+exports.getName = function(name, cb) {
+ var groupName = name || "awsbox group v" + SECURITY_GROUP_VERSION;
// is this fingerprint known?
aws.client.call('DescribeSecurityGroups', {
View
2 lib/vm.js
@@ -182,7 +182,7 @@ function returnSingleImageInfo(result, cb) {
exports.startImage = function(opts, cb) {
key.getName(function(err, keyName) {
if (err) return cb(err);
- sec.getName(function(err, groupName) {
+ sec.getName(opts.groupName, function(err, groupName) {
if (err) return cb(err);
aws.client.call('RunInstances', {
ImageId: TEMPLATE_IMAGE_ID,

0 comments on commit 1d740b1

Please sign in to comment.