### Install samstacks using uvx Source: https://context7_llms Demonstrates the quickest way to run samstacks without local installation or virtual environment setup using uvx. ```Bash uvx samstacks deploy pipeline.yml ``` -------------------------------- ### Clone and Deploy Samstacks Example Pipeline Source: https://context7_llms This command sequence provides instructions on how to clone the samstacks repository and navigate into its directory to prepare for deploying the example pipeline. ```Bash git clone https://github.com/dev7a/samstacks.git cd samstacks ``` -------------------------------- ### Install Samstacks Locally with pip Source: https://context7_llms This section details the process of installing samstacks in a Python virtual environment using `pip`. It covers creating the virtual environment, activating it, installing samstacks, and verifying the installation. ```Bash python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate pip install samstacks samstacks --help ``` -------------------------------- ### Install Samstacks Locally with uv Source: https://context7_llms This method outlines how to install samstacks within a Python virtual environment using `uv`. It includes steps for creating the environment, activating it, installing samstacks, and verifying the installation. ```Bash uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate uv pip install samstacks samstacks --help ``` -------------------------------- ### Complete Multi-Tier Application Deployment Example Source: https://context7_llms This comprehensive YAML example demonstrates a multi-tier application deployment using samstacks, including network, database, and API stacks, with conditional deployments, cross-stack references, and input parameter usage. ```YAML pipeline_name: Multi-Tier Application pipeline_description: Web application with database and API pipeline_settings: stack_name_prefix: myapp- default_region: us-west-2 inputs: environment: type: string default: development stacks: - id: network dir: infrastructure/network params: Environment: ${{ inputs.environment }} - id: database dir: infrastructure/database if: ${{ inputs.environment != 'test' }} params: VpcId: ${{ stacks.network.outputs.VpcId }} SubnetIds: ${{ stacks.network.outputs.PrivateSubnetIds }} - id: api dir: application/api params: DatabaseUrl: ${{ stacks.database.outputs.ConnectionString }} Environment: ${{ inputs.environment }} run: |- echo "API deployed to: ${{ stacks.api.outputs.ApiUrl }}" ``` -------------------------------- ### Quick Run Samstacks with uvx Source: https://context7_llms This section demonstrates how to quickly execute samstacks commands using `uvx` without a full installation. It shows how to check the samstacks version and deploy a pipeline directly. ```Bash uvx samstacks --help uvx samstacks deploy pipeline.yml ``` -------------------------------- ### Integrate samstacks into CI/CD Pipelines Source: https://context7_llms Provides an example of how to use samstacks within a GitHub Actions workflow for automated deployment of SAM stacks. ```YAML # GitHub Actions example - name: Deploy SAM stacks run: uvx samstacks deploy pipeline.yml ``` -------------------------------- ### Using Input Parameters in samstacks Expressions Source: https://context7_llms This example illustrates how to utilize pipeline input parameters within samstacks expressions, allowing for dynamic configuration based on user-defined inputs. ```YAML params: InstanceType: ${{ inputs.instance_type }} ``` -------------------------------- ### Execute Commands After samstacks Deployment Source: https://context7_llms Shows how to use the `run` field to execute arbitrary shell commands after a stack has been deployed, useful for post-deployment validation or setup. ```YAML stacks: - id: api dir: ./api run: |- echo "API URL: ${{ stacks.api.outputs.ApiUrl }}" curl -f "${{ stacks.api.outputs.ApiUrl }}/health" ``` -------------------------------- ### Applying Conditional Logic in samstacks Expressions Source: https://context7_llms This example demonstrates how to use conditional expressions (e.g., equality checks) to control stack deployment or parameter values based on environment variables or input parameters. ```YAML if: ${{ env.ENVIRONMENT == 'production' }} if: ${{ inputs.deploy_database == 'true' }} ``` -------------------------------- ### Performing Mathematical Operations in samstacks Expressions Source: https://context7_llms This example shows how to use basic mathematical operations (multiplication, addition) within samstacks expressions to derive parameter values dynamically. ```YAML params: DesiredCapacity: ${{ inputs.base_capacity * 2 }} MaxSize: ${{ inputs.base_capacity + 10 }} ``` -------------------------------- ### Defining Individual Stacks in samstacks Pipeline Source: https://context7_llms This YAML example illustrates how to define an individual deployment stack within a samstacks pipeline. It includes properties like a unique ID, directory for the SAM template, conditional deployment logic, stack parameters, and post-deployment run commands. ```YAML stacks: - id: network # Unique stack identifier dir: infrastructure/network # Directory containing SAM template if: ${{ env.DEPLOY_NETWORK }} # Conditional deployment params: # Stack parameters Environment: ${{ inputs.environment }} run: |- echo "Network deployed successfully" ``` -------------------------------- ### Accessing Stack Outputs in samstacks Expressions Source: https://context7_llms This example shows how to reference outputs from other deployed stacks within samstacks expressions, enabling cross-stack data flow. ```YAML params: VpcId: ${{ stacks.network.outputs.VpcId }} DatabaseUrl: ${{ stacks.database.outputs.ConnectionString }} ``` -------------------------------- ### Using Environment Variables in samstacks Expressions Source: https://context7_llms This example demonstrates how to access environment variables within samstacks expressions, providing a default value if the variable is not set. ```YAML params: Environment: ${{ env.ENVIRONMENT || 'development' }} ``` -------------------------------- ### Deploy a samstacks Pipeline using uvx (Bash) Source: https://context7_llms This command demonstrates how to deploy a samstacks pipeline defined in a `pipeline.yml` manifest file using `uvx`, the recommended quick-run utility. It initiates the deployment process, resolving dependencies and deploying stacks in the correct order. ```Bash uvx samstacks deploy pipeline.yml ``` -------------------------------- ### samstacks Command Line Interface (CLI) Reference Source: https://context7_llms This section provides a reference for the `samstacks` command-line interface (CLI) commands, detailing their syntax, parameters, and functionality. It covers commands for bootstrapping new pipelines, deploying, deleting, and validating existing pipelines. ```APIDOC samstacks bootstrap [PATH_TO_SCAN] [OPTIONS] Scans a directory for existing SAM projects and generates an initial pipeline.yml file. Useful options include --output-file to name the generated file and … ``` ```APIDOC samstacks delete [OPTIONS] Deletes all stacks defined in the manifest in reverse order. Useful options: --no-prompts to skip confirmation --dry-run to preview deletions ``` ```APIDOC samstacks deploy [OPTIONS] Deploys all stacks defined in the manifest. Options include: --input to provide values for pipeline inputs --auto-delete-failed to … ``` ```APIDOC samstacks validate Performs comprehensive validation of the manifest including schema checks, template expressions, input definitions, stack dependencies and file existence. ``` -------------------------------- ### samstacks bootstrap CLI Command Source: https://context7_llms API documentation for the `samstacks bootstrap` command, which scans a directory for SAM projects and generates an initial `pipeline.yml` file. Includes options for output file naming and overwriting. ```APIDOC samstacks bootstrap [PATH_TO_SCAN] [OPTIONS] Scans a directory for existing SAM projects and generates an initial pipeline.yml file. Useful options include --output-file to name the generated file and --overwrite to replace an existing file. ``` -------------------------------- ### Defining samstacks Pipeline Metadata Source: https://context7_llms This YAML snippet shows how to configure basic metadata for a samstacks pipeline, including its name, description, and an optional post-deployment summary displayed in the console. ```YAML pipeline_name: My SAM Application Deployment pipeline_description: Description of the pipeline summary: |- Optional post-deployment summary shown in console ``` -------------------------------- ### Configuring Multi-Environment Deployment with samstacks Source: https://context7_llms This YAML configuration demonstrates how to define different stack configurations based on environment variables. It allows deploying the same application with varying parameters (e.g., instance types) for 'production' and 'development' environments. ```YAML stacks: - id: app dir: ./app if: ${{ env.ENVIRONMENT == 'production' }} params: InstanceType: t3.large - id: app-dev dir: ./app if: ${{ env.ENVIRONMENT == 'development' }} params: InstanceType: t3.micro ``` -------------------------------- ### Deploying a samstacks Pipeline Source: https://context7_llms This command deploys a samstacks pipeline defined in a YAML configuration file. It initiates the deployment process based on the specified pipeline manifest. ```Shell uvx samstacks deploy examples/pipeline.yml ``` -------------------------------- ### Deploying a Pipeline with Samstacks CLI Source: https://context7_llms Executes the deployment of a specified pipeline configuration file using the `samstacks` command-line tool. This command orchestrates the entire deployment process, from dependency resolution to infrastructure provisioning. ```Shell samstacks deploy pipeline.yml ``` -------------------------------- ### Deploy Stacks using Samstacks CLI Source: https://context7_llms This command deploys all stacks defined in a specified manifest file. It supports various options for providing input values, cleaning up failed deployments, generating reports, and controlling output verbosity. ```CLI samstacks deploy [OPTIONS] Options: --input to provide values for pipeline inputs --auto-delete-failed to clean up failed stacks and changesets --report-file to save a Markdown summary --debug for verbose logging --quiet to suppress output ``` -------------------------------- ### Define Custom SAM Configurations per Stack Source: https://context7_llms Demonstrates how to specify custom SAM CLI configurations, such as capabilities, at the individual stack level within the samstacks pipeline. ```YAML stacks: - id: my-stack dir: ./my-stack sam_config: version: 0.1 default: deploy: parameters: capabilities: CAPABILITY_NAMED_IAM ``` -------------------------------- ### Conditionally Deploy samstacks Source: https://context7_llms Shows how to use conditional expressions to deploy stacks based on environment variables or other conditions within the samstacks pipeline. ```YAML stacks: - id: optional-stack dir: ./optional if: ${{ env.DEPLOY_OPTIONAL == 'true' }} ``` -------------------------------- ### Referencing Outputs Across samstacks Stacks Source: https://context7_llms This YAML configuration illustrates how to pass outputs from one deployed stack (e.g., 'network') as inputs to another stack (e.g., 'database'). This enables building interdependent infrastructure components. ```YAML stacks: - id: network dir: ./infrastructure/network - id: database dir: ./infrastructure/database params: VpcId: ${{ stacks.network.outputs.VpcId }} SubnetIds: ${{ stacks.network.outputs.PrivateSubnetIds }} ``` -------------------------------- ### Pass Outputs Between samstacks Source: https://context7_llms Illustrates how to reference outputs from one stack as parameters for another using the expression syntax in a samstacks pipeline configuration. ```YAML stacks: - id: network dir: ./network - id: app dir: ./app params: VpcId: ${{ stacks.network.outputs.VpcId }} ``` -------------------------------- ### Configure AWS Credentials for samstacks Source: https://context7_llms Explains how samstacks uses existing AWS CLI credentials and provides commands to configure them. ```Bash aws configure # or export AWS_PROFILE=my-profile ``` -------------------------------- ### Define a samstacks Pipeline Manifest (YAML) Source: https://context7_llms This YAML manifest file defines a multi-stack AWS SAM application deployment pipeline. It configures global SAM deployment settings and specifies two interdependent stacks: a 'backend' with a table name parameter and a 'frontend' that references the backend's API endpoint output, demonstrating cross-stack referencing and dependency management. ```YAML pipeline_name: My SAM Application Deployment pipeline_description: Deploys the backend and frontend for My SAM Application. pipeline_settings: default_sam_config: version: 0.1 default: deploy: parameters: capabilities: CAPABILITY_IAM confirm_changeset: false stacks: - id: backend dir: my_sam_app/backend/ params: TableName: ${{ env.TABLE_NAME || 'MyTable' }} - id: frontend dir: my_sam_app/frontend/ params: ApiEndpoint: ${{ stacks.backend.outputs.ApiUrl }} ``` -------------------------------- ### Define a Samstacks File Processing Pipeline Source: https://context7_llms This YAML snippet illustrates the structure of a `samstacks` pipeline configuration. It defines a 'File Processing System' with two interdependent stacks: 'storage' and 'processor', demonstrating how outputs from one stack can be used as parameters for another. ```YAML pipeline_name: File Processing System pipeline_description: S3 → SQS → Lambda processing pipeline stacks: - id: storage dir: stacks/storage/ - id: processor dir: stacks/processor/ params: BucketName: ${{ stacks.storage.outputs.BucketName }} QueueUrl: ${{ stacks.storage.outputs.QueueUrl }} ``` -------------------------------- ### samstacks delete CLI Command Source: https://context7_llms API documentation for the `samstacks delete` command, which deletes all stacks defined in a manifest file in reverse order. Includes options to skip confirmation and preview deletions. ```APIDOC samstacks delete [OPTIONS] Deletes all stacks defined in the manifest in reverse order. Useful options: --no-prompts to skip confirmation --dry-run to preview deletions ``` -------------------------------- ### samstacks Stack Properties Reference Source: https://context7_llms Detailed reference for required and optional properties when defining a stack in a samstacks pipeline manifest. ```APIDOC Required Properties: id: Type: string Description: Unique identifier for the stack dir: Type: string Description: Directory containing the SAM template Optional Properties: name: Type: string Description: Human-readable name for the stack description: Type: string Description: Description of the stack if: Type: string Description: Conditional expression for deployment params: Type: object Description: Parameters to pass to the stack run: Type: string Description: Commands to run after deployment region: Type: string Description: AWS region override for this stack profile: Type: string Description: AWS profile override for this stack stack_name_suffix: Type: string Description: Stack-specific suffix for naming sam_config_overrides: Type: object Description: Stack-specific SAM configuration ``` -------------------------------- ### Validate Manifests using Samstacks CLI Source: https://context7_llms This command performs a comprehensive validation of a manifest file. It checks for schema compliance, template expression correctness, input definitions, stack dependencies, and file existence to ensure the manifest is well-formed. ```CLI samstacks validate ``` -------------------------------- ### Configuring Global samstacks Pipeline Settings Source: https://context7_llms This YAML configuration defines global settings for all stacks within a samstacks pipeline, such as a stack name prefix, default AWS region, shared SAM configuration, and pipeline input parameters. ```YAML pipeline_settings: stack_name_prefix: myapp- # Prefix for all stack names default_region: us-east-1 # Default AWS region default_sam_config: # Shared SAM configuration version: 0.1 default: deploy: parameters: capabilities: CAPABILITY_IAM confirm_changeset: false inputs: # Pipeline input parameters environment: type: string default: development ``` -------------------------------- ### Debug samstacks Expression Evaluation Source: https://context7_llms Provides the command to enable verbose logging for debugging how expressions are evaluated during samstacks deployment. ```Bash uvx samstacks deploy pipeline.yml --verbose ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.