Skip to content

Commit

Permalink
Creates an AmazonEC2Client with an AWSCredentialsProvider instead of the
Browse files Browse the repository at this point in the history
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 2855d1d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/ec2/EC2Cloud.java
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2855d1d

Please sign in to comment.