Command Line Interface

Sceptre can be used as a command line tool. Running Sceptre without a sub-command will display help, showing a list of the available commands.

Running Sceptre without a subcommand will display help, showing a list of the available commands.

Autocomplete

If you are using Bash you can enable autocomplete by entering the following command eval "$(_SCEPTRE_COMPLETE=source sceptre)". Autocomplete will work for subcommands and parameters.

Export Stack Outputs to Environment Variables

Stack outputs can be exported as environment variables with the command:

eval $(sceptre --ignore-dependencies list outputs STACKGROUP/STACK.yaml --export=envvar)

Note that Sceptre prepends the string SCEPTRE_ to the name of the environment variable:

env | grep SCEPTRE
SCEPTRE_<output_name>=<output_value>

Variable Handling

You can pass variables into your project using --var-file and --var.

Varibles passed in with --var will overwrite any matching variables specified in --var-file. If you use multiple --var flags then the right-most --var will overwrite any matching --vars to the left. For example, in the following command

sceptre --var var1=one --var var2=two --var var1=three launch stack

var1 will equal three.

You can also use --var to overwrite nested keys in a --var-file. For example, given a variable file “vars.yaml”:

# vars.yaml
---
top:
  middle:
    nested: hello
  middle2:
    nested: world

we could overwrite nested: hello to nested: hi using:

sceptre --var-file vars.yaml --var top.middle2.nested=hi launch stack

Note

Sceptre will load your entire project to build a full dependency graph. This means that all stacks that use variables will need to have a value provided to them - even if they are not in your command_path or are not a dependency. Using a –var-file with all variables set can help meet this requirement.

Command reference

Command options differ depending on the command, and can be found by running:

sceptre
sceptre --help
sceptre COMMAND --help

sceptre

Sceptre is a tool to manage your cloud native infrastructure deployments.

sceptre [OPTIONS] COMMAND [ARGS]...

Options

--version

Show the version and exit.

--debug

Turn on debug logging.

--dir <directory>

Specify sceptre directory.

--output <output>

The formatting style for command output.

--no-colour

Turn off output colouring.

--var <var>

A variable to template into config files.

--var-file <var_file>

A YAML file of variables to template into config files.

--ignore-dependencies

Ignore dependencies when executing command.

create

Creates a stack for a given config PATH. Or if CHANGE_SET_NAME is specified creates a change set for stack in PATH.

sceptre create [OPTIONS] PATH [CHANGE_SET_NAME]

Options

-y, --yes

Assume yes to all questions.

Arguments

PATH

Required argument

CHANGE_SET_NAME

Optional argument

delete

Deletes a stack for a given config PATH. Or if CHANGE_SET_NAME is specified deletes a change set for stack in PATH.

sceptre delete [OPTIONS] PATH [CHANGE_SET_NAME]

Options

-y, --yes

Assume yes to all questions.

Arguments

PATH

Required argument

CHANGE_SET_NAME

Optional argument

describe

Commands for describing attributes of stacks.

sceptre describe [OPTIONS] COMMAND [ARGS]...
change-set

Describes the change set.

sceptre describe change-set [OPTIONS] PATH CHANGE_SET_NAME

Options

-v, --verbose

Display verbose output.

Arguments

PATH

Required argument

CHANGE_SET_NAME

Required argument

policy

Displays the stack policy used.

sceptre describe policy [OPTIONS] PATH

Arguments

PATH

Required argument

estimate-cost

Prints a URI to STOUT that provides an estimated cost based on the resources in the stack. This command will also attempt to open a web browser with the returned URI.

sceptre estimate-cost [OPTIONS] PATH

Arguments

PATH

Required argument

execute

Executes a Change Set.

sceptre execute [OPTIONS] PATH CHANGE_SET_NAME

Options

-y, --yes

Assume yes to all questions.

Arguments

PATH

Required argument

CHANGE_SET_NAME

Required argument

generate

Prints the template used for stack in PATH.

sceptre generate [OPTIONS] PATH

Arguments

PATH

Required argument

launch

Launch a Stack or StackGroup for a given config PATH.

sceptre launch [OPTIONS] PATH

Options

-y, --yes

Assume yes to all questions.

Arguments

PATH

Required argument

list

Commands for listing attributes of stacks.

sceptre list [OPTIONS] COMMAND [ARGS]...
change-sets

List change sets for stack.

sceptre list change-sets [OPTIONS] PATH

Arguments

PATH

Required argument

outputs

List outputs for stack.

sceptre list outputs [OPTIONS] PATH

Options

-e, --export <export>

Specify the export formatting.

Arguments

PATH

Required argument

resources

List resources for stack or stack_group.

sceptre list resources [OPTIONS] PATH

Arguments

PATH

Required argument

new

Commands for initialising Sceptre projects.

sceptre new [OPTIONS] COMMAND [ARGS]...
group

Creates StackGroup folder in the project and a config.yaml with any required properties.

sceptre new group [OPTIONS] STACK_GROUP

Arguments

STACK_GROUP

Required argument

project

Creates PROJECT_NAME project folder and a config.yaml with any required properties.

sceptre new project [OPTIONS] PROJECT_NAME

Arguments

PROJECT_NAME

Required argument

set-policy

Sets a specific Stack policy for either a file or using a built-in policy.

sceptre set-policy [OPTIONS] PATH [POLICY_FILE]

Options

-b, --built-in <built_in>

Specify a built in stack policy.

Arguments

PATH

Required argument

POLICY_FILE

Optional argument

status

Prints the stack status or the status of the stacks within a stack_group for a given config PATH.

sceptre status [OPTIONS] PATH

Arguments

PATH

Required argument

update

Updates a stack for a given config PATH. Or perform an update via change-set when the change-set flag is set.

sceptre update [OPTIONS] PATH

Options

-c, --change-set

Create a change set before updating.

-v, --verbose

Display verbose output.

-y, --yes

Assume yes to all questions.

Arguments

PATH

Required argument

validate

Validates the template used for stack in PATH.

sceptre validate [OPTIONS] PATH

Arguments

PATH

Required argument