From f33d103e76a84fb07aca1bc9c83768efb736c851 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Sat, 23 Jul 2016 01:28:39 +0200 Subject: [PATCH 1/4] Use `DefaultAWSCredentialsProviderChain` AWS SDK class for credentials Follow up discussion at https://github.com/elastic/elasticsearch/pull/18690#issuecomment-234505083 Reading the best practices [recommended by AWS](http://docs.aws.amazon.com/java-sdk/latest/developer-guide/credentials.html), we should use `DefaultAWSCredentialsProviderChain` instead of providing the detail of the chain ourselves. For now, we read credentials (if not provided in `elasticsearch.yml`) using: ```java credentials = new AWSCredentialsProviderChain( new SystemPropertiesCredentialsProvider(), new EnvironmentVariableCredentialsProvider(), new InstanceProfileCredentialsProvider() ); ``` Which means that we read from: * Environment Variables - `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` (RECOMMENDED since they are recognized by all the AWS SDKs and CLI except for .NET), or `AWS_ACCESS_KEY` and `AWS_SECRET_KEY` (only recognized by Java SDK) * Java System Properties - `aws.accessKeyId` and `aws.secretKey` * Instance profile credentials delivered through the Amazon EC2 metadata service Using instead: ```java credentials = new DefaultAWSCredentialsProviderChain(); ``` Will give us two new more methods out of the box: > * Credential profiles file at the default location (`~/.aws/credentials`) shared by all AWS SDKs and the AWS CLI > * Credentials delivered through the Amazon EC2 container service if `AWS_CONTAINER_CREDENTIALS_RELATIVE_URI` environment variable is set and security manager has permission to access the variable Cherry on the cake: as soon as AWS SDK will propose a new implementation, we will benefit from it without any modification (just updating the SDK). We also simplify ``` new AWSCredentialsProviderChain(new StaticCredentialsProvider(new BasicAWSCredentials(key, secret))); ``` As there is no need to wrap StaticCredentialsProvider in AWSCredentialsProviderChain. Closes #19556. --- .../cloud/aws/AwsEc2ServiceImpl.java | 15 +++------------ .../cloud/aws/InternalAwsS3Service.java | 17 +++-------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java b/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java index b51c9c03f6e..bba0919ca8c 100644 --- a/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java +++ b/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java @@ -23,11 +23,8 @@ import com.amazonaws.AmazonClientException; import com.amazonaws.AmazonWebServiceRequest; import com.amazonaws.ClientConfiguration; import com.amazonaws.auth.AWSCredentialsProvider; -import com.amazonaws.auth.AWSCredentialsProviderChain; import com.amazonaws.auth.BasicAWSCredentials; -import com.amazonaws.auth.EnvironmentVariableCredentialsProvider; -import com.amazonaws.auth.InstanceProfileCredentialsProvider; -import com.amazonaws.auth.SystemPropertiesCredentialsProvider; +import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; import com.amazonaws.http.IdleConnectionReaper; import com.amazonaws.internal.StaticCredentialsProvider; import com.amazonaws.retry.RetryPolicy; @@ -83,16 +80,10 @@ public class AwsEc2ServiceImpl extends AbstractLifecycleComponent implements Aws String secret = CLOUD_EC2.SECRET_SETTING.get(settings); if (key.isEmpty() && secret.isEmpty()) { logger.debug("Using either environment variables, system properties or instance profile credentials"); - credentials = new AWSCredentialsProviderChain( - new EnvironmentVariableCredentialsProvider(), - new SystemPropertiesCredentialsProvider(), - new InstanceProfileCredentialsProvider() - ); + credentials = new DefaultAWSCredentialsProviderChain(); } else { logger.debug("Using basic key/secret credentials"); - credentials = new AWSCredentialsProviderChain( - new StaticCredentialsProvider(new BasicAWSCredentials(key, secret)) - ); + credentials = new StaticCredentialsProvider(new BasicAWSCredentials(key, secret)); } return credentials; diff --git a/plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java b/plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java index e1bce876c27..27053379db1 100644 --- a/plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java +++ b/plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java @@ -22,11 +22,8 @@ package org.elasticsearch.cloud.aws; import com.amazonaws.ClientConfiguration; import com.amazonaws.Protocol; import com.amazonaws.auth.AWSCredentialsProvider; -import com.amazonaws.auth.AWSCredentialsProviderChain; import com.amazonaws.auth.BasicAWSCredentials; -import com.amazonaws.auth.EnvironmentVariableCredentialsProvider; -import com.amazonaws.auth.InstanceProfileCredentialsProvider; -import com.amazonaws.auth.SystemPropertiesCredentialsProvider; +import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; import com.amazonaws.http.IdleConnectionReaper; import com.amazonaws.internal.StaticCredentialsProvider; import com.amazonaws.services.s3.AmazonS3; @@ -36,7 +33,6 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.Strings; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.component.AbstractLifecycleComponent; -import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.settings.Settings; @@ -122,19 +118,12 @@ public class InternalAwsS3Service extends AbstractLifecycleComponent implements public static AWSCredentialsProvider buildCredentials(ESLogger logger, String key, String secret) { AWSCredentialsProvider credentials; - if (key.isEmpty() && secret.isEmpty()) { logger.debug("Using either environment variables, system properties or instance profile credentials"); - credentials = new AWSCredentialsProviderChain( - new EnvironmentVariableCredentialsProvider(), - new SystemPropertiesCredentialsProvider(), - new InstanceProfileCredentialsProvider() - ); + credentials = new DefaultAWSCredentialsProviderChain(); } else { logger.debug("Using basic key/secret credentials"); - credentials = new AWSCredentialsProviderChain( - new StaticCredentialsProvider(new BasicAWSCredentials(key, secret)) - ); + credentials = new StaticCredentialsProvider(new BasicAWSCredentials(key, secret)); } return credentials; From feea7f711e4c03bbe9f0a4bced60453b50057879 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Sat, 23 Jul 2016 12:17:52 +0200 Subject: [PATCH 2/4] Add tests --- plugins/discovery-ec2/build.gradle | 7 ++-- .../cloud/aws/AwsEc2ServiceImplTests.java | 24 ++++++++++++-- plugins/repository-s3/build.gradle | 7 ++-- .../cloud/aws/AwsS3ServiceImplTests.java | 33 +++++++++++++++++-- 4 files changed, 57 insertions(+), 14 deletions(-) diff --git a/plugins/discovery-ec2/build.gradle b/plugins/discovery-ec2/build.gradle index a31dcde20a0..9bdc751e167 100644 --- a/plugins/discovery-ec2/build.gradle +++ b/plugins/discovery-ec2/build.gradle @@ -45,10 +45,9 @@ dependencyLicenses { test { // this is needed for insecure plugins, remove if possible! systemProperty 'tests.artifact', project.name - // this could be needed by AwsEc2ServiceImplTests#testAWSCredentialsWithSystemProviders() - // As it's marked as Ignored for now, we can comment those - // systemProperty 'aws.accessKeyId', 'DUMMY_ACCESS_KEY' - // systemProperty 'aws.secretKey', 'DUMMY_SECRET_KEY' + // this is needed by AwsS3ServiceImplTests#testAWSCredentialsWithSystemProviders() + systemProperty 'aws.accessKeyId', 'DUMMY_ACCESS_KEY' + systemProperty 'aws.secretKey', 'DUMMY_SECRET_KEY' } thirdPartyAudit.excludes = [ diff --git a/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java b/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java index 7ee82516926..98f18a66ceb 100644 --- a/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java +++ b/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java @@ -23,22 +23,40 @@ import com.amazonaws.ClientConfiguration; import com.amazonaws.Protocol; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.AWSCredentialsProvider; +import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; +import com.amazonaws.util.StringUtils; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESTestCase; +import static com.amazonaws.SDKGlobalConfiguration.ACCESS_KEY_SYSTEM_PROPERTY; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; public class AwsEc2ServiceImplTests extends ESTestCase { - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/19556") public void testAWSCredentialsWithSystemProviders() { + // Testing this is hard as it depends on the order of Credential Providers we have in the DefaultAWSCredentialsProviderChain class: + // EnvironmentVariableCredentialsProvider: + // Env vars: (AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY) and (AWS_SECRET_KEY or AWS_SECRET_ACCESS_KEY) + // SystemPropertiesCredentialsProvider: + // Sys props: aws.accessKeyId and aws.secretKey + // ProfileCredentialsProvider: Profile file + // InstanceProfileCredentialsProvider: EC2 Metadata + // We don't want to test all the behavior but just that when we don't provide any KEY/SECRET they + // will be loaded from the default chain using DefaultAWSCredentialsProviderChain + + assumeFalse("Running test from the IDE does not work as system properties are eventually undefined", + StringUtils.isNullOrEmpty(System.getProperty(ACCESS_KEY_SYSTEM_PROPERTY))); + + DefaultAWSCredentialsProviderChain providerChain = new DefaultAWSCredentialsProviderChain(); + AWSCredentials expectedCredentials = providerChain.getCredentials(); + AWSCredentialsProvider credentialsProvider = AwsEc2ServiceImpl.buildCredentials(logger, Settings.EMPTY); AWSCredentials credentials = credentialsProvider.getCredentials(); - assertThat(credentials.getAWSAccessKeyId(), is("DUMMY_ACCESS_KEY")); - assertThat(credentials.getAWSSecretKey(), is("DUMMY_SECRET_KEY")); + assertThat(credentials.getAWSAccessKeyId(), is(expectedCredentials.getAWSAccessKeyId())); + assertThat(credentials.getAWSSecretKey(), is(expectedCredentials.getAWSSecretKey())); } public void testAWSCredentialsWithElasticsearchAwsSettings() { diff --git a/plugins/repository-s3/build.gradle b/plugins/repository-s3/build.gradle index 23aa68e7f2d..34ec44050ca 100644 --- a/plugins/repository-s3/build.gradle +++ b/plugins/repository-s3/build.gradle @@ -51,10 +51,9 @@ dependencyLicenses { test { // this is needed for insecure plugins, remove if possible! systemProperty 'tests.artifact', project.name - // this could be needed by AwsS3ServiceImplTests#testAWSCredentialsWithSystemProviders() - // As it's marked as Ignored for now, we can comment those - // systemProperty 'aws.accessKeyId', 'DUMMY_ACCESS_KEY' - // systemProperty 'aws.secretKey', 'DUMMY_SECRET_KEY' + // this is needed by AwsS3ServiceImplTests#testAWSCredentialsWithSystemProviders() + systemProperty 'aws.accessKeyId', 'DUMMY_ACCESS_KEY' + systemProperty 'aws.secretKey', 'DUMMY_SECRET_KEY' } thirdPartyAudit.excludes = [ diff --git a/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java b/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java index 788ea8b60ed..7b08baf1f6f 100644 --- a/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java +++ b/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java @@ -23,22 +23,49 @@ import com.amazonaws.ClientConfiguration; import com.amazonaws.Protocol; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.AWSCredentialsProvider; +import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; +import com.amazonaws.auth.EnvironmentVariableCredentialsProvider; +import com.amazonaws.auth.InstanceProfileCredentialsProvider; +import com.amazonaws.auth.SystemPropertiesCredentialsProvider; +import com.amazonaws.auth.profile.ProfileCredentialsProvider; +import com.amazonaws.util.StringUtils; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.repositories.s3.S3Repository; import org.elasticsearch.test.ESTestCase; +import static com.amazonaws.SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR; +import static com.amazonaws.SDKGlobalConfiguration.ACCESS_KEY_SYSTEM_PROPERTY; +import static com.amazonaws.SDKGlobalConfiguration.ALTERNATE_ACCESS_KEY_ENV_VAR; +import static com.amazonaws.SDKGlobalConfiguration.ALTERNATE_SECRET_KEY_ENV_VAR; +import static com.amazonaws.SDKGlobalConfiguration.SECRET_KEY_ENV_VAR; +import static com.amazonaws.SDKGlobalConfiguration.SECRET_KEY_SYSTEM_PROPERTY; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; public class AwsS3ServiceImplTests extends ESTestCase { - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/19556") public void testAWSCredentialsWithSystemProviders() { + // Testing this is hard as it depends on the order of Credential Providers we have in the DefaultAWSCredentialsProviderChain class: + // EnvironmentVariableCredentialsProvider: + // Env vars: (AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY) and (AWS_SECRET_KEY or AWS_SECRET_ACCESS_KEY) + // SystemPropertiesCredentialsProvider: + // Sys props: aws.accessKeyId and aws.secretKey + // ProfileCredentialsProvider: Profile file + // InstanceProfileCredentialsProvider: EC2 Metadata + // We don't want to test all the behavior but just that when we don't provide any KEY/SECRET they + // will be loaded from the default chain using DefaultAWSCredentialsProviderChain + + assumeFalse("Running test from the IDE does not work as system properties are eventually undefined", + StringUtils.isNullOrEmpty(System.getProperty(ACCESS_KEY_SYSTEM_PROPERTY))); + + DefaultAWSCredentialsProviderChain providerChain = new DefaultAWSCredentialsProviderChain(); + AWSCredentials expectedCredentials = providerChain.getCredentials(); + AWSCredentialsProvider credentialsProvider = InternalAwsS3Service.buildCredentials(logger, "", ""); AWSCredentials credentials = credentialsProvider.getCredentials(); - assertThat(credentials.getAWSAccessKeyId(), is("DUMMY_ACCESS_KEY")); - assertThat(credentials.getAWSSecretKey(), is("DUMMY_SECRET_KEY")); + assertThat(credentials.getAWSAccessKeyId(), is(expectedCredentials.getAWSAccessKeyId())); + assertThat(credentials.getAWSSecretKey(), is(expectedCredentials.getAWSSecretKey())); } public void testAWSCredentialsWithElasticsearchAwsSettings() { From cab353165562b6f85eb35c6cf829d2425851b02a Mon Sep 17 00:00:00 2001 From: David Pilato Date: Sat, 23 Jul 2016 13:55:09 +0200 Subject: [PATCH 3/4] Update test --- plugins/discovery-ec2/build.gradle | 3 --- .../cloud/aws/AwsEc2ServiceImplTests.java | 22 ++----------------- plugins/repository-s3/build.gradle | 3 --- .../cloud/aws/AwsS3ServiceImplTests.java | 22 ++----------------- 4 files changed, 4 insertions(+), 46 deletions(-) diff --git a/plugins/discovery-ec2/build.gradle b/plugins/discovery-ec2/build.gradle index 9bdc751e167..506215708e2 100644 --- a/plugins/discovery-ec2/build.gradle +++ b/plugins/discovery-ec2/build.gradle @@ -45,9 +45,6 @@ dependencyLicenses { test { // this is needed for insecure plugins, remove if possible! systemProperty 'tests.artifact', project.name - // this is needed by AwsS3ServiceImplTests#testAWSCredentialsWithSystemProviders() - systemProperty 'aws.accessKeyId', 'DUMMY_ACCESS_KEY' - systemProperty 'aws.secretKey', 'DUMMY_SECRET_KEY' } thirdPartyAudit.excludes = [ diff --git a/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java b/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java index 98f18a66ceb..d0bb4e18a36 100644 --- a/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java +++ b/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java @@ -30,33 +30,15 @@ import org.elasticsearch.test.ESTestCase; import static com.amazonaws.SDKGlobalConfiguration.ACCESS_KEY_SYSTEM_PROPERTY; import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; public class AwsEc2ServiceImplTests extends ESTestCase { public void testAWSCredentialsWithSystemProviders() { - // Testing this is hard as it depends on the order of Credential Providers we have in the DefaultAWSCredentialsProviderChain class: - // EnvironmentVariableCredentialsProvider: - // Env vars: (AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY) and (AWS_SECRET_KEY or AWS_SECRET_ACCESS_KEY) - // SystemPropertiesCredentialsProvider: - // Sys props: aws.accessKeyId and aws.secretKey - // ProfileCredentialsProvider: Profile file - // InstanceProfileCredentialsProvider: EC2 Metadata - // We don't want to test all the behavior but just that when we don't provide any KEY/SECRET they - // will be loaded from the default chain using DefaultAWSCredentialsProviderChain - - assumeFalse("Running test from the IDE does not work as system properties are eventually undefined", - StringUtils.isNullOrEmpty(System.getProperty(ACCESS_KEY_SYSTEM_PROPERTY))); - - DefaultAWSCredentialsProviderChain providerChain = new DefaultAWSCredentialsProviderChain(); - AWSCredentials expectedCredentials = providerChain.getCredentials(); - AWSCredentialsProvider credentialsProvider = AwsEc2ServiceImpl.buildCredentials(logger, Settings.EMPTY); - - AWSCredentials credentials = credentialsProvider.getCredentials(); - assertThat(credentials.getAWSAccessKeyId(), is(expectedCredentials.getAWSAccessKeyId())); - assertThat(credentials.getAWSSecretKey(), is(expectedCredentials.getAWSSecretKey())); + assertThat(credentialsProvider, instanceOf(DefaultAWSCredentialsProviderChain.class)); } public void testAWSCredentialsWithElasticsearchAwsSettings() { diff --git a/plugins/repository-s3/build.gradle b/plugins/repository-s3/build.gradle index 34ec44050ca..a6610178ce8 100644 --- a/plugins/repository-s3/build.gradle +++ b/plugins/repository-s3/build.gradle @@ -51,9 +51,6 @@ dependencyLicenses { test { // this is needed for insecure plugins, remove if possible! systemProperty 'tests.artifact', project.name - // this is needed by AwsS3ServiceImplTests#testAWSCredentialsWithSystemProviders() - systemProperty 'aws.accessKeyId', 'DUMMY_ACCESS_KEY' - systemProperty 'aws.secretKey', 'DUMMY_SECRET_KEY' } thirdPartyAudit.excludes = [ diff --git a/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java b/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java index 7b08baf1f6f..de68ab66bb8 100644 --- a/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java +++ b/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java @@ -40,32 +40,14 @@ import static com.amazonaws.SDKGlobalConfiguration.ALTERNATE_SECRET_KEY_ENV_VAR; import static com.amazonaws.SDKGlobalConfiguration.SECRET_KEY_ENV_VAR; import static com.amazonaws.SDKGlobalConfiguration.SECRET_KEY_SYSTEM_PROPERTY; import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; public class AwsS3ServiceImplTests extends ESTestCase { public void testAWSCredentialsWithSystemProviders() { - // Testing this is hard as it depends on the order of Credential Providers we have in the DefaultAWSCredentialsProviderChain class: - // EnvironmentVariableCredentialsProvider: - // Env vars: (AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY) and (AWS_SECRET_KEY or AWS_SECRET_ACCESS_KEY) - // SystemPropertiesCredentialsProvider: - // Sys props: aws.accessKeyId and aws.secretKey - // ProfileCredentialsProvider: Profile file - // InstanceProfileCredentialsProvider: EC2 Metadata - // We don't want to test all the behavior but just that when we don't provide any KEY/SECRET they - // will be loaded from the default chain using DefaultAWSCredentialsProviderChain - - assumeFalse("Running test from the IDE does not work as system properties are eventually undefined", - StringUtils.isNullOrEmpty(System.getProperty(ACCESS_KEY_SYSTEM_PROPERTY))); - - DefaultAWSCredentialsProviderChain providerChain = new DefaultAWSCredentialsProviderChain(); - AWSCredentials expectedCredentials = providerChain.getCredentials(); - AWSCredentialsProvider credentialsProvider = InternalAwsS3Service.buildCredentials(logger, "", ""); - - AWSCredentials credentials = credentialsProvider.getCredentials(); - assertThat(credentials.getAWSAccessKeyId(), is(expectedCredentials.getAWSAccessKeyId())); - assertThat(credentials.getAWSSecretKey(), is(expectedCredentials.getAWSSecretKey())); + assertThat(credentialsProvider, instanceOf(DefaultAWSCredentialsProviderChain.class)); } public void testAWSCredentialsWithElasticsearchAwsSettings() { From 72784f44f0265e2b5344e7e1532450d7f6e3ce3f Mon Sep 17 00:00:00 2001 From: David Pilato Date: Thu, 28 Jul 2016 17:34:00 +0200 Subject: [PATCH 4/4] Remove non needed imports --- .../cloud/aws/AwsEc2ServiceImplTests.java | 2 -- .../cloud/aws/AwsS3ServiceImplTests.java | 11 ----------- 2 files changed, 13 deletions(-) diff --git a/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java b/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java index d0bb4e18a36..42216df51ea 100644 --- a/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java +++ b/plugins/discovery-ec2/src/test/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImplTests.java @@ -24,11 +24,9 @@ import com.amazonaws.Protocol; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; -import com.amazonaws.util.StringUtils; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESTestCase; -import static com.amazonaws.SDKGlobalConfiguration.ACCESS_KEY_SYSTEM_PROPERTY; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; diff --git a/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java b/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java index de68ab66bb8..777bb5ff358 100644 --- a/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java +++ b/plugins/repository-s3/src/test/java/org/elasticsearch/cloud/aws/AwsS3ServiceImplTests.java @@ -24,21 +24,10 @@ import com.amazonaws.Protocol; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; -import com.amazonaws.auth.EnvironmentVariableCredentialsProvider; -import com.amazonaws.auth.InstanceProfileCredentialsProvider; -import com.amazonaws.auth.SystemPropertiesCredentialsProvider; -import com.amazonaws.auth.profile.ProfileCredentialsProvider; -import com.amazonaws.util.StringUtils; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.repositories.s3.S3Repository; import org.elasticsearch.test.ESTestCase; -import static com.amazonaws.SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR; -import static com.amazonaws.SDKGlobalConfiguration.ACCESS_KEY_SYSTEM_PROPERTY; -import static com.amazonaws.SDKGlobalConfiguration.ALTERNATE_ACCESS_KEY_ENV_VAR; -import static com.amazonaws.SDKGlobalConfiguration.ALTERNATE_SECRET_KEY_ENV_VAR; -import static com.amazonaws.SDKGlobalConfiguration.SECRET_KEY_ENV_VAR; -import static com.amazonaws.SDKGlobalConfiguration.SECRET_KEY_SYSTEM_PROPERTY; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is;