From bdf544ffcc4b0d729996edd8b060df4e683af0b8 Mon Sep 17 00:00:00 2001 From: Matt H Date: Tue, 23 May 2023 16:11:28 -0400 Subject: [PATCH 1/2] Add GlobalTable replica in secondary region (defaulting to us-west-2) --- serverless.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/serverless.yml b/serverless.yml index 353411e..c21b097 100644 --- a/serverless.yml +++ b/serverless.yml @@ -37,6 +37,7 @@ custom: u2fTable: ${self:custom.namespace}_u2f dev_env: staging prod_env: production + secondaryRegion: ${env:AWS_REGION_SECONDARY, "us-west-2"} functions: apiKeyActivate: @@ -214,6 +215,16 @@ resources: Value: "shared" - Key: "managed_by" Value: "serverless" + - Region: ${self:custom.secondaryRegion} + Tags: + - Key: "itse_app_name" + Value: ${self:service} + - Key: "itse_app_env" + Value: ${self:custom.${sls:stage}_env} + - Key: "itse_app_customer" + Value: "shared" + - Key: "managed_by" + Value: "serverless" TableName: ${self:custom.apiKeyTable}_global ApiKeyDynamoDbTable: Type: AWS::DynamoDB::Table From edca2e26881f0a3ba2a42742bee6bdcfb3073155 Mon Sep 17 00:00:00 2001 From: Matt H Date: Tue, 23 May 2023 16:22:52 -0400 Subject: [PATCH 2/2] Add the required `StreamSpecification` GlobalTable property I don't know whether we use this at all, but in case the way we back up the data uses the stream, I set it to send the new value. Documentation is here: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-globaltable-streamspecification.html --- serverless.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/serverless.yml b/serverless.yml index c21b097..f956c43 100644 --- a/serverless.yml +++ b/serverless.yml @@ -225,6 +225,8 @@ resources: Value: "shared" - Key: "managed_by" Value: "serverless" + StreamSpecification: + StreamViewType: NEW_IMAGE TableName: ${self:custom.apiKeyTable}_global ApiKeyDynamoDbTable: Type: AWS::DynamoDB::Table