Skip to main content

AwsServerlessEnvironmentModule

AwsServerlessEnvironmentModule declares one environment of a serverless region, such as staging or production, with the environmentVariables every Lambda execution in it gets.

It creates nothing: an environment in a serverless region has no cluster to run on.

@cost

Nothing: it creates no resources.

@downtime

None: changing environmentVariables updates each function in place.

@example

TypeScript

import { type Region, stub } from '@quadnix/octo';
import { AwsServerlessEnvironmentModule } from '@quadnix/octo-aws-cdk/modules/environment/aws-serverless-environment';

octo.loadModule(AwsServerlessEnvironmentModule, 'my-environment-module', {
environmentName: 'qa',
environmentVariables: { NODE_ENV: 'qa' },
region: stub<Region>('${{my-region-module.model.region}}'),
});
@group

Modules/Environment/AwsServerlessEnvironment

@limit

environmentVariables reach every execution in the environment as plain text, and Lambda allows at most 4 KB of them on a function.

@losesData

Nothing.

@replaces

Nothing: it creates no resources.

@see

Hierarchy

Index

Constructors

constructor

  • Parameters

    • moduleId: string

      The ID this module is loaded under.

    Returns AwsServerlessEnvironmentModule

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

  • Creates the environment and its environment variables under the region, and anchors them.


    Parameters

    Returns Promise<AwsServerlessEnvironment>

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