-
Notifications
You must be signed in to change notification settings - Fork 2
/
stack.cf.yml
94 lines (81 loc) · 3.56 KB
/
stack.cf.yml
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
Description: >
This template builds from the github.com/awslabs/ecs-refarch-cloudformation
project and adds additional configuration to deploy the project as Jenkins.
Last Modified: 19th February 2018
Author: Chris W. Gerber <[email protected]>
Parameters:
JenkinsRepo:
Description: Please provide the image that Jenkins should use.
Type: String
Default: ''
AdminUsername:
Description: Please provide the ECS Cluster ID that this service should run on
Type: String
NoEcho: true
AdminPassword:
Description: Please provide the ECS Cluster ID that this service should run on
Type: String
NoEcho: true
Conditions:
UseEcrJenkins: !Equals [ !Ref JenkinsRepo, '' ]
Resources:
VPC:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3.amazonaws.com/jenkins-ecs-refarch-cloudformation/infrastructure/vpc.yml
Parameters:
EnvironmentName: !Ref AWS::StackName
VpcCIDR: 10.180.0.0/16
PublicSubnet1CIDR: 10.180.8.0/21
PublicSubnet2CIDR: 10.180.16.0/21
SecurityGroups:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3.amazonaws.com/jenkins-ecs-refarch-cloudformation/infrastructure/security-groups.yml
Parameters:
EnvironmentName: !Ref AWS::StackName
VPC: !GetAtt VPC.Outputs.VPC
ELB:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3.amazonaws.com/jenkins-ecs-refarch-cloudformation/infrastructure/load-balancer.yml
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.amazonaws.com/jenkins-ecs-refarch-cloudformation/infrastructure/ecs-cluster.yml
Parameters:
EnvironmentName: !Ref AWS::StackName
InstanceType: t2.medium
ClusterSize: 1
VPC: !GetAtt VPC.Outputs.VPC
SecurityGroup: !GetAtt SecurityGroups.Outputs.ECSHostSecurityGroup
Subnets: !GetAtt VPC.Outputs.PublicSubnets
ECR:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3.amazonaws.com/jenkins-ecs-refarch-cloudformation/infrastructure/ecr-repository.yml
Parameters:
EnvironmentName: !Ref AWS::StackName
RepositoryName: 'jenkins'
Jenkins:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3.amazonaws.com/jenkins-ecs-refarch-cloudformation/jenkins/jenkins.yml
Parameters:
VPC: !GetAtt VPC.Outputs.VPC
Cluster: !GetAtt ECS.Outputs.Cluster
JenkinsImage:
!If
- UseEcrJenkins
- !Sub ${ECR.Outputs.RepositoryUri}:1.0.0
- !Ref JenkinsRepo
LoadBalancerUrl: !GetAtt ELB.Outputs.LoadBalancerUrl
Listener: !GetAtt ELB.Outputs.Listener
ECSServiceAutoScalingRoleARN: !GetAtt ECS.Outputs.ECSServiceAutoScalingRoleArn
AdminUsername: !Ref AdminUsername
AdminPassword: !Ref AdminPassword