appID is the name of the application and instanceID is the unique identifier associated with the instance. In AWS cloud, instanceID is the instance id of the instance and in other data centers, it is the hostname of the instance.
Operation
HTTP action
Description
Register new application instance
POST /eureka/apps/appID
Input: JSON/XML payload Output: HTTP Code: 204 on success
De-register application instance
DELETE /eureka/apps/appID/instanceID
Output: HTTP Code: 200 on success
Send application instance heartbeat
PUT /eureka/apps/appID/instanceID
Output: HTTP Code: 200 on success 404 if instanceID doesn't exist
Take instance out of service
PUT /eureka/apps/appID/instanceID/status?value=OUT_OF_SERVICE
Output HTTP Code: 200 on success 500 on failure
Move instance back into service (remove override
DELETE /eureka/apps/appID/instanceID/status?value=UP (The value=UP is optional, it is used as a suggestion for the fallback status due to removal of the override)
Output HTTP Code: 200 on success 500 on failure
Update metadata
PUT /eureka/apps/appID/instanceID/metadata?key=value
Output HTTP Code: 200 on success 500 on failure
For JSON/XML, the content types supplied must be application/xml or application/json.
When you register, you’ll need to post an XML (or JSON) body which conforms to this XSD:
<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:elementname="instance"> <xsd:complexType> <xsd:all><!-- hostName in ec2 should be the public dns name, within ec2 public dns name will always resolve to its private IP --> <xsd:elementname="hostName"type="xsd:string" /> <xsd:elementname="app"type="xsd:string" /> <xsd:elementname="ipAddr"type="xsd:string" /> <xsd:elementname="vipAddress"type="xsd:string" /> <xsd:elementname="secureVipAddress"type="xsd:string" /> <xsd:elementname="status"type="statusType" /> <xsd:elementname="port"type="xsd:positiveInteger"minOccurs="0" /> <xsd:elementname="securePort"type="xsd:positiveInteger" /> <xsd:elementname="homePageUrl"type="xsd:string" /> <xsd:elementname="statusPageUrl"type="xsd:string" /> <xsd:elementname="healthCheckUrl"type="xsd:string" /> <xsd:elementref="dataCenterInfo"minOccurs="1"maxOccurs="1" /><!-- optional --> <xsd:elementref="leaseInfo"minOccurs="0"/><!-- optional app specific metadata --> <xsd:elementname="metadata"type="appMetadataType"minOccurs="0" /> </xsd:all> </xsd:complexType> </xsd:element> <xsd:elementname="dataCenterInfo"> <xsd:complexType> <xsd:all> <xsd:elementname="name"type="dcNameType" /><!-- metadata is only required if name is Amazon --> <xsd:elementname="metadata"type="amazonMetdataType"minOccurs="0"/> </xsd:all> </xsd:complexType> </xsd:element> <xsd:elementname="leaseInfo"> <xsd:complexType> <xsd:all><!-- (optional) if you want to change the length of lease - default if 90 secs --> <xsd:elementname="evictionDurationInSecs"minOccurs="0"type="xsd:positiveInteger"/> </xsd:all> </xsd:complexType> </xsd:element> <xsd:simpleTypename="dcNameType"><!-- Restricting the values to a set of value using 'enumeration' --> <xsd:restrictionbase = "xsd:string"> <xsd:enumerationvalue = "MyOwn"/> <xsd:enumerationvalue = "Amazon"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleTypename="statusType"><!-- Restricting the values to a set of value using 'enumeration' --> <xsd:restrictionbase = "xsd:string"> <xsd:enumerationvalue = "UP"/> <xsd:enumerationvalue = "DOWN"/> <xsd:enumerationvalue = "STARTING"/> <xsd:enumerationvalue = "OUT_OF_SERVICE"/> <xsd:enumerationvalue = "UNKNOWN"/> </xsd:restriction> </xsd:simpleType> <xsd:complexTypename="amazonMetdataType"> <!-- From <a class="jive-link-external-small" href="http://docs.amazonwebservices.com/AWSEC2/latest/DeveloperGuide/index.html?AESDG-chapter-instancedata.html" target="_blank">http://docs.amazonwebservices.com/AWSEC2/latest/DeveloperGuide/index.html?AESDG-chapter-instancedata.html</a> -->
<xsd:all> <xsd:elementname="ami-launch-index"type="xsd:string" /> <xsd:elementname="local-hostname"type="xsd:string" /> <xsd:elementname="availability-zone"type="xsd:string" /> <xsd:elementname="instance-id"type="xsd:string" /> <xsd:elementname="public-ipv4"type="xsd:string" /> <xsd:elementname="public-hostname"type="xsd:string" /> <xsd:elementname="ami-manifest-path"type="xsd:string" /> <xsd:elementname="local-ipv4"type="xsd:string" /> <xsd:elementname="hostname"type="xsd:string"/> <xsd:elementname="ami-id"type="xsd:string" /> <xsd:elementname="instance-type"type="xsd:string" /> </xsd:all> </xsd:complexType> <xsd:complexTypename="appMetadataType"> <xsd:sequence><!-- this is optional application specific name, value metadata --> <xsd:anyminOccurs="0"maxOccurs="unbounded"processContents="skip"/> </xsd:sequence> </xsd:complexType></xsd:schema>
Examples
RENEW / HEARTBEAT
Example : PUT /eureka/apps/MYAPP/i-6589ef6
Response Status:
200 (on success)
404 (eureka doesn't know about you, Register yourself first)
500 (failure)
(If Eureka doesn't get heartbeats from the service node within the evictionDurationInSecs, then the node will get automatically de-registered )