Skip to main content

AwsMultiAzRegionModule

AwsMultiAzRegionModule creates a VPC and its internet gateway across several availability zones of one AWS region (regionIds, vpcCidrBlock), for what must survive a zone going down.

@cost

Nothing: a VPC and an internet gateway are free. Traffic between availability zones is billed about $0.01 per GB each way, and what runs inside is billed by its own module.

@downtime

A replacement deletes the VPC and everything inside it, subnets and the services in them, and creates them again. Adding a zone to regionIds changes the VPC in place.

@example

TypeScript

import { type Account, stub } from '@quadnix/octo';
import { AwsMultiAzRegionModule } from '@quadnix/octo-aws-cdk/modules/region/aws-multi-az-region';
import { AwsMultiAzRegionId } from '@quadnix/octo-aws-cdk/modules/region/aws-multi-az-region/schema';

octo.loadModule(AwsMultiAzRegionModule, 'my-region-module', {
account: stub<Account>('${{my-account-module.model.account}}'),
name: 'my-region',
regionIds: [AwsMultiAzRegionId.AWS_US_EAST_1A, AwsMultiAzRegionId.AWS_US_EAST_1B],
vpcCidrBlock: '10.0.0.0/16',
});
@group

Modules/Region/AwsMultiAzRegion

@limit

Every zone in regionIds belongs to one AWS region. A service survives a zone's outage only when its subnets span more than one zone.

@limit

vpcCidrBlock is between a /16 and a /28, and every subnet's block lies inside it.

@limit

The VPC is IPv4 only and runs on shared hardware, and its one internet gateway is named default.

@losesData

Nothing of its own: the VPC holds no data. Replacing it replaces what lies inside, and that loses whatever those modules' losesData names.

@replaces

Changing the AWS region of regionIds, or vpcCidrBlock, replaces the VPC, and with it every subnet and service inside.

@see

Hierarchy

Index

Constructors

constructor

  • Parameters

    • moduleId: string

      The ID this module is loaded under.

    Returns AwsMultiAzRegionModule

Properties

readonlyinheritedmoduleId

moduleId: string

The ID this module was loaded under. It scopes everything the module produces, so the same module class can be loaded more than once.

staticreadonlyinheritedMODULE_PACKAGE

MODULE_PACKAGE: string

The package the module is registered under, set by Module.

staticreadonlyinheritedMODULE_SCHEMA

MODULE_SCHEMA: any

The schema of the module's inputs, set by Module.

Methods

onInit

  • Validates the VPC CIDR against the account's other regions, then creates the region across the given availability zones.


    Parameters

    Returns Promise<AwsMultiAzRegion>

inheritedregisterHooks

  • registerHooks(): { postCommitHooks?: PostHookSignature[]; postModelActionHooks?: PostHookSignature[]; postResourceActionHooks?: PostHookSignature[]; preCommitHooks?: PreHookSignature[]; preModelActionHooks?: PreHookSignature[]; preResourceActionHooks?: PreHookSignature[] }
  • To hook custom behavior into Octo's lifecycle for the duration of this module. Override it to return the callbacks you want run.

    @see

    Techniques for Hooks.


    Returns { postCommitHooks?: PostHookSignature[]; postModelActionHooks?: PostHookSignature[]; postResourceActionHooks?: PostHookSignature[]; preCommitHooks?: PreHookSignature[]; preModelActionHooks?: PreHookSignature[]; preResourceActionHooks?: PreHookSignature[] }

    • optionalpostCommitHooks?: PostHookSignature[]
    • optionalpostModelActionHooks?: PostHookSignature[]
    • optionalpostResourceActionHooks?: PostHookSignature[]
    • optionalpreCommitHooks?: PreHookSignature[]
    • optionalpreModelActionHooks?: PreHookSignature[]
    • optionalpreResourceActionHooks?: PreHookSignature[]

inheritedregisterMetadata

  • To derive values that both AModule.onInit and this module's actions need - typically facts resolved from another module's anchors, such as an account ID or a region's availability zones. Override it, and the returned object is handed to every action of this module as actionInputs.metadata.


    Parameters

    Returns Promise<Record<string, unknown>>