Skip to main content

AwsDeploymentModule

AwsDeploymentModule declares one version of a server's code: its container image (image and imageTag, or imageUri) and what it needs to run, command, ports, cpu, memory and timeoutInSeconds.

It creates nothing and knows nothing about where the code runs. The execution that runs it checks the fields its runtime needs, so a field one runtime ignores can still be set.

An image octo publishes is named by its image and tag rather than by its URI, so the image is always pushed before anything runs it. The module publishing the tag, AwsEcrImageTagModule, must be loaded too; the execution running the deployment fails if the tag is not published where it runs.

@cost

Nothing: it creates no resources.

@downtime

None of its own: a new deployment is rolled out by the execution running it, as that execution's downtime says.

@example

TypeScript

import { type Image, type Server, stub } from '@quadnix/octo';
import { AwsDeploymentModule } from '@quadnix/octo-aws-cdk/modules/deployment/aws-deployment';

octo.loadModule(AwsDeploymentModule, 'my-deployment-module', {
deploymentTag: 'v1',
image: stub<Image>('${{my-image-module.model.image}}'),
imageTag: '0.0.1',
memory: 512,
ports: [{ containerPort: 8080, protocol: 'tcp' }],
server: stub<Server>('${{my-server-module.model.server}}'),
timeoutInSeconds: 30,
});
@group

Modules/Deployment/AwsDeployment

@limit

An image octo publishes is named by image and imageTag, and needs its AwsEcrImageTagModule loaded; imageUri names any other image, which only ECS runs. Lambda needs memory of 128 to 10,240 MiB, timeoutInSeconds of 1 to 900, and at most one port.

@losesData

Nothing.

@replaces

Nothing: it creates no resources. A new deploymentTag is a new version the execution rolls onto.

@see

Hierarchy

Index

Constructors

constructor

  • Parameters

    • moduleId: string

      The ID this module is loaded under.

    Returns AwsDeploymentModule

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 deployment under its server, anchors what it needs, and links it to the ECR image whose tag it runs.


    Parameters

    Returns Promise<(AwsDeployment | AwsDeploymentImageOverlay)[]>

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