forked from aws-samples/ecs-refarch-cloudformation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaster.yaml
More file actions
191 lines (169 loc) · 7.98 KB
/
master.yaml
File metadata and controls
191 lines (169 loc) · 7.98 KB
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
Description: >
This template deploys a VPC, with a pair of public and private subnets spread
across two Availabilty Zones. It deploys an Internet Gateway, with a default
route on the public subnets. It deploys a pair of NAT Gateways (one in each AZ),
and default routes for them in the private subnets.
It then deploys a highly available ECS cluster using an AutoScaling Group, with
ECS hosts distributed across multiple Availability Zones.
It then deploys a Highly available RDS Multi Availability Zone database services service using ()
Finally, it deploys a pair of example ECS services from containers published in
Amazon EC2 Container Registry (Amazon ECR).
Based on AWSLabs ECS Reference Arhitecture
https://github.com/awslabs/ecs-refarch-cloudformation
Last Modified: 17th February 2017
Author Dan Carr (ddcarr@gmail.com)
Resources:
VPC:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3-us-west-2.amazonaws.com/cfn-templates-hacko-infra/infrastructure/vpc.yaml
Parameters:
EnvironmentName: !Ref AWS::StackName
VpcCIDR: 10.180.0.0/16
PublicSubnet1CIDR: 10.180.8.0/21
PublicSubnet2CIDR: 10.180.16.0/21
PrivateSubnet1CIDR: 10.180.24.0/21
PrivateSubnet2CIDR: 10.180.32.0/21
SecurityGroups:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3-us-west-2.amazonaws.com/cfn-templates-hacko-infra/infrastructure/security-groups.yaml
Parameters:
EnvironmentName: !Ref AWS::StackName
VPC: !GetAtt VPC.Outputs.VPC
ALB:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3-us-west-2.amazonaws.com/cfn-templates-hacko-infra/infrastructure/load-balancers.yaml
Parameters:
EnvironmentName: !Ref AWS::StackName
VPC: !GetAtt VPC.Outputs.VPC
Subnets: !GetAtt VPC.Outputs.PublicSubnets
SecurityGroup: !GetAtt SecurityGroups.Outputs.LoadBalancerSecurityGroup
ECS:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3-us-west-2.amazonaws.com/cfn-templates-hacko-infra/infrastructure/ecs-cluster.yaml
Parameters:
EnvironmentName: !Ref AWS::StackName
InstanceType: t2.micro
ClusterSize: 2
VPC: !GetAtt VPC.Outputs.VPC
SecurityGroup: !GetAtt SecurityGroups.Outputs.ECSHostSecurityGroup
Subnets: !GetAtt VPC.Outputs.PrivateSubnets
# HomelessRDS:
# Type: AWS::CloudFormation::Stack
# Properties:
# TemplateURL: https://s3-us-west-2.amazonaws.com/cfn-templates-hacko-infra/infrastructure/rds.yaml
# Parameters:
# EnvironmentName: !Ref AWS::StackName
# VPC: !GetAtt VPC.Outputs.VPC
# Subnets: !GetAtt VPC.Outputs.PrivateSubnets
# TheDBIdentifier: 'foinkenstein'
# TheDBName: 'foinkme'
# TheDBUser: 'postgres'
# TheDBPassword: 'postgres'
# TheDBAllocatedStorage: '5'
# TheDBInstanceClass: 'db.t2.micro'
# IsMultiAZDatabase: 'false'
# BudgetService:
# Type: AWS::CloudFormation::Stack
# Properties:
# TemplateURL: https://s3-us-west-2.amazonaws.com/cfn-templates-hacko-infra/services/budget-service/service.yaml
# Parameters:
# VPC: !GetAtt VPC.Outputs.VPC
# Cluster: !GetAtt ECS.Outputs.Cluster
# DesiredCount: 2
# Listener: !GetAtt ALB.Outputs.Listener
# Path: /budget
#
# EmerresponeService:
# Type: AWS::CloudFormation::Stack
# Properties:
# TemplateURL: https://s3-us-west-2.amazonaws.com/cfn-templates-hacko-infra/services/emerresponse-service/service.yaml
# Parameters:
# VPC: !GetAtt VPC.Outputs.VPC
# Cluster: !GetAtt ECS.Outputs.Cluster
# DesiredCount: 2
# Listener: !GetAtt ALB.Outputs.Listener
# Path: /emerresponse
HomelessService:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3-us-west-2.amazonaws.com/cfn-templates-hacko-infra/services/homeless-service/service.yaml
Parameters:
EnvironmentName: !Ref AWS::StackName
VPC: !GetAtt VPC.Outputs.VPC
Subnets: !GetAtt VPC.Outputs.PrivateSubnets
TheDBIdentifier: 'pitondb8' # Your database Identifier
TheDBName: 'alpha8' # Leave it blank for now
TheDBUser: 'postgres' ## master admin user. Will use <postgres>
TheDBPassword: 'postgres' ## <PASSWORD>
TheDBAllocatedStorage: '5'
TheDBInstanceClass: 'db.t2.micro'
IsMultiAZDatabase: 'false' # Change this if you want a multi-az deploy
ProductService:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3-us-west-2.amazonaws.com/cfn-templates-hacko-infra/services/product-service/service.yaml
Parameters:
VPC: !GetAtt VPC.Outputs.VPC
Cluster: !GetAtt ECS.Outputs.Cluster
DesiredCount: 2
Listener: !GetAtt ALB.Outputs.Listener
Path: /products
WebsiteService:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3-us-west-2.amazonaws.com/cfn-templates-hacko-infra/services/website-service/service.yaml
Parameters:
VPC: !GetAtt VPC.Outputs.VPC
Cluster: !GetAtt ECS.Outputs.Cluster
DesiredCount: 2
Listener: !GetAtt ALB.Outputs.Listener
ConfigBucket: ASSIGN9-CONFIG
DeployTarget: INTEGRATION
Path: /homeless/*
# HousingService:
# Type: AWS::CloudFormation::Stack
# Properties:
# TemplateURL: https://s3-us-west-2.amazonaws.com/cfn-templates-hacko-infra/services/housing-service/service.yaml
# Parameters:
# VPC: !GetAtt VPC.Outputs.VPC
# Cluster: !GetAtt ECS.Outputs.Cluster
# DesiredCount: 2
# Listener: !GetAtt ALB.Outputs.Listener
# Path: /housing
#
# TransportationService:
# Type: AWS::CloudFormation::Stack
# Properties:
# TemplateURL: https://s3-us-west-2.amazonaws.com/cfn-templates-hacko-infra/services/transportation-service/service.yaml
# Parameters:
# VPC: !GetAtt VPC.Outputs.VPC
# Cluster: !GetAtt ECS.Outputs.Cluster
# DesiredCount: 2
# Listener: !GetAtt ALB.Outputs.Listener
# Path: /transportation
EndPoints:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3-us-west-2.amazonaws.com/cfn-templates-hacko-infra/services/endpoint-service/service.yaml
Parameters:
VPC: !GetAtt VPC.Outputs.VPC
Cluster: !GetAtt ECS.Outputs.Cluster
DesiredCount: 2
Listener: !GetAtt ALB.Outputs.Listener
ALB: !GetAtt ALB.Outputs.LoadBalancerUrl
Path: /
Outputs:
HomelessServiceUrl:
Description: The URL endpoint for the product service
Value: !Join [ "/", [ !GetAtt ALB.Outputs.LoadBalancerUrl, "homeless" ]]
# ProductServiceUrl:
# Description: The URL endpoint for the product service
# Value: !Join [ "/", [ !GetAtt ALB.Outputs.LoadBalancerUrl, "products" ]]
#
# WebsiteServiceUrl:
# Description: The URL endpoint for the website service
# Value: !Join ["", [ !GetAtt ALB.Outputs.LoadBalancerUrl, "/" ]]