Skip to content

AWS service discovery library for the JVM written in Scala.

License

Notifications You must be signed in to change notification settings

Midas-Technologies-AG/fifi

Repository files navigation

Maven Central

fifi - A Service Discovery Library

Well, the title says it all: this library is about service discovery in general. At the moment it only supports discovering IP addresses for AWS EC2 and ECS, but expect this to expand in the near future.

Discovery statement are GraphQL queries which can be defined in your configuration file. Here is an example to fetch the private IP addresses of all your EC2 instances:

query {
    ec2Instances {
        privateIpAddress
    }
}

There are filters on almost every level. See the EC2 and ECS schema doctest.

Use extractors (e.g. the Ip4Extractor) to get back the bits that interest you from the query. Define both in your configuration file like this:

discovery.aws.region = "eu-central-1"
discovery.extractors = [ "social.midas.discovery.common.Ip4Extractor$" ]
discovery.query = """
query {
  ecsClusters {
    tasks {
      containerInstance {
        ec2Instance {
          privateIpAddress
        }
      }
    }
  }
}
"""

Then you can simply use discoverFromConfig (doc) to get back all IP addresses of your ECS machines.

Library Structure

The library is split into several parts:

  • discovery-common -- common functionality and main interface (doc),
  • discovery-common-aws -- functionality specific for AWS (doc),
  • discovery-aws-ec2 -- defines the EC2 schema (doc),
  • discovery-aws-ecs -- defines the ECS schema (doc).

As ECS runs on EC2 you currently get the whole package by depending on discovery-aws-ecs. The schemata get discovered automatically when they are in the classpath.

About

AWS service discovery library for the JVM written in Scala.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages