Skip to main content

AwsEcsEnvironmentModule

AwsEcsEnvironmentModule creates the ECS cluster of one environment in a region, such as staging or production, with the environmentVariables every execution in it gets.

@cost

Nothing: an ECS cluster is free, and its executions bill their own tasks.

@downtime

A replacement recreates the cluster, and every service in it is recreated with it.

@example

TypeScript

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

octo.loadModule(AwsEcsEnvironmentModule, 'my-environment-module', {
environmentName: 'production',
environmentVariables: {
NODE_ENV: 'production',
API_URL: 'https://api.example.com'
},
region: stub<Region>('${{my-region-module.model.region}}'),
});
@group

Modules/Environment/AwsEcsEnvironment

@limit

environmentVariables reach every execution in the environment as plain text: a secret set here is readable by anyone who can read the task definition.

@limit

The cluster has Container Insights off, so it publishes no per-task CPU, memory or network metrics beyond what ECS reports itself.

@losesData

Nothing of its own. Replacing it replaces its executions, and that loses whatever their losesData names.

@replaces

Changing environmentName or region replaces the cluster and every service in it. Changing environmentVariables rolls each service onto a new task definition.

@see

Hierarchy

Index

Constructors

constructor

  • Parameters

    • moduleId: string

      The ID this module is loaded under.

    Returns AwsEcsEnvironmentModule

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, and anchors the ECS cluster it maps to.


    Parameters

    Returns Promise<AwsEcsEnvironment>

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

registerMetadata

  • Resolves the account, region, and the name of the ECS cluster this environment's executions run on.


    Parameters

    Returns Promise<{ awsAccountId: string; awsRegionId: string; clusterName: string }>