From 1a7b0f2ff77e638968862c6f9bb015b34c8198cd Mon Sep 17 00:00:00 2001 From: MH35JP Date: Tue, 2 Jan 2024 12:20:49 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20:sparkles:=20#23=20DynamoDB=E3=81=AE?= =?UTF-8?q?=E3=83=86=E3=83=BC=E3=83=96=E3=83=AB=E5=AE=9A=E7=BE=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TODO: スキーマに関しては定義が必要そう --- infra/aws/table/formation.yml | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 infra/aws/table/formation.yml diff --git a/infra/aws/table/formation.yml b/infra/aws/table/formation.yml new file mode 100644 index 0000000..532281f --- /dev/null +++ b/infra/aws/table/formation.yml @@ -0,0 +1,63 @@ +AWSTemplateFormatVersion: "2010-09-09" +Description: DynamoDB global table +Parameters: + ApplicationTag: + Type: String + Description: Application tag + ApplicationId: + Type: String + Description: Application ARN + SubRegion: + Type: String + Description: Sub region + Default: ap-northeast-3 + SubRegionApplicationTag: + Type: String + Description: Sub region Application tag +Resources: + # Application relationship definition + AppAssoc: + Type: AWS::ServiceCatalogAppRegistry::ResourceAssociation + Properties: + Application: !Ref ApplicationId + Resource: !Ref AWS::StackId + ResourceType: CFN_STACK + # DynamoDB table definition + # TODO: テーブルスキーマの決定 + Table: + Type: AWS::DynamoDB::GlobalTable + Properties: + AttributeDefinitions: + - AttributeName: id + AttributeType: S + - AttributeName: timestamp + AttributeType: 'N' + BillingMode: PAY_PER_REQUEST + KeySchema: + - AttributeName: id + KeyType: HASH + - AttributeName: timestamp + KeyType: RANGE + Replicas: + - Region: !Ref AWS::Region + PointInTimeRecoverySpecification: + PointInTimeRecoveryEnabled: true + Tags: + - Key: Name + Value: !Sub "${AWS::StackName}-Table-Replica-${AWS::Region}" + - Key: AppManagerCFNStackKey + Value: !Ref AWS::StackName + - Key: awsApplication + Value: !Ref ApplicationTag + - Region: !Ref SubRegion + PointInTimeRecoverySpecification: + PointInTimeRecoveryEnabled: true + Tags: + - Key: Name + Value: !Sub "${AWS::StackName}-Table-Replica-${SubRegion}" + - Key: AppManagerCFNStackKey + Value: !Ref AWS::StackName + - Key: awsApplication + Value: !Ref ApplicationTag + StreamSpecification: + StreamViewType: NEW_AND_OLD_IMAGES