AWS CloudFormation provides developers and systems administrators an easy way to create and manage a collection of related AWS resources while provisioning and updating those resources in an orderly and predictable fashion.

Cloud Formation custom resources

Custom resources enable writing custom provisioning in AWS CloudFormation templates. To include resources that aren’t available as AWS CloudFormation resource types, such as Spotinst’s Elastigroup, use the Custom Resource string.

Custom resources require one property: the service token, which specifies where AWS CloudFormation sends requests to, such as an Amazon SNS topic.

AWS Lambda-backed Custom Resources

When associating a Lambda function with a custom resource, the function is invoked whenever the custom resource is created, updated, or deleted. AWS CloudFormation calls a Lambda API to invoke the function and pass all the request data (such as the request type and resource properties) to the function.

So how does the integration with Elastigroup work?

Spotinst uses Custom::Resource in your Cloud Formation templates which use a triggers AWS Lambda function to communicate with the Spotinst API. 

This Lambda function is hosted by Spotinst and can be invoked by every Spotinst customer