Skip to content

CLI reference

alarm list

stacktape alarm list shows the CloudWatch alarms of a deployed stage and their current state, so you can see what is firing without opening the AWS console. It lists the alarms whose names start with the stack name, such as the alarms your config defines. It needs AWS credentials and works without a Stacktape account.

Usage

stacktape alarm list --stage prod --region eu-west-1

For each alarm you get its name, the Stacktape resource it belongs to, its state, the metric, threshold and comparison, and when the state last changed. A firing alarm also shows why.

StateMeaning
OKThe metric is within the threshold.
ALARMThe metric crossed the threshold for the required number of periods.
INSUFFICIENT_DATANot enough data yet, common for a new alarm or a resource without traffic.

Filter by resource or state

Firing alarms of one resource:

stacktape alarm list --stage prod --region eu-west-1 --resource-name myApi --state ALARM

--resource-name takes the resource name from your config. --state takes OK, ALARM or INSUFFICIENT_DATA.

Check from a script

With --agent, the command prints NDJSON: one JSON object per line. The list arrives as JSON text in the message of a log line, as { "alarms": [...] }, and each alarm has name, resource, state, metric, threshold, comparison, lastUpdated and, when firing, reason. This prints how many alarms are firing:

stacktape alarm list --stage prod --region eu-west-1 --state ALARM --agent \  | jq 'select(.type == "log") | .message | fromjson? | .alarms | length'

Legacy alarm rules that were created in the Console, not in your config, move into the config with alarm export.

Options

stacktape alarm list10 options
  • -r, --regionRequiredstring
    The AWS region for the operation.

    For a list of available regions, see the AWS documentation.

    Inside a project whose config declares region, the flag is optional and overrides the config.

    21 allowed values: us-east-2us-east-1us-west-1us-west-2ap-east-1ap-south-1
    Show all ap-northeast-3ap-northeast-2ap-southeast-1ap-southeast-2ap-northeast-1ca-central-1eu-central-1eu-west-1eu-west-2eu-west-3eu-north-1me-south-1sa-east-1af-south-1eu-south-1
  • -s, --stageRequiredstring
    The stage for the operation (e.g., production, staging, dev-john).

    You can set a default stage using the defaults set command. Stage names use lowercase letters, numbers and dashes, with at least 2 characters. The project name, a dash and the stage form the CloudFormation stack name, which can have at most 128 characters. Stacktape shortens an AWS resource name that would be too long and adds a hash.

  • The name of the AWS account to use for the operation.

    The account must first be connected in the Stacktape Console.

    Without it, the account is chosen by --profile, AWS_PROFILE or AWS credentials in environment variables, then by your saved default, then by your organization's only connected account. --aws-account takes precedence over all of them, but AWS credentials in environment variables must then belong to that account.

  • If provided, the command will not execute and will instead print help information.

  • --log-level"info" | "debug" | "error"
    Log Level

    The level of logs to print to the console.

    • info: Basic information about the operation.
    • error: Only errors.
    • debug: Detailed information for debugging.
  • The AWS profile to use for the command.

    You can manage profiles using the aws-profile:* commands and set a default profile with defaults set.

    For commands that use a connected AWS account, --profile (or AWS_PROFILE) selects the connected account the profile belongs to, unless --aws-account is set. The command fails if that account is not connected.

  • --projectstring
    The name of the Stacktape project for this operation.

    Commands that target a stack take it from projectName in the project's config when the flag is absent.

  • --quietboolean
    Hide progress, banners, success messages and hints.

    Command output, warnings and errors are still printed.

  • The name of the resource as defined in your Stacktape configuration.

  • --statestring

    Filter alarms by state: OK, ALARM, or INSUFFICIENT_DATA.

  • metrics shows the metric behind an alarm over time.
  • logs shows the requests and errors behind it.
  • alarm export moves legacy Console alarm rules into your config.