Skip to main content

AwsDynamoDBGlobalServiceModule

AwsDynamoDBGlobalServiceModule replicates a DynamoDB table into other regions (replicas), making it a global table.

The global table sits under the table it replicates, with an edge to each region it is replicated into.

@cost

Each replica bills as a table of its own in its region: its storage, its reads, and every write, since each write to the table is written again in each replica. Data sent between regions is billed per GB on top.

@downtime

None: adding or removing a replica leaves the table and the other replicas serving.

@example

TypeScript

import { type Region, type Service, stub } from '@quadnix/octo';
import { AwsDynamoDBGlobalServiceModule } from '@quadnix/octo-aws-cdk/modules/service/aws-dynamodb-global-service';

octo.loadModule(AwsDynamoDBGlobalServiceModule, 'my-global-table-module', {
dynamoDBService: stub<Service>('${{my-dynamodb-module.model.service}}'),
replicas: [{ region: stub<Region>('${{my-replica-region-module.model.region}}'), tags: { key1: 'value1' } }],
});
@group

Modules/Service/AwsDynamoDBGlobalService

@limit

The table being replicated must stream both images of a change: StreamSpecification of AwsDynamoDBServiceModule set to NEW_AND_OLD_IMAGES. A replica cannot be in the table's own AWS region.

@limit

A replica takes its table's DeletionProtectionEnabled and PointInTimeRecoveryEnabled; neither can differ per replica.

@losesData

Removing a replica deletes that region's copy, while the table and the other replicas keep every item. Deleting the table in AwsDynamoDBServiceModule is what loses the data.

@replaces

Nothing: replicas are added and removed one at a time, and the table itself follows AwsDynamoDBServiceModule.

@see

Hierarchy

Index

Constructors

constructor

  • Parameters

    • moduleId: string

      The ID this module is loaded under.

    Returns AwsDynamoDBGlobalServiceModule

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 replica regions, creates the global table service over an existing DynamoDB table, and anchors it for its replicas.


    Parameters

    Returns Promise<AwsDynamoDBGlobalService>

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