diff --git a/backends/ec2.go b/backends/ec2.go index 3c4adde3df..b276e5f6d8 100644 --- a/backends/ec2.go +++ b/backends/ec2.go @@ -175,7 +175,14 @@ func (c *ec2Client) findInstance() (instance *ec2.Instance, err error) { if resp.Reservations == nil { return nil, nil } - return &resp.Reservations[0].Instances[0], nil + + instance := resp.Reservations[0].Instances[0] + + if (instance.State.Name != "running" || instance.State.Name != "pending") { + return nil, nil + } + + return &instance, nil } }