[ARVADOS] updated: 1.3.0-390-g5e3f0c9b8

Git user git at public.curoverse.com
Wed Feb 27 14:00:20 EST 2019


Summary of changes:
 lib/cloud/ec2/ec2.go      | 27 ++++++++++++++++++++-------
 lib/cloud/ec2/ec2_test.go |  1 +
 2 files changed, 21 insertions(+), 7 deletions(-)

       via  5e3f0c9b8c87c0ace05ea08ff1ab6434cb333f07 (commit)
      from  676423e298857c91d794dd9c6016b861304d45b1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 5e3f0c9b8c87c0ace05ea08ff1ab6434cb333f07
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Wed Feb 27 13:57:18 2019 -0500

    14291: Working on instance creation
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/lib/cloud/ec2/ec2.go b/lib/cloud/ec2/ec2.go
index e4e8588d5..115c1a0c0 100644
--- a/lib/cloud/ec2/ec2.go
+++ b/lib/cloud/ec2/ec2.go
@@ -5,7 +5,9 @@
 package ec2
 
 import (
+	"encoding/base64"
 	"encoding/json"
+	"log"
 	"strings"
 
 	"git.curoverse.com/arvados.git/lib/cloud"
@@ -90,13 +92,23 @@ func (instanceSet *ec2InstanceSet) Create(
 	}
 
 	rsv, err := instanceSet.client.RunInstances(&ec2.RunInstancesInput{
-		ImageId:          aws.String(string(imageID)),
-		InstanceType:     &instanceType.ProviderType,
-		MaxCount:         aws.Int64(1),
-		MinCount:         aws.Int64(1),
-		KeyName:          &instanceSet.ec2config.KeyPairName,
-		SecurityGroupIds: []*string{&instanceSet.ec2config.SecurityGroupId},
-		SubnetId:         &instanceSet.ec2config.SubnetId,
+		ImageId:      aws.String(string(imageID)),
+		InstanceType: &instanceType.ProviderType,
+		MaxCount:     aws.Int64(1),
+		MinCount:     aws.Int64(1),
+		KeyName:      &instanceSet.ec2config.KeyPairName,
+
+		NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{
+			&ec2.InstanceNetworkInterfaceSpecification{
+				AssociatePublicIpAddress: aws.Bool(false),
+				DeleteOnTermination:      aws.Bool(true),
+				DeviceIndex:              aws.Int64(0),
+				Groups:                   []*string{&instanceSet.ec2config.SecurityGroupId},
+				SubnetId:                 &instanceSet.ec2config.SubnetId,
+			}},
+		DisableApiTermination:             aws.Bool(false),
+		InstanceInitiatedShutdownBehavior: aws.String("terminate"),
+		UserData: aws.String(base64.StdEncoding.EncodeToString([]byte("#!/bin/sh\n" + initCommand + "\n"))),
 		TagSpecifications: []*ec2.TagSpecification{
 			&ec2.TagSpecification{
 				ResourceType: aws.String("instance"),
@@ -194,6 +206,7 @@ func (inst *ec2Instance) Tags() cloud.InstanceTags {
 }
 
 func (inst *ec2Instance) Destroy() error {
+	log.Printf("terminating %v", *inst.instance.InstanceId)
 	_, err := inst.provider.client.TerminateInstances(&ec2.TerminateInstancesInput{
 		InstanceIds: []*string{inst.instance.InstanceId},
 	})
diff --git a/lib/cloud/ec2/ec2_test.go b/lib/cloud/ec2/ec2_test.go
index c0f72215e..cd469af1d 100644
--- a/lib/cloud/ec2/ec2_test.go
+++ b/lib/cloud/ec2/ec2_test.go
@@ -19,6 +19,7 @@
 //       SecurityGroupId: sg-xxxxxxxx
 //       SubnetId: subnet-xxxxxxxx
 //       AdminUsername: crunch
+//       KeyPairName: arvados-dispatcher-keypair
 
 package ec2
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list