@@ -14,9 +14,6 @@ public class ComputeConfig extends RegionalConfig { | |||||
@Getter @Setter private ComputeNodeSize[] sizes; | @Getter @Setter private ComputeNodeSize[] sizes; | ||||
@Getter @Setter private NameAndValue[] config; | @Getter @Setter private NameAndValue[] config; | ||||
@Getter @Setter private String instanceType; | |||||
@Getter @Setter private String imageId; | |||||
@Getter @Setter private String group; | |||||
public CloudRegion getRegion (String name) { | public CloudRegion getRegion (String name) { | ||||
for (CloudRegion r : getRegions()) { | for (CloudRegion r : getRegions()) { | ||||
@@ -44,7 +44,7 @@ public class AmazonEC2Driver extends ComputeServiceDriverBase { | |||||
private AmazonEC2 initEC2Client() { | private AmazonEC2 initEC2Client() { | ||||
final Regions region; | final Regions region; | ||||
final String regionName = config.getRegion(Regions.DEFAULT_REGION.getName()).getName(); | |||||
final String regionName = config.getConfig("region"); | |||||
try { | try { | ||||
region = Regions.valueOf(regionName); | region = Regions.valueOf(regionName); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
@@ -90,15 +90,15 @@ public class AmazonEC2Driver extends ComputeServiceDriverBase { | |||||
@Override public BubbleNode start(BubbleNode node) throws Exception { | @Override public BubbleNode start(BubbleNode node) throws Exception { | ||||
RunInstancesRequest runInstancesRequest = new RunInstancesRequest().withImageId(config.getImageId()) | |||||
.withInstanceType(config.getInstanceType()) | |||||
RunInstancesRequest runInstancesRequest = new RunInstancesRequest().withImageId(config.getConfig("imageId")) | |||||
.withInstanceType(config.getConfig("instanceType")) | |||||
.withMinCount(MIN_COUNT) | .withMinCount(MIN_COUNT) | ||||
.withMaxCount(MAX_COUNT) | .withMaxCount(MAX_COUNT) | ||||
.withKeyName(node.getUuid()) | .withKeyName(node.getUuid()) | ||||
.withNetworkInterfaces(new InstanceNetworkInterfaceSpecification() | .withNetworkInterfaces(new InstanceNetworkInterfaceSpecification() | ||||
.withAssociatePublicIpAddress(true) | .withAssociatePublicIpAddress(true) | ||||
.withSubnetId(SUBNET_ID_PREFIX + node.getUuid()) | .withSubnetId(SUBNET_ID_PREFIX + node.getUuid()) | ||||
.withGroups(config.getGroup())); | |||||
.withGroups(config.getConfig("group"))); | |||||
final AmazonEC2 ec2Client = getEc2Client(); | final AmazonEC2 ec2Client = getEc2Client(); | ||||
RunInstancesResult runInstancesResult = ec2Client.runInstances(runInstancesRequest); | RunInstancesResult runInstancesResult = ec2Client.runInstances(runInstancesRequest); | ||||
@@ -271,10 +271,13 @@ | |||||
"type": "compute", | "type": "compute", | ||||
"driverClass": "bubble.cloud.compute.ec2.AmazonEC2Driver", | "driverClass": "bubble.cloud.compute.ec2.AmazonEC2Driver", | ||||
"driverConfig": { | "driverConfig": { | ||||
"region": "{{#exists BUBBLE_EC2_REGION}}{{BUBBLE_EC2_REGION}}{{else}}US_EAST_1{{/exists}}", | |||||
"instanceType": "{{INSTANCE_TYPE}}", | |||||
"imageId": "{{IMAGE_ID}}", | |||||
"group": "{{EC2_GROUP}}" | |||||
"regions": [{"name": "us-east-1", "description": "US East (N. Virginia)"}], | |||||
"config": [ | |||||
{"name": "region", "value": "US_EAST_1"}, | |||||
{"name": "instanceType", "value": "{{INSTANCE_TYPE}}"}, | |||||
{"name": "imageId", "value": "{{IMAGE_ID}}"}, | |||||
{"name": "group", "value": "{{EC2_GROUP}}"} | |||||
] | |||||
}, | }, | ||||
"credentials": { | "credentials": { | ||||
"params": [ | "params": [ | ||||
@@ -239,10 +239,12 @@ | |||||
"type": "compute", | "type": "compute", | ||||
"driverClass": "bubble.cloud.compute.ec2.AmazonEC2Driver", | "driverClass": "bubble.cloud.compute.ec2.AmazonEC2Driver", | ||||
"driverConfig": { | "driverConfig": { | ||||
"region": "US_EAST_1", | |||||
"instanceType": "t2.micro", | |||||
"imageId": "ami-0080e4c5bc078760e", | |||||
"group": "sg-id" | |||||
"config": [ | |||||
{"name": "region", "value": "US_EAST_1"}, | |||||
{"name": "instanceType", "value": "t2.micro"}, | |||||
{"name": "imageId", "value": "ami-0080e4c5bc078760e"}, | |||||
{"name": "group", "value": "sg-id"} | |||||
] | |||||
}, | }, | ||||
"credentials": { | "credentials": { | ||||
"params": [ | "params": [ | ||||