-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
162 lines (139 loc) · 4.49 KB
/
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
AWSTemplateFormatVersion: 2010-09-09
Description: Template to deploy poc for Team City, JIRA environment
Parameters:
CertificateArn:
Description: wildcard certificate for environment
Type: String
Resources:
ALB:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: infrastructure/cfn-alb.yaml
Parameters:
CertificateArn: !Ref CertificateArn
EnvironmentName: !Ref AWS::StackName
PublicSubnets: !GetAtt VPC.Outputs.PublicSubnets
VPC: !GetAtt VPC.Outputs.VPC
ECS:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: infrastructure/cfn-ecs.yaml
Parameters:
ALBSecurityGroup: !GetAtt ALB.Outputs.SecurityGroup
DesiredSize: 1
MinSize: 1
MaxSize: 3
EnvironmentName: !Ref AWS::StackName
InstanceType: r5a.xlarge
RDSEndpointAddress: !GetAtt RDS.Outputs.EndpointAddress
RDSSecurityGroup: !GetAtt RDS.Outputs.SecurityGroup
PrivateSubnets: !GetAtt VPC.Outputs.PrivateSubnets
VPC: !GetAtt VPC.Outputs.VPC
RDS:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: infrastructure/cfn-rds.yaml
Parameters:
EnvironmentName: !Ref AWS::StackName
InstanceType: db.t3.small
MultiAZ: false
PrivateSubnets: !GetAtt VPC.Outputs.PrivateSubnets
VPC: !GetAtt VPC.Outputs.VPC
# ESS:
# Type: AWS::CloudFormation::Stack
# Properties:
# TemplateURL: infrastructure/cfn-ess.yaml
# Parameters:
# EnvironmentName: !Ref AWS::StackName
# ElasticsearchVersion: 7.8
# InstanceType: r5.xlarge
# InstanceCount: 1
# Subnets: !GetAtt VPC.Outputs.PublicSubnets
# VolumeSize: 100
# VPC: !GetAtt VPC.Outputs.VPC
VPC:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: infrastructure/cfn-vpc.yaml
Parameters:
EnvironmentName: !Ref AWS::StackName
VpcCIDR: 10.180.0.0/16
PublicSubnet1CIDR: 10.180.0.0/21
PublicSubnet2CIDR: 10.180.8.0/21
PrivateSubnet1CIDR: 10.180.64.0/21
PrivateSubnet2CIDR: 10.180.72.0/21
# Secrets
RDSJiraSecret:
Type: AWS::SecretsManager::Secret
Properties:
Description: Secret for database user
GenerateSecretString:
GenerateStringKey: password
ExcludePunctuation: true
ExcludeCharacters: '"@/\'
PasswordLength: 16
SecretStringTemplate: '{ "username": "jira" }'
Name: !Sub /${AWS::StackName}/rds/jira/credentials
RDSTeamCitySecret:
Type: AWS::SecretsManager::Secret
Properties:
Description: Secret for database user
GenerateSecretString:
GenerateStringKey: password
ExcludePunctuation: true
ExcludeCharacters: '"@/\'
PasswordLength: 16
SecretStringTemplate: '{ "username": "teamcity" }'
Name: !Sub /${AWS::StackName}/rds/teamcity/credentials
RDSMediaWikiSecret:
Type: AWS::SecretsManager::Secret
Properties:
Description: Secret for database user
GenerateSecretString:
GenerateStringKey: password
ExcludePunctuation: true
ExcludeCharacters: '"@/\'
PasswordLength: 16
SecretStringTemplate: '{ "username": "mediawiki" }'
Name: !Sub /${AWS::StackName}/rds/mediawiki/credentials
Outputs:
ECSCluster:
Value: !GetAtt ECS.Outputs.Cluster
Export:
Name: !Sub ${AWS::StackName}-ecs-cluster
ECSSecurityGroup:
Value: !GetAtt ECS.Outputs.SecurityGroup
Export:
Name: !Sub ${AWS::StackName}-ecs-security-group
LoadBalancerARN:
Value: !GetAtt ALB.Outputs.LoadBalancerARN
Export:
Name: !Sub ${AWS::StackName}-alb-arn
LoadBalancerDNSName:
Value: !GetAtt ALB.Outputs.DomainName
Export:
Name: !Sub ${AWS::StackName}-alb-domain-name
LoadBalancerListener:
Value: !GetAtt ALB.Outputs.ListenerARN
Export:
Name: !Sub ${AWS::StackName}-alb-listener-arn
PublicSubnets:
Value: !GetAtt VPC.Outputs.PublicSubnets
Export:
Name: !Sub ${AWS::StackName}-public-subnets
PrivateSubnets:
Value: !GetAtt VPC.Outputs.PrivateSubnets
Export:
Name: !Sub ${AWS::StackName}-private-subnets
RDSEndpointAddress:
Value: !GetAtt RDS.Outputs.EndpointAddress
Export:
Name: !Sub ${AWS::StackName}-rds-endpoint-address
RDSID:
Value: !GetAtt RDS.Outputs.ID
Export:
Name: !Sub ${AWS::StackName}-rds-id
VPC:
Value: !GetAtt VPC.Outputs.VPC
Export:
Name: !Sub ${AWS::StackName}-vpc