Skip to main content

AwsSingleAzRegionModule

AwsSingleAzRegionModule creates a VPC and its internet gateway in one availability zone of an AWS region (regionId, vpcCidrBlock).

@cost

Nothing: a VPC and an internet gateway are free. What runs inside the region 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.

@example

TypeScript

import { type Account, stub } from '@quadnix/octo';
import { AwsSingleAzRegionModule } from '@quadnix/octo-aws-cdk/modules/region/aws-single-az-region';
import { AwsSingleAzRegionId } from '@quadnix/octo-aws-cdk/modules/region/aws-single-az-region/schema';

octo.loadModule(AwsSingleAzRegionModule, 'my-region-module', {
account: stub<Account>('${{my-account-module.model.account}}'),
name: 'my-region',
regionId: AwsSingleAzRegionId.AWS_US_EAST_1A,
vpcCidrBlock: '10.0.0.0/16',
});
@group

Modules/Region/AwsSingleAzRegion

@limit

One availability zone: an outage of that zone takes down everything in the region. A load balancer from AwsEcsAlbServiceModule needs two zones, from AwsMultiAzRegionModule.

@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 regionId 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 AwsSingleAzRegionModule

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 in a single availability zone.


    Parameters

    Returns Promise<AwsSingleAzRegion>

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>>