AWS specific code in Spring Cloud Netflix - Eureka
Note that Spring Cloud Eureka adds a layer of abstraction on top of vanilla netflix eureka, even though they have similar names such as client/server/registry e.t.c. Therefore, when navigating through the code, I often run into definition that embedded inthe vanilla jar
Eureka Client - Client config
-
Default region is us-east-1
-
serviceUrl is az -> fully qualified URL map, default mapping is “defaultZone” -> “http://localhost:8761/eureka”
-
availabilityZones is a region -> az map. Default is empty
Eureka Client - Instance config
-
aSGName - autoscalling group associated with this instance
-
dataCenterInfo - data center where is this instance is deployed - DataCenterInfo.Name.MyOwn
Eureka Server - Bootstrap
- awsBinder - during serverContext init, we check if applicationInfoManager.getInfo() is from aws
protected boolean isAws(InstanceInfo selfInstanceInfo) {
boolean result = DataCenterInfo.Name.Amazon == selfInstanceInfo
.getDataCenterInfo().getName();
log.info("isAws returned " + result);
return result;
}
Eureka Server - Server Config
-
aWSAccessId
-
aWSSecretKey
-
aWSBindingStrategy, default EIP
Eureka Server - Controller
- In header
if (info.getName() == DataCenterInfo.Name.Amazon) { AmazonInfo amazonInfo = (AmazonInfo) info; model.put("amazonInfo", amazonInfo); model.put("amiId", amazonInfo.get(AmazonInfo.MetaDataKey.amiId)); model.put("availabilityZone", amazonInfo.get(AmazonInfo.MetaDataKey.availabilityZone)); model.put("instanceId", amazonInfo.get(AmazonInfo.MetaDataKey.instanceId)); }
- When populating apps on controller, it does similar check as above
Outstanding Questions
- How is an instance of ApplicationInfoManager is populated?
- In Eureka client, how is the region info populated?
- Why my spring cloud eureka is not logging while the original is?