diff --git a/builder/amazon/common/run_config.go b/builder/amazon/common/run_config.go index 321378cc9..74ca2207c 100644 --- a/builder/amazon/common/run_config.go +++ b/builder/amazon/common/run_config.go @@ -10,6 +10,7 @@ import ( // AMI and details on how to access that launched image. type RunConfig struct { SourceAmi string `mapstructure:"source_ami"` + IamInstanceProfile string `mapstructure:"iam_instance_profile"` InstanceType string `mapstructure:"instance_type"` RawSSHTimeout string `mapstructure:"ssh_timeout"` SSHUsername string `mapstructure:"ssh_username"` diff --git a/builder/amazon/common/step_run_source_instance.go b/builder/amazon/common/step_run_source_instance.go index 85bc7bd70..de91a1446 100644 --- a/builder/amazon/common/step_run_source_instance.go +++ b/builder/amazon/common/step_run_source_instance.go @@ -12,6 +12,7 @@ type StepRunSourceInstance struct { ExpectedRootDevice string InstanceType string SourceAMI string + IamInstanceProfile string SubnetId string instance *ec2.Instance @@ -24,13 +25,14 @@ func (s *StepRunSourceInstance) Run(state map[string]interface{}) multistep.Step ui := state["ui"].(packer.Ui) runOpts := &ec2.RunInstances{ - KeyName: keyName, - ImageId: s.SourceAMI, - InstanceType: s.InstanceType, - MinCount: 0, - MaxCount: 0, - SecurityGroups: []ec2.SecurityGroup{ec2.SecurityGroup{Id: securityGroupId}}, - SubnetId: s.SubnetId, + KeyName: keyName, + ImageId: s.SourceAMI, + InstanceType: s.InstanceType, + MinCount: 0, + MaxCount: 0, + SecurityGroups: []ec2.SecurityGroup{ec2.SecurityGroup{Id: securityGroupId}}, + IamInstanceProfile: s.IamInstanceProfile, + SubnetId: s.SubnetId, } ui.Say("Launching a source AWS instance...") diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go index 714c96afc..c9536c815 100644 --- a/builder/amazon/ebs/builder.go +++ b/builder/amazon/ebs/builder.go @@ -97,6 +97,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ExpectedRootDevice: "ebs", InstanceType: b.config.InstanceType, SourceAMI: b.config.SourceAmi, + IamInstanceProfile: b.config.IamInstanceProfile, SubnetId: b.config.SubnetId, }, &common.StepConnectSSH{