-
Notifications
You must be signed in to change notification settings - Fork 265
/
docker-compose.prod.scaling.yaml
58 lines (56 loc) · 1.58 KB
/
docker-compose.prod.scaling.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
services:
backend:
cap_add:
- SYS_PTRACE
deploy:
replicas: 2
# resources:
# limits:
# memory: 2Gb
# cpus: '0.5'
x-aws-autoscaling:
min: 1
max: 10 #required
cpu: 75
x-aws-cloudformation:
Transform: AWS::SecretsManager-2020-07-23
Outputs:
MySQL:
Description: RDSInstance Endpoint
Value:
Fn::GetAtt :
- MySQL
- Endpoint.Address
Resources:
DBSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
SecurityGroupIngress:
- IpProtocol: "-1"
CidrIp : 172.31.0.0/16
GroupDescription: "Ingress Rule for DBSecurity"
RDSInstanceSecret:
Type: AWS::SecretsManager::Secret
Properties:
Description: 'This is the secret for my RDS instance'
Name: RDSInstanceSecret
GenerateSecretString:
SecretStringTemplate: '{"username": "admin"}'
GenerateStringKey: 'password'
PasswordLength: 16
ExcludeCharacters: '"@/\'
MySQL:
Type: AWS::RDS::DBInstance
DependsOn: RDSInstanceSecret
Properties:
VPCSecurityGroups:
- Fn::GetAtt :
- DBSecurityGroup
- GroupId
DBName: workshop
DBInstanceClass: db.t2.micro
AllocatedStorage: 20
Engine: MySQL
EngineVersion: 8.0.23
MasterUsername: '{{resolve:secretsmanager:RDSInstanceSecret:SecretString:username}}'
MasterUserPassword: '{{resolve:secretsmanager:RDSInstanceSecret:SecretString:password}}'