diff --git a/builder/amazon/common/ssh.go b/builder/amazon/common/ssh.go index 3d1c44372..da7f74ffb 100644 --- a/builder/amazon/common/ssh.go +++ b/builder/amazon/common/ssh.go @@ -34,6 +34,8 @@ func SSHHost(e ec2Describer, private bool) func(multistep.StateBag) (string, err } else if i.PrivateIpAddress != nil && *i.PrivateIpAddress != "" { host = *i.PrivateIpAddress } + } else if private { + host = *i.PrivateIpAddress } else if i.PublicDnsName != nil && *i.PublicDnsName != "" { host = *i.PublicDnsName }