This repository has been archived by the owner on Jun 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 107
/
database.template.yaml
85 lines (82 loc) · 2.74 KB
/
database.template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >-
This template creates the database resources for the backend service.
Metadata:
AWS::ServerlessRepo::Application:
Name: realworld-serverless-application-backend-database
Description: >-
This template creates the database resources for the backend service.
Author: AWS Serverless Application Repository
SpdxLicenseId: Apache-2.0
Labels: [github, serverless, sam]
HomePageUrl: https://github.com/awslabs/realworld-serverless-application
SemanticVersion: 0.1.5
SourceCodeUrl: https://github.com/awslabs/realworld-serverless-application/tree/0.1.5
LicenseUrl: ../../../LICENSE
ReadmeUrl: ../../README.md
Parameters:
Stage:
Type: String
Description: The stage where the application is running in, e.g., dev, prod.
Resources:
Applications:
Type: 'AWS::DynamoDB::Table'
Properties:
AttributeDefinitions:
- AttributeName: 'userId'
AttributeType: 'S'
- AttributeName: 'applicationId'
AttributeType: 'S'
KeySchema:
- AttributeName: 'userId'
KeyType: 'HASH'
- AttributeName: 'applicationId'
KeyType: 'RANGE'
StreamSpecification:
StreamViewType: 'NEW_AND_OLD_IMAGES'
TimeToLiveSpecification:
AttributeName: 'ttl'
Enabled: true
BillingMode: PAY_PER_REQUEST
SSESpecification:
SSEEnabled: true
SSEType: KMS
PointInTimeRecoverySpecification:
PointInTimeRecoveryEnabled: true
# Storing resources names to SSM
ApplicationsTableName:
Type: "AWS::SSM::Parameter"
Properties:
Name: !Sub "/applications/apprepo/${Stage}/ddb/Applications/TableName"
Type: "String"
Value: !Ref Applications
Description: "Applications Table name"
ApplicationsTableArn:
Type: "AWS::SSM::Parameter"
Properties:
Name: !Sub "/applications/apprepo/${Stage}/ddb/Applications/TableArn"
Type: "String"
Value: !GetAtt Applications.Arn
Description: "Applications Table name"
ApplicationsTableStreamArn:
Type: "AWS::SSM::Parameter"
Properties:
Name: !Sub "/applications/apprepo/${Stage}/ddb/Applications/StreamArn"
Type: "String"
Value: !GetAtt Applications.StreamArn
Description: "Applications DynamoDB Stream ARN"
ApplicationsTableStreamName:
Type: "AWS::SSM::Parameter"
Properties:
Name: !Sub "/applications/apprepo/${Stage}/ddb/Applications/StreamName"
Type: "String"
Value:
!Select
- 2
- !Split
- '/'
- !Select
- 5
- !Split [':', !GetAtt Applications.StreamArn]
Description: "Applications DynamoDB Stream name"