From a3878bbbd629e8b410bb32a482b5cd66cd9c8dda Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 16 Dec 2013 18:11:23 -0800 Subject: [PATCH] builder/amazon/all: launched instances have a name [GH-642] --- CHANGELOG.md | 2 ++ builder/amazon/common/step_run_source_instance.go | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02ea60cf0..7afc519f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ IMPROVEMENTS: * core: Plugins communicate over a single TCP connection per plugin now, instead of sometimes dozens. Performance around plugin communication dramatically increased. +* builder/amazon/all: Launched EC2 instances now have a name of + "Packer Builder" so that they are easily recognizable. [GH-642] * builder/amazon/all: Copying AMIs to multiple regions now happens in parallel. [GH-495] * builder/qemu: Floppy files are supported. [GH-686] diff --git a/builder/amazon/common/step_run_source_instance.go b/builder/amazon/common/step_run_source_instance.go index 9f3d6bfb1..c5733581e 100644 --- a/builder/amazon/common/step_run_source_instance.go +++ b/builder/amazon/common/step_run_source_instance.go @@ -6,7 +6,6 @@ import ( "github.com/mitchellh/multistep" "github.com/mitchellh/packer/packer" "io/ioutil" - "log" ) type StepRunSourceInstance struct { @@ -91,7 +90,14 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi } s.instance = &runResp.Instances[0] - log.Printf("instance id: %s", s.instance.InstanceId) + ui.Message(fmt.Sprintf("Instance ID: %s", s.instance.InstanceId)) + + _, err = ec2conn.CreateTags( + []string{s.instance.InstanceId}, []ec2.Tag{{"Name", "Packer Builder"}}) + if err != nil { + ui.Message( + fmt.Sprintf("Failed to tag a Name on the builder instance: %s", err)) + } ui.Say(fmt.Sprintf("Waiting for instance (%s) to become ready...", s.instance.InstanceId)) stateChange := StateChangeConf{