-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
153 lines (138 loc) · 3.68 KB
/
Copy pathserverless.yml
File metadata and controls
153 lines (138 loc) · 3.68 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
service: athvio-cluster
frameworkVersion: "3"
provider:
name: aws
region: ${opt:region, 'us-east-1'}
stage: ${opt:stage}
deploymentBucket:
blockPublicAccess: true
stackTags:
domain-name: athvio
system-name: athvio-cluster
shared-resource: false
environment: ${self:custom.environments.${opt:stage, 'develop'}}
provider: aws
resources:
Parameters:
ClusterName:
Type: String
Default: athvio-cluster
AppContainerPort:
Type: Number
Description: Container port of app requiring LoadBalancer exposure
Default: 56343
Environment:
Type: String
Description: Environment
Default: "0.0.0.0/0"
Cidr:
Type: String
Description: CIDR block for the VPC
Default: "10.0.0.0/16"
PublicSubnetCidr:
Type: String
Description: CIDR block for the public subnet
Default: "10.0.255.0/16"
Resources:
VPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: !Ref Cidr
EnableDnsSupport: true
EnableDnsHostnames: true
Tags:
- Key: Name
Value: athvio-cluster-vpc
InternetGateway:
Type: AWS::EC2::InternetGateway
Properties:
Tags:
- Key: Name
Value: athvio-cluster-igw
VPCGatewayAttachment:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
VpcId: !Ref VPC
InternetGatewayId: !Ref InternetGateway
PublicSubnet:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref VPC
CidrBlock: !Ref PublicSubnetCidr
MapPublicIpOnLaunch: true
Tags:
- Key: Name
Value: athvio-public-subnet
PublicRouteTable:
Type: AWS::EC2::RouteTable
Properties:
VpcId: !Ref VPC
Tags:
- Key: Name
Value: athvio-public-route-table
PublicRoute:
Type: AWS::EC2::Route
Properties:
RouteTableId: !Ref PublicRouteTable
DestinationCidrBlock: "0.0.0.0/0"
GatewayId: !Ref InternetGateway
SubnetRouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
SubnetId: !Ref PublicSubnet
RouteTableId: !Ref PublicRouteTable
SecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Security Group for fargate
VpcId: !Ref VPC
Tags:
- Key: Name
Value: athvio-cluster-security-group
SecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
Description: "Security group ingress throught HTTP"
GroupId: !Ref SecurityGroup
IpProtocol: tcp
FromPort: !Ref AppContainerPort
ToPort: !Ref AppContainerPort
CidrIp: !Ref Environment
SecurityGroupSelfEgressMongodb:
Type: AWS::EC2::SecurityGroupEgress
Properties:
Description: "Security group egress to mongodb database"
GroupId: !Ref SecurityGroup
IpProtocol: "-1"
CidrIp: !Ref Environment
Cluster:
Type: "AWS::ECS::Cluster"
Properties:
ClusterName: !Ref ClusterName
CapacityProviders:
- FARGATE
ClusterSettings:
- Name: "containerInsights"
Value: "enabled"
Outputs:
VPCId:
Value: !Ref VPC
Export:
Name: athvioVpcId
PublicSubnetId:
Value: !Ref PublicSubnet
Export:
Name: athvioPublicSubnetId
SecurityGroupId:
Value: !Ref SecurityGroup
Export:
Name: athvioSecurityGroupId
ClusterName:
Value: !Ref ClusterName
Export:
Name: athvioClusterName
custom:
environments:
develop: develop
staging: staging
prodblue: production