Configuration ReferenceΒΆ

Table of ContentsΒΆ

Configuration File StructureΒΆ

The SG Provisioner uses a YAML configuration file with four main sections:

client:
  company_name: Global Bank
  company_prefix: globalbank
  account_id: "123456789012"
  tenant_id: "c001"

environment:
  env: prod
  region: us-west-2

security_groups:
  scenario: 3-tier-web
  vpc_source: parameter-store
  vpc_parameter_store_path: /vpc/globalbank-prod-c001-us-west-2-vpc/VPCId
  sg_name_override: ""
  workload: ""

  overrides:
    app:
      port_overrides:
        - protocol: tcp
          old_port: 8080
          new_port: 8443
      additional_ingress:
        - protocol: tcp
          port: 9090
          source_tier: web
          description: Prometheus metrics from web tier

tags:
  cost_center: Fraud Operations
  project: Real-time Fraud Detection
  owner: fraud-ml-engineering-team

Section 1: Client ConfigurationΒΆ

company_nameΒΆ

  • Type: string

  • Required: Yes

  • Description: Full company name for display in reports

  • Example: Global Bank, Edge Corp

company_prefixΒΆ

  • Type: string

  • Required: Yes

  • Description: Short company identifier (lowercase, no spaces)

  • Constraints: Pattern ^[a-z][a-z0-9-]*$

  • Example: globalbank, edge

account_idΒΆ

  • Type: string (quoted)

  • Required: Yes

  • Description: 12-digit AWS account ID

  • Format: Must be quoted to preserve leading zeros

  • Example: "123456789012"

tenant_idΒΆ

  • Type: string (quoted)

  • Required: Yes

  • Description: 4-character alphanumeric tenant identifier

  • Format: Pattern ^[a-z0-9]{4}$

  • Example: "c001"

Section 2: Environment ConfigurationΒΆ

envΒΆ

  • Type: string

  • Required: Yes

  • Description: Environment name

  • Valid Values: prod, dev, test, staging

  • Example: prod

regionΒΆ

  • Type: string

  • Required: Yes

  • Description: AWS region for deployment

  • Format: Pattern ^[a-z]{2}-[a-z]+-[0-9]$

  • Example: us-west-2

Section 3: Security Groups ConfigurationΒΆ

scenarioΒΆ

  • Type: string

  • Required: Yes

  • Description: Scenario template name to use

  • Valid Values: Any YAML file in schemas/scenarios/ (without extension)

  • Example: 3-tier-web, 3-tier-rds-mysql, 2-tier-rds-postgresql

vpc_sourceΒΆ

  • Type: string

  • Required: Yes

  • Description: How to resolve the target VPC ID

  • Valid Values: parameter-store, direct

# Option 1: Resolve from Parameter Store (recommended)
security_groups:
  vpc_source: parameter-store
  vpc_parameter_store_path: /vpc/globalbank-prod-c001-us-west-2-vpc/VPCId

# Option 2: Direct VPC ID
security_groups:
  vpc_source: direct
  vpc_id: vpc-0abc123def456

vpc_parameter_store_pathΒΆ

  • Type: string

  • Required: When vpc_source: parameter-store

  • Description: SSM Parameter Store path containing the VPC ID

  • Format: Must start with /

  • Example: /vpc/globalbank-prod-c001-us-west-2-vpc/VPCId

vpc_idΒΆ

  • Type: string

  • Required: When vpc_source: direct

  • Description: Direct VPC ID

  • Format: Pattern ^vpc-[a-z0-9]+$

  • Example: vpc-0abc123def456

sg_name_overrideΒΆ

  • Type: string

  • Required: No (can be empty)

  • Default: Auto-generated from client/environment values

  • Description: Override auto-generated SG name entirely

security_groups:
  sg_name_override: ""  # Use auto-generated name
  # OR
  sg_name_override: "my-custom-sg-name"

workloadΒΆ

  • Type: string

  • Required: No (can be empty)

  • Default: Empty (no workload segment in name)

  • Description: Workload discriminator for multiple SG sets in the same environment

# Without workload: globalbank-prod-c001-us-west-2-sg
security_groups:
  workload: ""

# With workload: globalbank-prod-c001-us-west-2-fraud-sg
security_groups:
  workload: "fraud"

# Another workload: globalbank-prod-c001-us-west-2-payments-sg
security_groups:
  workload: "payments"

overridesΒΆ

  • Type: object (keyed by tier name)

  • Required: No

  • Description: Customer-specific modifications to the base scenario

See Override System for full details.

Section 4: Tags ConfigurationΒΆ

tagsΒΆ

  • Type: object (key-value pairs)

  • Required: No

  • Description: Custom tags applied to all security groups

tags:
  cost_center: Fraud Operations
  project: Real-time Fraud Detection
  owner: fraud-ml-engineering-team

System Tags (Automatically Applied)ΒΆ

Tag Key

Source

Example Value

Name

Generated

globalbank-web-sg

Environment

environment.env

prod

ManagedBy

Static

sg-provisioner-tool

Tier

Per SG

web, app, db

Complete Configuration ExamplesΒΆ

Example 1: Basic 3-Tier Web (No Overrides)ΒΆ

client:
  company_name: Acme Corp
  company_prefix: acme
  account_id: "123456789012"
  tenant_id: "a001"

environment:
  env: prod
  region: us-east-1

security_groups:
  scenario: 3-tier-web
  vpc_source: parameter-store
  vpc_parameter_store_path: /vpc/acme-prod-a001-us-east-1-vpc/VPCId
  sg_name_override: ""
  workload: ""

tags:
  cost_center: Engineering
  project: Main Platform
  owner: platform-team

Example 2: MySQL with Custom App PortΒΆ

