Introduction
The Stackolater CLI and API allows you to interact with Stackolater modular stacks. Create environments via Layers and Stacks and orchestrate the creation of those environments. Stackolater is in private BETA.
Authentication
To authorize, use this code:
# Stackolater CLI
sol login
password: opensesame
import sol
api = sol.authorize('opensesame')
# With shell, you can just pass the correct header with each request
curl "https://api.stackolater.com/auth"
-X POST
-H "Authorization: Bearer opensesame"
Make sure to replace
opensesamewith your API key.
Stackolater uses Bearer Tokens to authenticate requests to the API. You can retrieve a JWT-encoded API Bearer Token by sending a POST request to the /auth endpoint with a Basic Auth Base64-encoded credential string.
Stackolater API credentials can be changed in the developer portal.
Stackolater expects the API token to be included in all API requests to the server in a header that looks like the following:
Authorization: Bearer opensesame
Layers
List Layers
# Stackolater CLI
sol layer list
import sol
api = sol.authorize('opensesame')
api.layer.list()
curl "http://api.stackolater.com/api/v1/layers/list"
-H "Authorization: Bearer opensesame"
The above command returns JSON structured like this:
{
"Layers": [
{
"LayerName": "core",
"Description": "The CORE VPC Layer",
"Components": [
{
"StackName": "vpc",
"Component": "vpc"
}
]
},
{
"LayerName": "network",
"Description": "The Network Layer",
"Depends": "core",
"EnvironmentSpecific": true,
"Components": [
{
"StackName": "subnets",
"Component": "subnets"
}
]
}
]
}
This endpoint lists all the available layers configured across environments.
HTTP Request
GET https://api.stackolater.com/api/v1/layers
Build a Specific Layer
sol layer build -l=<layer> [--environment=<environment>] [--component=<component>] [--account=<account>]
import sol
api = sol.authorize('opensesame')
api.layer.build('DB')
curl "https://api.stackolater.com/api/v1/layers/build"
-X POST
-H "Authorization: Bearer opensesame"
The above command returns JSON structured like this:
{
"id": 2,
"layer": "core",
"status": "created"
}
This endpoint builds a specific layer in the specified account.
HTTP Request
POST http://api.atackolater.com/api/v1/layers/build/
URL Parameters
| Parameter | Description |
|---|---|
| layer | The Name of the layer to build |
| environment | The Name of the environment |
| component | The Name of the component (optional) |
| account | AWS Account id or alias |
Destroy a Specific Layer
sol layer destroy -l=<layer> [--environment=<environment>] [--account=<account>]
import sol
api = sol.authorize('opensesame')
api.layers.destroy('DB')
curl "https://api.stackolater.com/api/v1/layers/destroy"
-X DELETE
-H "Authorization: Bearer opensesame"
The above command returns JSON structured like this:
{
"id": 2,
"destroyed" : "DB"
}
This endpoint deletes a specific kitten.
HTTP Request
DELETE http://api.stackolater.com/api/v1/layers/destroy
URL Parameters
| Parameter | Description |
|---|---|
| layer | The Name of the layer to destroy |
| environment | The Name of the environment |
| account | AWS Account id or alias |
Get the Status of a Specific Layer
# Stackolater CLI
sol layer status -l=<layer> [--environment=<environment>] [--account=<account>]
Stack mysql, for environment dev, component mysql (dev-mysql) is RUNNING
Stack aurora, for environment dev, component aurora (dev-mysql) is RUNNING
import sol
api = sol.authorize('opensesame')
api.layers.status('DB')
curl "https://api.stackolater.com/api/v1/layers/status"
-X GET
-H "Authorization: Bearer opensesame"
The above command returns JSON structured like this:
{
"id": 2,
"layer" : "DB",
"environment": "dev",
"components": [
{
"component": "mysql",
"stack": "mysql",
"status": "RUNNING"
},
{
"component": "aurora",
"stack": "aurora",
"status": "RUNNING"
}
]
}
This endpoint deletes a specific kitten.
HTTP Request
DELETE http://api.stackolater.com/api/v1/layers/destroy
URL Parameters
| Parameter | Description |
|---|---|
| layer | The Name of the layer to destroy |
| environment | The Name of the environment |
| account | AWS Account id or alias |
Stacks
Create Stack
# Stackolater CLI
sol create-stack -s mysql -e dev -v core
import sol
api = sol.authorize('opensesame')
api.stack.create()
curl "http://api.stackolater.com/api/v1/stack/create"
-H "Authorization: Bearer opensesame"
The above command returns JSON structured like this:
{
"id": 2,
"stack": "mysql",
"status": "created"
}
This endpoint creates a specific stack on a specified AWS account
HTTP Request
POST https://api.stackolater.com/api/v1/stack/create
URL Parameters
| Parameter | Description |
|---|---|
| stack | The Name of the stack to create |
| environment | The Name of the environment |
| account | AWS Account id or alias |
Delete Stack
# Stackolater CLI
sol delete-stack -s mysql -e dev -v core
import sol
api = sol.authorize('opensesame')
api.stack.delete()
curl "http://api.stackolater.com/api/v1/stack/delete"
-H "Authorization: Bearer opensesame"
The above command returns JSON structured like this:
{
"id": 2,
"stack": "mysql",
"status": "deleted"
}
This endpoint deletes a specific stack on a specified AWS account
HTTP Request
POST https://api.stackolater.com/api/v1/stack/create
URL Parameters
| Parameter | Description |
|---|---|
| stack | The Name of the stack to create |
| environment | The Name of the environment |
| account | AWS Account id or alias |
Validate a Stack Template
# Stackolater CLI
sol validate-template -s mysql
import sol
api = sol.authorize('opensesame')
api.stack.validate('mysql')
curl "http://api.stackolater.com/api/v1/stack/validate"
-H "Authorization: Bearer opensesame"
The above command returns JSON structured like this:
{
"id": 2,
"stack": "mysql",
"status": "valid"
}
This endpoint validates a specific stack template
HTTP Request
POST https://api.stackolater.com/api/v1/stack/validate
URL Parameters
| Parameter | Description |
|---|---|
| stack | The Name of the stack to create |
Bastions
Build a Bastion Stack
# Stackolater CLI
sol bastion build -v core -a development
import sol
api = sol.authorize('opensesame')
api.bastion.build('core', 'development')
curl "http://api.stackolater.com/api/v1/bastion/build"
-H "Authorization: Bearer opensesame"
The above command returns JSON structured like this:
{
"id": 2,
"stack": "bastion",
"vpc": "core",
"account": "development",
"status": "created"
}
This endpoint builds a bastion stack on a specified AWS account in th especified vpc.
HTTP Request
POST https://api.stackolater.com/api/v1/bastion/create
URL Parameters
| Parameter | Description |
|---|---|
| vpc | The VPC to build the bastion in. |
| account | AWS Account id or alias |
Destroy Bastion Stack
# Stackolater CLI
sol bastion destroy -v core -a development
import sol
api = sol.authorize('opensesame')
api.bastion.destroy('core', 'development')
curl "http://api.stackolater.com/api/v1/bastion/destroy"
-H "Authorization: Bearer opensesame"
The above command returns JSON structured like this:
{
"id": 2,
"stack": "bastion",
"vpc": "core",
"account": "development",
"status": "deleted"
}
This endpoint deletes a specific stack on a specified AWS account
HTTP Request
POST https://api.stackolater.com/api/v1/bastion/destroy
URL Parameters
| Parameter | Description |
|---|---|
| vpc | The VPC to build the bastion in. |
| account | AWS Account id or alias |
Show bastion status
# Stackolater CLI
sol bastion show -v core -a development
import sol
api = sol.authorize('opensesame')
api.bastion.show('core', 'development')
curl "http://api.stackolater.com/api/v1/bastion/show"
-H "Authorization: Bearer opensesame"
The above command returns JSON structured like this:
{
"id": 2,
"stack": "bastion",
"vpc": "core",
"account": "development",
"status": "RUNNING"
}
This endpoint shows the status of a specified bastion
HTTP Request
GET https://api.stackolater.com/api/v1/bastion/status
URL Parameters
| Parameter | Description |
|---|---|
| vpc | The VPC to build the bastion in. |
| account | AWS Account id or alias |
Errors
The Kittn API uses the following error codes:
| Error Code | Meaning |
|---|---|
| 400 | Bad Request -- Your request is invalid. |
| 401 | Unauthorized -- Your API key is wrong. |
| 403 | Forbidden -- The kitten requested is hidden for administrators only. |
| 404 | Not Found -- The specified kitten could not be found. |
| 405 | Method Not Allowed -- You tried to access a kitten with an invalid method. |
| 406 | Not Acceptable -- You requested a format that isn't json. |
| 410 | Gone -- The kitten requested has been removed from our servers. |
| 418 | I'm a teapot. |
| 429 | Too Many Requests -- You're requesting too many kittens! Slow down! |
| 500 | Internal Server Error -- We had a problem with our server. Try again later. |
| 503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |