Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ if (JavaVersion.current().isJava8Compatible()) {
}

allprojects {
ext {
ext {
githubProjectName = 'eureka'

awsVersion = '1.11.277'
awsV2Version = '2.31.37'
servletVersion = '5.0.0'
jettisonVersion = '1.5.4'
apacheHttpClientVersion = '4.5.3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ final class PropertyBasedClientConfigConstants {
// NOTE: all keys are before any prefixes are applied
static final String CLIENT_REGION_KEY = "region";

static final String CLIENT_USE_AWS_V2_KEY = "useAwsSdkV2";

static final String REGISTRATION_ENABLED_KEY = "registration.enabled";
static final String FETCH_REGISTRY_ENABLED_KEY = "shouldFetchRegistry";
static final String SHOULD_ENFORCE_FETCH_REGISTRY_AT_INIT_KEY = "shouldEnforceFetchRegistryAtInit";
Expand Down
7 changes: 7 additions & 0 deletions eureka-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ dependencies {
api "com.amazonaws:aws-java-sdk-autoscaling:${awsVersion}"
api "com.amazonaws:aws-java-sdk-sts:${awsVersion}"
api "com.amazonaws:aws-java-sdk-route53:${awsVersion}"
api "software.amazon.awssdk:ec2:${awsV2Version}"
api "software.amazon.awssdk:autoscaling:${awsV2Version}"
api "software.amazon.awssdk:auth:${awsV2Version}"
api "software.amazon.awssdk:route53:${awsV2Version}"
api "software.amazon.awssdk:sesv2:${awsV2Version}"
api "software.amazon.awssdk:sts:${awsV2Version}"
api "jakarta.servlet:jakarta.servlet-api:${servletVersion}"
api 'jakarta.inject:jakarta.inject-api:2.0.1'
api 'com.thoughtworks.xstream:xstream:1.4.21'
Expand All @@ -26,4 +32,5 @@ dependencies {
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
testImplementation "org.assertj:assertj-core:3.24.2"
testRuntimeOnly 'org.slf4j:slf4j-simple:1.7.10'

}
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ public String getAWSSecretKey() {
}
}

@Override
public boolean isUseAwsSdkV2(){
return configInstance.getBooleanProperty(namespace + "useAwsSdkV2", false).get();
}


/*
* (non-Javadoc)
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.netflix.discovery.AbstractDiscoveryClientOptionalArgs;
import com.netflix.discovery.shared.transport.jersey.TransportClientFactories;
import com.netflix.eureka.aws.AwsBinderDelegateV2;
import com.netflix.eureka.transport.EurekaServerHttpClientFactory;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletContextEvent;
Expand Down Expand Up @@ -186,7 +187,11 @@ protected void initEurekaServerContext() throws Exception {
eurekaClient,
eurekaServerHttpClientFactory
);
awsBinder = new AwsBinderDelegate(eurekaServerConfig, eurekaClient.getEurekaClientConfig(), registry, applicationInfoManager);
if(eurekaServerConfig.isUseAwsSdkV2()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for Spring Cloud since it does not use EurekaBootStrap

awsBinder = new AwsBinderDelegateV2(eurekaServerConfig, eurekaClient.getEurekaClientConfig(), registry, applicationInfoManager);
}else{
awsBinder = new AwsBinderDelegate(eurekaServerConfig, eurekaClient.getEurekaClientConfig(), registry, applicationInfoManager);
}
awsBinder.start();
} else {
registry = new PeerAwareInstanceRegistryImpl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,29 @@ public interface EurekaServerConfig {
*/
String getAWSSecretKey();

/**
* Defaults to false for back compatability.
* If set to true, the client will need to add the jars to their gradle:
* api "com.amazonaws:aws-java-sdk-core:${awsV2Version}"
* api "com.amazonaws:aws-java-sdk-ec2:${awsV2Version}"
* api "com.amazonaws:aws-java-sdk-autoscaling:${awsV2Version}"
* api "com.amazonaws:aws-java-sdk-sts:${awsV2Version}"
* api "com.amazonaws:aws-java-sdk-route53:${awsV2Version}"
* api "software.amazon.awssdk:ec2:${awsV2Version}"
* api "software.amazon.awssdk:autoscaling:${awsV2Version}"
* api "software.amazon.awssdk:auth:${awsV2Version}"
* api "software.amazon.awssdk:route53:${awsV2Version}"
* api "software.amazon.awssdk:sesv2:${awsV2Version}"
* api "software.amazon.awssdk:sts:${awsV2Version}"
*
* And exclude com.amazonaws
*
* @return
*/
default boolean isUseAwsSdkV2() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a default of false is great.

return false;
}

/**
* Gets the number of times the server should try to bind to the candidate
* EIP.
Expand Down
Loading