Skip to main content

Sceptre shell command resolver

This resolver can be used to execute any shell command.

Why?

This resolver is handy, because it allows you to dynamically resolve parameters at runtime. The beautiful thing about it is that it's infintely extensible! You can use it to connect any command line tool to Sceptre.

Use it in conjunction with the typical unix tools (cat, cut, grep etc...) or third party ones (vault, op, etc...)

Use the !rcmd tag to activate the resolver. You can also use pipe commands, and generic bash (maybe powershell too but I haven't tried it).

The yaml tag !cmd is already used by sceptre hooks, unfortunately it wasn't possible to use the same YAML tag for this custom resolver, so the tag !rcmd was used instead.

Installation

# To install directly from PyPI
pip install sceptre-cmd-resolver

# To install from this git repo
pip install git+https://github.com/Sceptre/sceptre-resolver-cmd.git

Usage / Examples

Use the !rcmd tag to activate the resolver. You can also use pipe commands, and generic bash (perhaps even powershell but I haven't tested it).

# Resolve the contents of a file with cat
parameters:
  DatabasePassword: !rcmd cat .env/dev/password
# Resolve data from a json file with cat + jq
parameters:
  DatabasePassword: !rcmd cat .env/data | jq -r '.Passwords.dev'
# Resolve a secret in vault using the vault CLI (you must be logged in!)
parameters:
  DatabasePassword: !rcmd vault kv get -field=password myapp/database/dev
parameters:
  # Resolve the EC2 AMI Image ID to the latest official version of Ubuntu 20.04 at deploy time
  EC2ImageIdUbuntu: !rcmd >-
    aws ssm get-parameters
      --region eu-west-2
      --names /aws/service/canonical/ubuntu/server/20.04/stable/current/amd64/hvm/ebs-gp2/ami-id
      --query 'Parameters[0].[Value]' --output text

  # Resolve the EC2 AMI Image ID to the latest official version Windows Server 2019 at deploy time
  EC2ImageIdWindows: !rcmd >-
    aws ssm get-parameters
      --region eu-west-2
      --names /aws/service/ami-windows-latest/Windows_Server-2019-English-Full-Base
      | jq -r '.Parameters[0].Value' | jq -r '.image_id'
# Add a human readable comment with the deployment date
parameters:
  DeployNote: !rcmd echo "Deployed by `whoami` on `date` :-)"
# Execute the command with the same AWS profile provided to Sceptre
parameters:
  CanonicalUserId: !rcmd
    command: "aws s3api list-buckets --query Owner.ID --output text"
# Override the command execution with a specific AWS profile, region, and/or sceptre_role
parameters:
  CanonicalUserId: !rcmd
    command: "aws s3api list-buckets --query Owner.ID --output text"
    profile: "my-profile"
    region: "us-west-2"
    sceptre_role: "arn:aws:iam::123456:role/my-role-to-override-the-stack-role"

Metadata

Release files for sceptre-cmd-resolver 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sceptre-cmd-resolver 2.0.0
File Size Uploaded
sceptre-cmd-resolver-2.0.0.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sceptre-cmd-resolver 2.0.0
File Interpreter ABI Platform
sceptre_cmd_resolver-2.0.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 9.0 kB

Release files / sceptre-cmd-resolver-2.0.0.tar.gz

Download URL sceptre-cmd-resolver-2.0.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
155c47e2f4f55c7b6eb64bfe8760174701442ecaddba1a6f5cb7715a1c95be99
BLAKE2b-256 checksum
How to use checksums
6580acb986323af0b3e5e3eb59bb293e6671cdc43ded91620a24a1a58b2e28f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.8

Release files / sceptre_cmd_resolver-2.0.0-py2.py3-none-any.whl

Download URL sceptre_cmd_resolver-2.0.0-py2.py3-none-any.whl
Size 4.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
eea8ce4cfcd9199f726b4280e7e35923c9d4ea5d75cbe4a8ee78c0d6d2996d09
BLAKE2b-256 checksum
How to use checksums
038f465ac4b87e967d9d023aaad7a9595d82e1cfdb5d532c8f50ab046adef0e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.8

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page