From 80ae5801add4bea1772923dd4198806f8294647d Mon Sep 17 00:00:00 2001 From: Andrew Glen-Young Date: Thu, 25 May 2017 12:55:53 -0400 Subject: [PATCH] Improve EC2 describe instances performance Query the EC2 API for the instance ID rather than filter the results of all instances. --- builtin/credential/aws/path_login.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/builtin/credential/aws/path_login.go b/builtin/credential/aws/path_login.go index bf50898405c3..caffd320f322 100644 --- a/builtin/credential/aws/path_login.go +++ b/builtin/credential/aws/path_login.go @@ -170,13 +170,8 @@ func (b *backend) validateInstance(s logical.Storage, instanceID, region, accoun } status, err := ec2Client.DescribeInstances(&ec2.DescribeInstancesInput{ - Filters: []*ec2.Filter{ - &ec2.Filter{ - Name: aws.String("instance-id"), - Values: []*string{ - aws.String(instanceID), - }, - }, + InstanceIds: []*string{ + aws.String(instanceID), }, }) if err != nil {