How to deploy AWS elasticsearch using serverless.yml
You can add CloudFormation resources to the "resources" section. For ElasticSearch this would look something like this.
service: aws-nodejsprovider: name: aws runtime: nodejs6.10functions: hello: handler: handler.hello environment: elasticURL: Fn::GetAtt: [ ElasticSearchInstance , DomainEndpoint ]resources: Resources: ElasticSearchInstance: Type: AWS::Elasticsearch::Domain Properties: EBSOptions: EBSEnabled: true VolumeType: gp2 VolumeSize: 10 ElasticsearchClusterConfig: InstanceType: t2.small.elasticsearch InstanceCount: 1 DedicatedMasterEnabled: false ZoneAwarenessEnabled: false ElasticsearchVersion: 5.3
to add to Jens' answer, you might want the output
you can add this to your serverless.yml
config
Outputs: DomainArn: Value: !GetAtt ElasticsearchDomain.DomainArn DomainEndpoint: Value: !GetAtt ElasticsearchDomain.DomainEndpoint SecurityGroupId: Value: !Ref mySecurityGroup SubnetId: Value: !Ref subnet