builder/amazon-instance: Omit access, secrety key if using IAM Instance Profile

This commit is contained in:
Clint Shryock 2015-06-10 15:18:05 -05:00
parent 802a76685e
commit c9b413e3d1
1 changed files with 19 additions and 9 deletions

View File

@ -73,6 +73,15 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
} }
if b.config.BundleUploadCommand == "" { if b.config.BundleUploadCommand == "" {
if b.config.IamInstanceProfile != "" {
b.config.BundleUploadCommand = "sudo -i -n ec2-upload-bundle " +
"-b {{.BucketName}} " +
"-m {{.ManifestPath}} " +
"-d {{.BundleDirectory}} " +
"--batch " +
"--region {{.Region}} " +
"--retry"
} else {
b.config.BundleUploadCommand = "sudo -i -n ec2-upload-bundle " + b.config.BundleUploadCommand = "sudo -i -n ec2-upload-bundle " +
"-b {{.BucketName}} " + "-b {{.BucketName}} " +
"-m {{.ManifestPath}} " + "-m {{.ManifestPath}} " +
@ -83,6 +92,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
"--region {{.Region}} " + "--region {{.Region}} " +
"--retry" "--retry"
} }
}
if b.config.BundleVolCommand == "" { if b.config.BundleVolCommand == "" {
b.config.BundleVolCommand = "sudo -i -n ec2-bundle-vol " + b.config.BundleVolCommand = "sudo -i -n ec2-bundle-vol " +