File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -507,7 +507,7 @@ func (p *ec2Provider) Start(ctx gocontext.Context, startAttributes *StartAttribu
507507 if instances != nil {
508508 instance := instances .Reservations [0 ].Instances [0 ]
509509 address := * instance .PrivateIpAddress
510- if p .publicIPConnect {
510+ if instance . PublicIpAddress != nil && p .publicIPConnect {
511511 address = * instance .PublicIpAddress
512512 }
513513 if address != "" {
@@ -633,7 +633,7 @@ func (i *ec2Instance) uploadScriptSCP(ctx gocontext.Context, script []byte) erro
633633
634634func (i * ec2Instance ) sshConnection (ctx gocontext.Context ) (ssh.Connection , error ) {
635635 ip := * i .instance .PrivateIpAddress
636- if i .provider .publicIPConnect {
636+ if i .instance . PublicIpAddress != nil && i . provider .publicIPConnect {
637637 ip = * i .instance .PublicIpAddress
638638 }
639639 return i .sshDialer .Dial (fmt .Sprintf ("%s:22" , ip ), defaultEC2SSHUserName , i .provider .sshDialTimeout )
You can’t perform that action at this time.
0 commit comments