Using a profile and iam_instance_profile simultanously with Amazon builder?

31 views
Skip to first unread message

Steven Hirschorn

unread,
Jan 9, 2019, 10:02:52 AM1/9/19
to Packer
Is there a way I can use both profile and iam_instance_profile keys simultaneously in a Packer template? I'd like the initial launch of the temporary EC2 instance to use the local AWS CLI credentials (which we are referencing already in a packer template using the profile key) but the temporary EC2 instance to use an instance profile for the build scripts when running locally on that instance.

With profile alone, Packer uses the AWS CLI profile specified to launch the EC2 instance (though the instance doesn't have credentials cross-account to access an S3 bucket I need it to access)

With profile and iam_instance_profile it complains:
"InvalidParameterValue: Value (<profilename>) for parameter iamInstanceProfile.name is invalid"

Note that the profile name quoted is the AWS CLI profile name (the profile value, not the iam_instance_profile value.

Is it expected behaviour that profile and iam_instance_profile are mutually exclusive?

Thanks,
Steven

Rickard von Essen

unread,
Jan 9, 2019, 11:16:20 AM1/9/19
to packe...@googlegroups.com
The profile key defines which profile Packer uses to access the AWS API, as you understood correctly. 

iam_instance_profile just sets the IamInstanceProfile of the EC2 Instance packer launches.

Can you share your template, I thing there is a simple error.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/56d7ccfb-5c80-4f55-9574-35eeeceaee2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steven Hirschorn

unread,
Jan 11, 2019, 6:34:11 AM1/11/19
to Packer
Thanks Richard,

I did indeed have an error in my template. I'd used the wrong variable, and it is working as expected now after fixing that.
Reply all
Reply to author
Forward
0 new messages