This library is a Serverless plugin which allows for easy creation and configuration of Cloudmap services.
Cloudmap is an AWS tool for service discovery, and servide metadata. This is useful, as you can register your Lambda functions, DynamoDB tables, Elasticache instances and just about anything else in a serverless, highly available metadata store.
Imagine being able to resolve the location of any of your lambda functions with a user friendly name, such as create.user.
serverless.yml
custom:
cloudmap:
services:
- cfname: 'UserService'# Cloudformation friendly namename: 'user-service'# Service namenamespace: 'namespace-id'# Reference to a namespace IDdescription: 'Some description'instances:
- cfname: 'UserCreateInstance'# Cloudformation friendly namename: 'create'# Individual, friendly function nameid: 'create-123'# Unique ID (optional, can be used instead of name)arn: 'arn::etc'# Arn or reference to your individual serverless functionconfig:
retries: 3# Additional configuration or metadataYou can utilise this plugin with some additional libraries created to provide a rich application framework feel to AWS + Serverless.
- JavaScript: https://github.com/peak-ai/ais-service-discovery-js
- Golang: https://github.com/peak-ai/ais-service-discovery-go
Once you've registered your Lambda functions/services, you can then call them with the above libraries:
constres=awaitDiscovery.request('user-service->create',user);// Calls a Lambda default.user-service.create (namespace.service.instance).awaitDiscovery.queue('new-users',user);// Puts a message on an SQS Queue- Generate namespaces