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
    depends_on: [auth-service]
    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
  • 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
    depends_on: [vpc-stack]
    params:
      VpcId: ${{ stacks.vpc-stack.outputs.VpcId }}
      SubnetIds: ${{ stacks.vpc-stack.outputs.PrivateSubnetIds }}
      
  - id: api-stack
    dir: ./application/api
    depends_on: [database-stack]
    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' }}

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

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.6.1.tar.gz (92.2 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.6.1-py3-none-any.whl (68.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for samstacks-0.6.1.tar.gz
Algorithm Hash digest
SHA256 577e743ca29a39e76a57372ab39b8d1fe99f3e740932897d9cdca53822db34b8
MD5 0e3e51619fed4ea4ec2d901aad00f0a0
BLAKE2b-256 20ee1b1562e488b47ed81c2bcd62adc3148406b3470838142dafc7850a01c9df

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for samstacks-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2cf9f5336854c173083c4d17d6f67d12a3bd7c6cd9cbb081c9f6e1eed9a2abc
MD5 3b8dfcb45a4bc0111154e348aec92c30
BLAKE2b-256 4d3e43096e1da6eea528a6f7775c95e725af0e0b481b3b3c5dc6bf453ed59723

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