|
| 1 | +Parameters: |
| 2 | + EnviromentName: |
| 3 | + Description: An environment name that will be prefixed to resource names |
| 4 | + Type: String |
| 5 | + AllowedValues: [poc, dev, uat] |
| 6 | + Default: poc |
| 7 | + VPC: |
| 8 | + Description: Choose which VPC the security groups should be deployed to |
| 9 | + Type: AWS::EC2::VPC::Id |
| 10 | + Subnets: |
| 11 | + Description: Subnets for LoadBalancer |
| 12 | + Type: List<AWS::EC2::Subnet::Id> |
| 13 | + Ec2InstanceType: |
| 14 | + Description: Instance Type of ecs ec2 cluster |
| 15 | + Type: String |
| 16 | + AllowedValues: [ t2.micro, t2.small, t2.medium, t2.large, t2.xlarge, t2.2xlarge, |
| 17 | + m5.large, m5.xlarge, m5.2large, m5.4xlarge, m5.12xlarge, m5.24large, |
| 18 | + c5.large, c5.xlarge, c5.2xlarge, c5.4xlarge, c5.9xlarge, c5.18xlarge, |
| 19 | + r5.large, r5.xlarge, r5.2xlarge, r5.4xlarge, r5.12xlarge, r5.24xlarge ] |
| 20 | + UserServicePath: |
| 21 | + Description: The path to register with the Application Load Balancer |
| 22 | + Type: String |
| 23 | + Default: /users |
| 24 | + DeptServicePath: |
| 25 | + Description: The path to register with the Application Load Balancer |
| 26 | + Type: String |
| 27 | + Default: /dept |
| 28 | + |
| 29 | + |
| 30 | +Resources: |
| 31 | + SecurityGroupsStack: |
| 32 | + Type: AWS::CloudFormation::Stack |
| 33 | + Properties: |
| 34 | + TemplateURL: https://aws-practice-001.s3.amazonaws.com/securitygroups.yaml |
| 35 | + Parameters: |
| 36 | + EnviromentName: !Ref EnviromentName |
| 37 | + VPC: !Ref VPC |
| 38 | + Stackname: !Sub ${AWS::StackName} |
| 39 | + TimeoutInMinutes: 5 |
| 40 | + |
| 41 | + |
| 42 | + LoadBalancerStack: |
| 43 | + Type: AWS::CloudFormation::Stack |
| 44 | + Properties: |
| 45 | + TemplateURL: https://aws-practice-001.s3.amazonaws.com/loadbalancer.yaml |
| 46 | + Parameters: |
| 47 | + EnviromentName: !Ref EnviromentName |
| 48 | + Stackname: !Sub ${AWS::StackName} |
| 49 | + LoadBalancerSecurityGroup: !GetAtt SecurityGroupsStack.Outputs.LoadBalancerSecurityGroup |
| 50 | + LoadBalancerSubnets: !Join [",",!Ref Subnets] |
| 51 | + VPC: !Ref VPC |
| 52 | + TimeoutInMinutes: 5 |
| 53 | + |
| 54 | + |
| 55 | + EcsClusterStack: |
| 56 | + Type: AWS::CloudFormation::Stack |
| 57 | + Properties: |
| 58 | + TemplateURL: https://aws-practice-001.s3.amazonaws.com/ecs-cluster.yaml |
| 59 | + Parameters: |
| 60 | + EnviromentName: !Ref EnviromentName |
| 61 | + Stackname: !Sub ${AWS::StackName} |
| 62 | + LoadBalancerSubnets: !Join [",",!Ref Subnets] |
| 63 | + EC2ClusterSecurityGroup: !GetAtt SecurityGroupsStack.Outputs.EC2ClusterSecurityGroup |
| 64 | + SshSecurityGroup: !GetAtt SecurityGroupsStack.Outputs.SshSecurityGroup |
| 65 | + Ec2InstanceType: !Ref Ec2InstanceType |
| 66 | + TimeoutInMinutes: 5 |
| 67 | + |
| 68 | + LogGroupStack: |
| 69 | + Type: AWS::CloudFormation::Stack |
| 70 | + Properties: |
| 71 | + TemplateURL: https://aws-practice-001.s3.amazonaws.com/logs.yaml |
| 72 | + Parameters: |
| 73 | + EnviromentName: !Ref EnviromentName |
| 74 | + Stackname: !Sub ${AWS::StackName} |
| 75 | + TimeoutInMinutes: 5 |
| 76 | + |
| 77 | + UserService: |
| 78 | + Type: AWS::CloudFormation::Stack |
| 79 | + Properties: |
| 80 | + TemplateURL: https://aws-practice-001.s3.amazonaws.com/users-service.yaml |
| 81 | + Parameters: |
| 82 | + EnviromentName: !Ref EnviromentName |
| 83 | + Stackname: !Sub ${AWS::StackName} |
| 84 | + VPC: !Ref VPC |
| 85 | + Cluster: !GetAtt EcsClusterStack.Outputs.Cluster |
| 86 | + Path: !Ref UserServicePath |
| 87 | + LoadBalancerListener: !GetAtt LoadBalancerStack.Outputs.LoadBalancerListener |
| 88 | + LogGroupName: !GetAtt LogGroupStack.Outputs.LogGroupName |
| 89 | + TimeoutInMinutes: 5 |
| 90 | + |
| 91 | + DeptService: |
| 92 | + Type: AWS::CloudFormation::Stack |
| 93 | + Properties: |
| 94 | + TemplateURL: https://aws-practice-001.s3.amazonaws.com/dept-service.yaml |
| 95 | + Parameters: |
| 96 | + EnviromentName: !Ref EnviromentName |
| 97 | + Stackname: !Sub ${AWS::StackName} |
| 98 | + VPC: !Ref VPC |
| 99 | + Cluster: !GetAtt EcsClusterStack.Outputs.Cluster |
| 100 | + Path: !Ref DeptServicePath |
| 101 | + LoadBalancerListener: !GetAtt LoadBalancerStack.Outputs.LoadBalancerListener |
| 102 | + LogGroupName: !GetAtt LogGroupStack.Outputs.LogGroupName |
| 103 | + TimeoutInMinutes: 5 |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
0 commit comments