forked from awslabs/ecs-refarch-continuous-deployment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecs-refarch-continuous-deployment.yaml
144 lines (128 loc) · 4.42 KB
/
ecs-refarch-continuous-deployment.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
---
AWSTemplateFormatVersion: 2010-09-09
Description: >
This template shows how to use AWS CodePipeline and AWS CodeBuild to build an
automated continuous deployment pipeline to Amazon Elastic Container Service
(Amazon ECS) using clusters powered by AWS Fargate or Amazon Elastic Compute
Cloud (Amazon EC2).
Parameters:
LaunchType:
Type: String
Default: Fargate
AllowedValues:
- Fargate
- EC2
Description: >
The launch type for your service. Selecting EC2 will create an Auto
Scaling group of t2.micro instances for your cluster. See
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html
to learn more about launch types.
# GitHubUser:
# Type: String
# Description: Your username on GitHub.
#
# GitHubRepo:
# Type: String
# Default: ecs-demo-php-simple-app
# Description: The repo name of the sample service.
#
# GitHubBranch:
# Type: String
# Default: master
# Description: The branch of the repo to continuously deploy.
#
# GitHubToken:
# Type: String
# NoEcho: true
# Description: >
# Token for the user specified above. (https://github.com/settings/tokens)
#
# TemplateBucket:
# Type: String
# Default: ecs-refarch-continuous-deployment
# Description: >
# The S3 bucket from which to fetch the templates used by this stack.
Metadata:
AWS::CloudFormation::Interface:
ParameterLabels:
# GitHubUser:
# default: "User"
# GitHubRepo:
# default: "Repo"
# GitHubBranch:
# default: "Branch"
# GitHubToken:
# default: "Personal Access Token"
LaunchType:
default: "Launch Type"
ParameterGroups:
- Label:
default: Cluster Configuration
Parameters:
- LaunchType
# - Label:
# default: GitHub Configuration
# Parameters:
# - GitHubRepo
# - GitHubBranch
# - GitHubUser
# - GitHubToken
# - Label:
# default: Stack Configuration
# Parameters:
# - TemplateBucket
Resources:
Cluster:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: "https://raw.githubusercontent.com/vongkim/ecs-refarch-continuous-deployment/master/templates/ecs-cluster.yaml"
Parameters:
LaunchType: !Ref LaunchType
SourceSecurityGroup: !GetAtt LoadBalancer.Outputs.SecurityGroup
Subnets: !GetAtt VPC.Outputs.Subnets
VpcId: !GetAtt VPC.Outputs.VpcId
# DeploymentPipeline:
# Type: AWS::CloudFormation::Stack
# Properties:
# TemplateURL: "https://raw.githubusercontent.com/vongkim/ecs-refarch-continuous-deployment/master/templates/deployment-pipeline.yaml"
# Parameters:
# Cluster: !GetAtt Cluster.Outputs.ClusterName
# Service: !GetAtt Service.Outputs.Service
# GitHubUser: !Ref GitHubUser
# GitHubToken: !Ref GitHubToken
# GitHubRepo: !Ref GitHubRepo
# GitHubBranch: !Ref GitHubBranch
LoadBalancer:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: "https://raw.githubusercontent.com/vongkim/ecs-refarch-continuous-deployment/master/templates/load-balancer.yaml"
Parameters:
LaunchType: !Ref LaunchType
Subnets: !GetAtt VPC.Outputs.Subnets
VpcId: !GetAtt VPC.Outputs.VpcId
VPC:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: "https://raw.githubusercontent.com/vongkim/ecs-refarch-continuous-deployment/master/templates/vpc.yaml"
Parameters:
Name: !Ref AWS::StackName
VpcCIDR: 10.215.0.0/16
Subnet1CIDR: 10.215.10.0/24
Subnet2CIDR: 10.215.20.0/24
# Service:
# Type: AWS::CloudFormation::Stack
# Properties:
# TemplateURL: !Sub "https://s3.amazonaws.com/${TemplateBucket}/templates/service.yaml"
# Parameters:
# Cluster: !GetAtt Cluster.Outputs.ClusterName
# LaunchType: !Ref LaunchType
# TargetGroup: !GetAtt LoadBalancer.Outputs.TargetGroup
# SourceSecurityGroup: !GetAtt LoadBalancer.Outputs.SecurityGroup
# Subnets: !GetAtt VPC.Outputs.Subnets
Outputs:
ServiceUrl:
Description: The sample service that is being continuously deployed.
Value: !GetAtt LoadBalancer.Outputs.ServiceUrl
# PipelineUrl:
# Description: The continuous deployment pipeline in the AWS Management Console.
# Value: !GetAtt DeploymentPipeline.Outputs.PipelineUrl