Skip to content

Commit

Permalink
aws discovery: only consider running instances as peers
Browse files Browse the repository at this point in the history
  • Loading branch information
thecubed committed Apr 13, 2021
1 parent 688b99f commit ef539cc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/provider/aws/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ func (c *Client) GetAddressesByTag(ctx context.Context, kvs map[string]string) (
return nil, err
}
filters := make([]*ec2.Filter, 0)
// filter out instances that are not running (terminated)
filters = append(filters, &ec2.Filter{
Name: aws.String("instance-state-name"),
Values: aws.StringSlice([]string{"running"}),
})
for k, v := range kvs {
filters = append(filters, &ec2.Filter{
Name: aws.String(fmt.Sprintf("tag:%s", k)),
Expand Down

0 comments on commit ef539cc

Please sign in to comment.