-
Notifications
You must be signed in to change notification settings - Fork 0
/
sam.yaml
86 lines (86 loc) · 2.7 KB
/
sam.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
86
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Creates resources for mftracer
Parameters:
# see env/example.env about parameters
KinesisStreamShardNum:
Type: Number
Default: 1
NetworkStackName:
Type: String
MinLength: 1
MaxLength: 255
AllowedPattern: "^[a-zA-Z][-a-zA-Z0-9]*$"
DBUsername:
AllowedPattern: "[a-zA-Z0-9]+"
ConstraintDescription: must be between 1 to 16 alphanumeric characters.
Description: The database admin account user name, between 1 to 16 alphanumeric characters.
MaxLength: '16'
MinLength: '1'
Type: String
DBPassword:
AllowedPattern: "[a-zA-Z0-9]+"
ConstraintDescription: must be between 8 to 41 alphanumeric characters.
Description: The database admin account password, between 8 to 41 alphanumeric characters.
MaxLength: '41'
MinLength: '8'
NoEcho: 'true'
Type: String
DBInstanceClass:
Default: db.t2.micro
Type: String
ConstraintDescription: DB instance class not supported
AllowedValues:
- db.t2.micro
- db.t2.small
- db.t2.medium
- db.t2.xlarge
- db.r4.large
- db.r4.xlarge
- db.r4.2xlarge
- db.r4.4xlarge
- db.r4.8xlarge
- db.r4.16xlarge
DBAllocatedStorageSize:
Default: 20
Type: Number
MaxValue: 1600
MinValue: 20
Resources:
KinesisStream:
Type: AWS::Kinesis::Stream
Properties:
ShardCount: !Ref KinesisStreamShardNum
DBSubnetGroup:
Type: AWS::RDS::DBSubnetGroup
Properties:
DBSubnetGroupDescription: 'subnet group for mftracer'
SubnetIds:
- Fn::ImportValue: !Join ['-', [!Ref 'AWS::Region', !Sub '${NetworkStackName}', 'PublicSubnet1']]
- Fn::ImportValue: !Join ['-', [!Ref 'AWS::Region', !Sub '${NetworkStackName}', 'PublicSubnet2']]
Tags:
- Key: Name
Value: !Ref AWS::StackName
DBInstance:
Type: AWS::RDS::DBInstance
Properties:
DBName: "mftracer"
DBParameterGroupName: "default.postgres10"
DBInstanceClass: !Ref "DBInstanceClass"
DBSubnetGroupName: !Ref "DBSubnetGroup"
Engine: "postgres"
EngineVersion: "10.1"
MasterUsername: !Ref "DBUsername"
MasterUserPassword: !Ref "DBPassword"
AllocatedStorage: !Ref "DBAllocatedStorageSize"
VPCSecurityGroups:
- Fn::ImportValue: !Join ['-', [!Ref 'AWS::Region', !Sub '${NetworkStackName}', 'DefaultSecurityGroup']]
Outputs:
KinesisStreamsId:
Value: !Ref KinesisStream
Export:
Name: !Join ['-', [!Ref 'AWS::Region', !Sub '${AWS::StackName}', 'KinesisStreamsId']]
RDSIdentifier:
Value: !Ref DBInstance
Export:
Name: !Join ['-', [!Ref 'AWS::Region', !Sub '${AWS::StackName}', 'RDSIdentifier']]