# Sentinel DataSource Eureka
Sentinel DataSource Eureka provides integration with [Eureka](https://github.com/Netflix/eureka) so that Eureka
can be the dynamic rule data source of Sentinel.
To use Sentinel DataSource Eureka, you should add the following dependency:
```xml
com.alibaba.csp
sentinel-datasource-eureka
x.y.z
```
Then you can create an `EurekaDataSource` and register to rule managers.
SDK usage:
```java
EurekaDataSource> eurekaDataSource = new EurekaDataSource("app-id", "instance-id",
Arrays.asList("http://localhost:8761/eureka", "http://localhost:8762/eureka", "http://localhost:8763/eureka"),
"rule-key", flowRuleParser);
FlowRuleManager.register2Property(eurekaDataSource.getProperty());
```
Example for Spring Cloud Application:
```java
@Bean
public EurekaDataSource> eurekaDataSource(EurekaInstanceConfig eurekaInstanceConfig, EurekaClientConfig eurekaClientConfig) {
List serviceUrls = EndpointUtils.getServiceUrlsFromConfig(eurekaClientConfig,
eurekaInstanceConfig.getMetadataMap().get("zone"), eurekaClientConfig.shouldPreferSameZoneEureka());
EurekaDataSource> eurekaDataSource = new EurekaDataSource(eurekaInstanceConfig.getAppname(),
eurekaInstanceConfig.getInstanceId(), serviceUrls, "flowrules", new Converter>() {
@Override
public List convert(String o) {
return JSON.parseObject(o, new TypeReference>() {
});
}
});
FlowRuleManager.register2Property(eurekaDataSource.getProperty());
return eurekaDataSource;
}
```
To refresh the rule dynamically, you need to call [Eureka-REST-operations](https://github.com/Netflix/eureka/wiki/Eureka-REST-operations)
to update instance metadata:
```
PUT /eureka/apps/{appID}/{instanceID}/metadata?{ruleKey}={json of the rules}
```
Note: don't forget to encode your JSON string in the url.