client:
  company_name: Acme Corp
  company_prefix: acme
  account_id: "123456789012"
  tenant_id: "a001"

environment:
  env: prod
  region: us-east-1

security_groups:
  scenario: 3-tier-rds-mysql
  vpc_source: direct
  vpc_id: vpc-0abc123def456
  sg_name_override: ""
  workload: "orders"

  overrides:
    app:
      port_overrides:
        - protocol: tcp
          old_port: 8080
          new_port: 3000

tags:
  cost_center: Commerce
  project: Order Processing
  owner: commerce-team

Example 3: Multiple Workloads (Same Environment)ΒΆ

# Config 1: fraud workload
security_groups:
  scenario: 3-tier-rds-postgresql
  workload: "fraud"
  # Result: acme-prod-a001-us-east-1-fraud-sg

# Config 2: payments workload (separate file)
security_groups:
  scenario: 3-tier-rds-postgresql
  workload: "payments"
  # Result: acme-prod-a001-us-east-1-payments-sg

SG Naming ConventionΒΆ

When sg_name_override is empty, the tool auto-generates names:

Without workload:

{company_prefix}-{env}-{tenant_id}-{region}-sg

Example: globalbank-prod-c001-us-west-2-sg

With workload:

{company_prefix}-{env}-{tenant_id}-{region}-{workload}-sg

Example: globalbank-prod-c001-us-west-2-fraud-sg

Derived names:

  • Stack: {sg_name}-stack

  • SSM path: /sg/{sg_name}/{tier}/SecurityGroupId

    • e.g., /sg/globalbank-prod-c001-us-west-2-sg/web/SecurityGroupId

  • SG Name tag: {company_prefix}-{tier}-sg

Override SystemΒΆ

Overrides let you customize a base scenario without creating a new YAML file.

StructureΒΆ

overrides:
  <tier_name>:
    port_overrides:
      - protocol: <tcp|udp|icmp>
        old_port: <int>
        new_port: <int>
    additional_ingress:
      - protocol: <tcp|udp|icmp>
        port: <int>
        source: <cidr>          # OR
        source_tier: <tier>     # (mutually exclusive)
        description: <string>
    additional_egress:
      - protocol: <tcp|udp|icmp>
        port: <int>
        destination: <cidr>       # OR
        destination_tier: <tier>  # (mutually exclusive)
        description: <string>

Port OverridesΒΆ

Replace an existing port in the scenario:

overrides:
  app:
    port_overrides:
      - protocol: tcp
        old_port: 8080    # Original port in scenario
        new_port: 8443    # New port to use

Additional IngressΒΆ

Append new inbound rules:

overrides:
  app:
    additional_ingress:
      - protocol: tcp
        port: 9090
        source_tier: web
        description: Prometheus metrics
      - protocol: tcp
        port: 8443
        source: 10.0.0.0/16
        description: Internal HTTPS from VPC

Additional EgressΒΆ

Append new outbound rules:

overrides:
  app:
    additional_egress:
      - protocol: tcp
        port: 6379
        destination_tier: cache
        description: Redis cache connections

Configuration Validation RulesΒΆ

ClientΒΆ

  • company_prefix: lowercase, starts with letter, alphanumeric + hyphens

  • account_id: exactly 12 digits, must be quoted

  • tenant_id: exactly 4 alphanumeric characters

EnvironmentΒΆ

  • env: one of prod, dev, test, staging

  • region: valid AWS region format (e.g., us-west-2)

Security GroupsΒΆ

  • vpc_source: must be parameter-store or direct

  • vpc_parameter_store_path: must start with / (when using parameter-store)

  • vpc_id: must match ^vpc-[a-z0-9]+$ (when using direct)

  • Override ports: 1-65535

TagsΒΆ

  • All values must be strings

Configuration Best PracticesΒΆ

1. Use Parameter Store for VPC IDΒΆ

vpc_source: parameter-store  # Decouples SG from VPC deployment

2. Use Workload Discriminator for Multiple SG SetsΒΆ

workload: "fraud"     # Separate SG set per workload
workload: "payments"  # No naming collisions

3. Keep Overrides MinimalΒΆ

Use overrides for small tweaks. If you need a fundamentally different architecture, create a new scenario YAML.

4. Tag for Cost AllocationΒΆ

tags:
  cost_center: Fraud Operations
  project: Fraud Detection
  owner: fraud-team

5. Quote Numeric StringsΒΆ

account_id: "123456789012"  # Always quote
tenant_id: "c001"           # Always quote

6. Version Control ConfigurationsΒΆ

Store configs in Git. Each config file represents a deployable SG set.

7. Test Before ProductionΒΆ

environment:
  env: dev  # Test here first

Troubleshooting Configuration IssuesΒΆ

Issue: VPC not found in Parameter StoreΒΆ

Error: VPC ID not found in Parameter Store at: /vpc/.../VPCId

Solution: Deploy the VPC first using the VPC Provisioner, or switch to vpc_source: direct.

Issue: Scenario not foundΒΆ

Error: Scenario YAML not found

Solution: Use list-scenarios to see available scenarios. Check spelling matches filename.

Issue: Invalid port in overrideΒΆ

Error: Port values must be between 1 and 65535

Solution: Ensure ports are integers between 1 and 65535.

Issue: Account ID loses leading zerosΒΆ

Solution: Always quote the account_id:

account_id: "012345678901"  # Quoted preserves leading zero

Issue: Stack already existsΒΆ

Solution: Use delete-security-groups --force first, or use a different workload value.

Additional ResourcesΒΆ

  • User Guide - Complete command reference

  • Scenarios - Scenario details and customization

  • Troubleshooting - Common issues and solutions