Skip to main content

A YAML driven pipeline of AWS SAM stacks inspired by GitHub Actions.

Project description

samstacks

Declarative infrastructure orchestration for AWS SAM deployments.

PyPI version Build Status Documentation

Deploy multi-stack AWS SAM applications using YAML pipelines with GitHub Actions-style syntax and automatic dependency resolution.

[!WARNING] Alpha Software Notice: samstacks is currently in alpha development. While functional and actively used, the API and configuration format may change between versions. We welcome feedback, bug reports, and contributions as we work toward a stable release.

Why samstacks?

Managing multiple related AWS SAM stacks can be complex when you need to:

  • Deploy stacks in the correct order based on dependencies
  • Pass outputs from one stack as parameters to another
  • Manage environment-specific configurations
  • Coordinate deployments across teams

samstacks solves this by letting you define your entire multi-stack deployment as a single YAML pipeline.

Quick Start

1. Install and run immediately:

uvx samstacks deploy pipeline.yml

No installation required with uvx!

2. Create a pipeline manifest:

# pipeline.yml
pipeline_name: E-commerce Platform
pipeline_description: Backend API with user authentication

stacks:
  - id: auth-service
    dir: ./services/auth
    
  - id: product-api
    dir: ./services/products
    params:
      AuthServiceUrl: ${{ stacks.auth-service.outputs.ServiceUrl }}
      DatabaseUrl: ${{ env.DATABASE_URL }}

3. Deploy your infrastructure:

uvx samstacks deploy pipeline.yml

samstacks automatically:

  • Analyzes dependencies between stacks
  • Deploys auth-service first, then product-api
  • Passes the auth service URL to the product API
  • Provides detailed deployment reporting

Key Features

  • Declarative pipeline configuration - Define deployment sequences using YAML manifests
  • GitHub Actions compatibility - Leverage familiar ${{ env.VAR }} syntax and expressions
  • Intelligent dependency resolution - Automatic stack ordering based on output dependencies
  • Multi-environment support - Environment-specific parameters and conditional deployment
  • Security-focused output masking - Automatically mask sensitive data like AWS account IDs, API endpoints, and database URLs in deployment outputs
  • Comprehensive validation - Catch configuration errors before deployment
  • Native AWS SAM integration - Works with existing SAM templates and configurations

Installation Options

Recommended - Run without installing:

uvx samstacks --help
uvx samstacks deploy pipeline.yml

Traditional installation:

pip install samstacks
samstacks --help

Common Use Cases

Cross-Stack Dependencies

stacks:
  - id: vpc-stack
    dir: ./infrastructure/vpc
    
  - id: database-stack  
    dir: ./infrastructure/database
    params:
      VpcId: ${{ stacks.vpc-stack.outputs.VpcId }}
      SubnetIds: ${{ stacks.vpc-stack.outputs.PrivateSubnetIds }}
      
  - id: api-stack
    dir: ./application/api
    params:
      DatabaseUrl: ${{ stacks.database-stack.outputs.ConnectionString }}

Environment-Specific Deployment

pipeline_settings:
  stack_name_prefix: ${{ env.ENVIRONMENT }}-myapp
  inputs:
    environment:
      type: string
      default: dev

stacks:
  - id: app-stack
    dir: ./app
    if: ${{ inputs.environment != 'local' }}
    params:
      Environment: ${{ inputs.environment }}
      InstanceType: ${{ inputs.environment == 'prod' && 't3.large' || 't3.micro' }}

Security-Focused Output Masking

pipeline_settings:
  # Enable comprehensive output masking for security (all categories enabled by default)
  output_masking:
    enabled: true

stacks:
  - id: lambda-stack
    dir: ./lambda

Before masking:

ProcessorFunctionArn: arn:aws:lambda:us-west-2:123456789012:function:my-function

After masking:

ProcessorFunctionArn: arn:aws:lambda:us-west-2:************:function:my-function

This feature protects sensitive data including AWS account IDs, API endpoints, database URLs, load balancer DNS, CloudFront domains, IP addresses, and custom patterns in:

  • Console deployment outputs
  • Markdown deployment reports
  • Pipeline summaries
  • CI/CD logs and artifacts

CLI Commands

Deploy Pipeline

samstacks deploy pipeline.yml

Validate Configuration

samstacks validate pipeline.yml

Delete All Stacks

samstacks delete pipeline.yml

Bootstrap Existing Project

samstacks bootstrap ./my-sam-project

Prerequisites

  • Python 3.8+ - Check with python --version
  • AWS CLI - Configured with appropriate permissions (aws sts get-caller-identity)
  • SAM CLI - For template validation and deployment (sam --version)

Real-World Example

Check out our complete example showcasing:

  • S3 bucket notifications to SQS
  • Lambda processing with dependencies
  • Cross-stack parameter passing
  • Conditional deployment logic
  • Post-deployment automation
git clone https://github.com/dev7a/samstacks.git
cd samstacks
uvx samstacks deploy examples/pipeline.yml

This example includes comprehensive security masking enabled by default.

Documentation

Complete Documentation

Our comprehensive documentation includes:

Contributing

Contributions are welcome! Please see our Contributing Guidelines for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

samstacks-0.7.0.tar.gz (101.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

samstacks-0.7.0-py3-none-any.whl (73.3 kB view details)

Uploaded Python 3

File details

Details for the file samstacks-0.7.0.tar.gz.

File metadata

  • Download URL: samstacks-0.7.0.tar.gz
  • Upload date:
  • Size: 101.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for samstacks-0.7.0.tar.gz
Algorithm Hash digest
SHA256 34079f1507e7b3317e6faf497864f883a5bb2645f45a5ab453489c43ca54530d
MD5 fa70939d727099dbcac637fcc27f57c3
BLAKE2b-256 e092da67a4baa0eb68a96f87e97f74842d24d3ec9239cbea93a8da077000c4db

See more details on using hashes here.

File details

Details for the file samstacks-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: samstacks-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 73.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for samstacks-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20180c0dfae955d6c50d281aff73d7c249c052c4c56c5583a5b73e4835095df3
MD5 572db865052e723b27fcf9f8eb464a41
BLAKE2b-256 64ee29e858a12d776b0654c13778fb53d04c0e7b71d87e9c5c43bb4d14efa55f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page