Skip to content
Permalink
Browse files
Creates an AmazonEC2Client with an AWSCredentialsProvider instead of the
AWSCredentials directly. This is done so the credentials will refresh
instead of expire. Resolves JENKINS-26854.

At the moment, in EC2Cloud we create an AmazonEC2Client by passing in
the credentials directly. This creates a StaticCredentialsProvider using
the given credentials. StaticCredentialsProvider never refreshes its
credentials, leading to expiration. Instead, you can create an
AmazonEC2Client with a credentials provider directly. This refreshes the
credentials as needed.

See http://docs.aws.amazon.com/AWSSdkDocsJava/latest/DeveloperGuide/java-dg-roles.html
for more information.AWSCredentials directly. This is done so the
credentials will refresh instead of expire.
  • Loading branch information
jjudd committed May 22, 2015
1 parent b576bb3 commit 2855d1d925dcfe92043ec6ce0b58111c116eb330
Showing 1 changed file with 1 addition and 1 deletion.
@@ -486,7 +486,7 @@ public synchronized static AmazonEC2 connect(AWSCredentialsProvider credentialsP
config.setProxyPassword(proxyConfig.getPassword());
}
}
AmazonEC2 client = new AmazonEC2Client(credentialsProvider.getCredentials(), config);
AmazonEC2 client = new AmazonEC2Client(credentialsProvider, config);
client.setEndpoint(endpoint.toString());
return client;
}

0 comments on commit 2855d1d

Please sign in to comment.