CloudFormation Custom Resources for online.net ARM servers
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENCE
Procfile
README.md
index.js
package.json

README.md

OnlineLabs Cloudformation

This projects allows you to include OnlineLabs Resources in your CloudFormation stacks

Resources

The library currently implements Create and Delete requests for the following resources

  • Servers
  • Volumes

Usage

In order to create Custom CloudFormation resources you will have to include a SNS resource in your stack definition and add an http subscriber to that resource that points to a server running this project.

You can either run your own or try it using the already deployed version here https://onlinelabs-cloudformation.herokuapp.com

The Properties object defined in the cloudformation stack is passed as-is to the onlinelabs API except for the ServiceToken, which is used by AWS to send the messages, and AuthToken which gets converted to the X-Auth-Token header in the requests hitting the onlinelabs API.

Examples

Here is an example stack that starts a server

{
	"Resources": {
		"OnlineLabs": {
			"Type": "AWS::SNS::Topic",
			"Properties": {
				"Subscription": [{ "Endpoint": "https://onlinelabs-cloudformation.herokuapp.com", "Protocol": "https" }]
			}
		},

		"MyARMServer": {
			"Type": "Custom::OnlineLabs-Server",
			"Properties": {
				"ServiceToken": { "Ref": "OnlineLabs" },
				"AuthToken": "<YOUR AUTH TOKEN>",

				"name": "MyARMServer",
				"organization": "<YOUR ORGANIZATION UUID>",
				"image": "<IMAGE UUID>",
			}
		}
	}
}

Here is an example stack that starts a server that also has an additional volume attached

{
	"Resources": {
		"OnlineLabs": {
			"Type": "AWS::SNS::Topic",
			"Properties": {
				"Subscription": [{ "Endpoint": "https://onlinelabs-cloudformation.herokuapp.com", "Protocol": "https" }]
			}
		},

		"MyARMVolume": {
			"Type": "Custom::OnlineLabs-Volume",
			"Properties": {
				"ServiceToken": { "Ref": "OnlineLabs" },
				"AuthToken": "<YOUR ONLINELABS AUTH TOKEN>",

				"name": "MyVolume",
				"organization": "<YOUR ORGANIZATION UUID>",
				"volume_type": "l_ssd",
				"size": 10000000000
			}
		},

		"MyARMServer": {
			"Type": "Custom::OnlineLabs-Server",
			"Properties": {
				"ServiceToken": { "Ref": "OnlineLabs" },
				"AuthToken": "<YOUR ONLINELABS AUTH TOKEN>",

				"name": "MyARMServer",
				"organization": "<YOUR ORGANIZATION UUID>",
				"image": "<IMAGE UUID>",

				"volumes": {
					"1": { "Ref": "MyARMVolume" }
				}
			}
		}
	}
}

Support

If you're having any problem, please raise an issue on GitHub.

TODO

  • Support IPs
  • Support Snapshots
  • Support updating of resources

License

The project is licensed under the MIT license.