Skip to content
Simon Caplette edited this page Feb 14, 2017 · 26 revisions

Templates

awless writing operations to the cloud infrastructure relies on the concepts of templates. A template in awless describes a list of actions updating the cloud. For instance, this would be a one-liner template:

create instance subnet=subnet-356d517f image=ami-70edb016 type=t2.micro

This one line template contains an action create on an entity followed by a list of params.

Parameters can be either:

  • given directly through the command line as key=value arguments
  • filled transparently filled by your local config defaults (i.e: instance ami, instance type, etc...)
  • completed through dynamic CLI prompting for missing required arguments

Under the hood, an awless template is parsed with a parsing expression grammar in order to build an abstract syntax tree. Then the AST is traversed by a given cloud driver (i.e: AWS aws-sdk-go) to perform the action against the cloud

awless templates are used with shortcut commands (for example, awless create instance) or by launching a template file with awless run.

Commands

awless provides multiple shortcut commands to edit the cloud infrastructure using templates:

  • awless create allow to create a cloud resource (ex: instance, vpc, user, ssh keypair, routetable...). It may requires multiple parameters in order to create the resource.
  • awless delete allow to delete a cloud resource. It generally requires only the id of the resource to delete.
  • awless update allow to update a cloud resource property after its creation. It requires at least the id of the resource to update and to set the property to update.
  • awless attach allow to attach a cloud resource (for example, a volume) to another (for example an instance). It generally requires the id of those two cloud resources.
  • awless detach allow to attach two attached cloud resources.
  • awless start allow to start a cloud resource (for example, an instance). It requires the id of the resource to start.
  • awless stop allow to stop a cloud resource (for example, an instance). It requires the id of the resource to stop.

Template file

awless can also load more complex templates combining multiple commands in a template file.

Clone this wiki locally