LazyMagic

Create systemconfig.yaml

⚡ Quick Answer

systemconfig.yaml: Environment-specific configuration file defining AWS deployment parameters. Configure AdminEmail, SystemSuffix (unique ID), SystemKey (resource prefix), Profile (AWS SSO), Region, Tenants with domains/certificates, and Behaviors for API/Asset/WebApp routing rules.

Prerequisites

  • 🌐 Registered domain name
  • 🏷️ AWS Hosted Zone ID
  • 🔒 ACM Certificate ARN
  • 📧 Admin email address
  • ⏱️ Estimated time: 2-5 minutes
  • 💰 Cost: Free

In this step we will finalize the configuration of our service so we can deploy it to our AWS development account.

systemconfig.yaml

systemconfig.yaml is the configuration file for a system environment. Each environment (dev, test, prod) has its own systemconfig.yaml file. This file contains the parameters for the deployment used by the Deploy-* commands in the LzAws PowerShell module.

Here is an example "dev" systemconfig.yaml file for our sample system:


# systemconfig.yaml is the configuration file for a system environment.
# Each environment (dev, test, prod) has its own systemconfig.yaml file.
# This file contains the parameters for the deployment used by 
# the Deploy-* commands in the LzAws PowerShell module.
# 
# Start with the AWSTemplates/systemconfig.template.yaml template (this file)_. 
# This file should be located immediately above the 
# Service solution folder.

# AdminEmail is the email address of the system administrator. This is 
# used in the AWS CloudFormation templates to send a Tenant User Pool
# invitation to the Administrator user.
AdminAuth: "TenantAuth" # This is the name of the Authentication to create the Administrator user in
AdminEmail: "me@mydomain.com"


# SystemSuffix is a short random string used to ensure uniqueness of 
# S3 bucket names. We suggest you generate a GUID and use the 
# middle section to get a unique SystemSuffix.
# Needs to be lowercase alphanumeric. Keep it to 9 characters 
# to avoid generating S3 bucket names that are too long.
SystemSuffix: "xxxx-xxxx"

# SystemKey is a prefix ensuring AWS resource names are unique
# within an AWS account when multiple systems are deployed. 
# You can use the same SystemKey for Dev, Test, and Prod environments 
# if you are deploying the environments in different AWS accounts 
# (which is recommended).
# It should be short (3-5 characters) and lowercase alphanumeric.
SystemKey: "lzm" # This is the name of the cloudformation stack that will be created to deploy the system.

# Environment is the type of environment being deployed. It is one of 
# dev, test, or prod. This value is used in some AWS Templates to 
# tailor resource creation. 
Environment: 'dev'

# Profile is the name of the AWS profile used to deploy the system. We recommend 
# you use use profile names that use a SystemKey-Environment pattern.
# Profiles generally use AWS SSO to authenticate.
Profile: "lzm-dev"
Region: "us-west-2"

# DefaultTenancy is the default tenancy for development
DefaultTenant: "uptown.mydomain.com"

# Behaviors 
# Behaviors define the routing rules for system requests. 
# Each behavior has a Path and an optional ApiName or AppName.
# System level Behaviors often serve as "defaults" that may 
# be overridden by Tenant or Subtenant Behaviors. 
Behaviors:
  # API Behaviors define the routing rules for API requests.
  # Api Properties include: Path, ApiName
  Apis:
  # Apis match the API directives in the lazymagic.yaml file.
  - Path: "/StoreApi"
    ApiName: "StoreApi"
  - Path: "/PublicApi"
    ApiName: "PublicApi"
  - Path: "/ConsumerApi"
    ApiName: "ConsumerApi"
  - Path: "/AdminApi"
    ApiName: "AdminApi"

  # Asset Behaviors define the routing rules for asset requests.
  # Asset Properties include: Path, Suffix
  Assets:
  - Path: "/system/"
  # WebApp Behaviors define the routing rules for webapp requests.
  # WebApp Properties include: Path, AppName, Suffix
  # Path may contain one or more paths separated by commas.
  # If you don't specify a suffix then the system suffix will be 
  # used'
  WebApps:
  # WebApps match the WebApp directives in the lazymagic.yaml file.
  - Path: "/store/,/store,/"
    AppName: "storeapp"
  - Path: "/app/,/app,"
    AppName: "consumerapp"  
  - Path: "/admin/,/admin,"
    AppName: "adminapp"
  - Path: "/baseapp/,/baseapp"
    AppName: "baseapp"
  
# Tenants define the tenants in the system.
# 
Tenants:
  mp: # tenantKey - See documentation for naming guidelines
    # RootDomain, HostedZoneId, and AcmCertificateArn are required for each tenant 
    # and you use the AWS Console to create the hosted zone and certificate. You 
    # may also use the AWS Console to purchase a domain name.
    RootDomain: "mydomain.com" # Each Tenant has it's own domain. 
    HostedZoneId: "xxxxxxxxxxxxxxxxxxxxx" # Provide the AWS hosted zone id for the tenant domain
    AcmCertificateArn: "arn:aws:acm:us-east-1:999999999999:certificate/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # AWS certificate for tenant domain

    # Tenant Behaviors define the routing rules for tenant requests. 
    # They have the same properties as the system level behaviors.
    # You can override a system level behavior by specifying the same path.
    # If you don't specify a suffix then the system suffix will be used.
    # You may define tenant specific behaviors for APIs, Assets, and WebApps.
    Behaviors:
      Assets:
      - Path: "/tenancy/"
    Subtenants: 
      uptown: # subtenantKey - See documentation for naming guidelines
        # SubDomain is the subdomain for the subtenant. It is 
        # usually the same as the subtenantKey but can be different 
        # if required.
        SubDomain: uptown

        # Subtenant Behaviors define the routing rules for subtenant requests.
        # They have the same properties as the system and tenant level behaviors.
        # You can override a system or tenant level behavior by specifying the 
        # same path. If you don't specify a suffix then the tenant suffix will 
        # be used. Note that the tenant suffix might be the system suffix.
        # You may define subtenant specific behaviors for APIs, Assets, and WebApps.
        Behaviors:
          Assets:
          - Path: "/subtenancy/"
        
      downtown: # subtenantKey - See documentation for naming guidelines
        SubDomain: downtown
        Behaviors:
          Assets:
          - Path: "/subtenancy/"      
        
    

Create and Update systemconfig.yaml file

Navigate to the _Dev/MagicPets folder.

Copy the file template above and then create the systemconfig.yaml file in that folder. Update the following values:

  • AdminEmail
  • SystemSuffix
  • RootDomain
  • HostedZoneId
  • AcmCertificateArn