Showing
131 changed files
with
5021 additions
and
1 deletions
infra_code @ 5fffd3a4
| 1 | -Subproject commit 5fffd3a4f66d68db249c923f44c48b6d84f798b8 |
infra_code/.DS_Store
0 → 100644
No preview for this file type
infra_code/.history/README_20190530161207.md
0 → 100644
File mode changed
infra_code/.history/README_20190530161237.md
0 → 100644
This diff is collapsed. Click to expand it.
infra_code/.history/README_20190530161827.md
0 → 100644
This diff is collapsed. Click to expand it.
infra_code/.history/README_20190530162249.md
0 → 100644
This diff is collapsed. Click to expand it.
infra_code/.history/README_20190530163904.md
0 → 100644
This diff is collapsed. Click to expand it.
infra_code/.history/README_20190530163917.md
0 → 100644
This diff is collapsed. Click to expand it.
File mode changed
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: testLoadbalancer | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + - autoscaling:* | ||
| 115 | + Resource: "*" | ||
| 116 | + - | ||
| 117 | + Effect: Allow | ||
| 118 | + Action: | ||
| 119 | + - ec2:* | ||
| 120 | + - autoscaling:* | ||
| 121 | + Resource: "*" | ||
| 122 | + WebappRole: | ||
| 123 | + Type: "AWS::IAM::Role" | ||
| 124 | + Properties: | ||
| 125 | + AssumeRolePolicyDocument: | ||
| 126 | + Version: "2012-10-17" | ||
| 127 | + Statement: | ||
| 128 | + - | ||
| 129 | + Effect: "Allow" | ||
| 130 | + Principal: | ||
| 131 | + Service: | ||
| 132 | + - "ec2.amazonaws.com" | ||
| 133 | + - "codedeploy.amazonaws.com" | ||
| 134 | + Action: | ||
| 135 | + - "sts:AssumeRole" | ||
| 136 | + Policies: | ||
| 137 | + - | ||
| 138 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 139 | + PolicyDocument: | ||
| 140 | + Version: "2012-10-17" | ||
| 141 | + Statement: | ||
| 142 | + - | ||
| 143 | + Effect: "Allow" | ||
| 144 | + Action: "s3:getObject" | ||
| 145 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 146 | + WebappInstanceProfile: | ||
| 147 | + Type: "AWS::IAM::InstanceProfile" | ||
| 148 | + Properties: | ||
| 149 | + Roles: | ||
| 150 | + - Ref: WebappRole | ||
| 151 | + WebappLaunchConfig: | ||
| 152 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 153 | + Properties: | ||
| 154 | + AssociatePublicIpAddress: true | ||
| 155 | + ImageId: | ||
| 156 | + Ref: AMIID | ||
| 157 | + InstanceType: t2.micro | ||
| 158 | + KeyName: | ||
| 159 | + Ref: KeyName | ||
| 160 | + SecurityGroups: | ||
| 161 | + - Ref: WebappSecurityGroup | ||
| 162 | + IamInstanceProfile: | ||
| 163 | + Ref: WebappInstanceProfile | ||
| 164 | + UserData: | ||
| 165 | + Fn::Base64: !Sub | | ||
| 166 | + #! /bin/bash -xe | ||
| 167 | + # update yum just in case | ||
| 168 | + yum update -y | ||
| 169 | + # get node into yum | ||
| 170 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 171 | + # install node and npm in one line | ||
| 172 | + yum install -y nodejs | ||
| 173 | + install pm2 to restart node app | ||
| 174 | + npm i -g pm2@2.4.3 | ||
| 175 | + AutoScalingGroup: | ||
| 176 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 177 | + Properties: | ||
| 178 | + HealthCheckType: ELB | ||
| 179 | + HealthCheckGracePeriod: 300 | ||
| 180 | + MinSize: | ||
| 181 | + Ref: MinSize | ||
| 182 | + MaxSize: | ||
| 183 | + Ref: MaxSize | ||
| 184 | + LaunchConfigurationName: | ||
| 185 | + Ref: WebappLaunchConfig | ||
| 186 | + VPCZoneIdentifier: | ||
| 187 | + Ref: WebappSubnets | ||
| 188 | + TargetGroupARNs: | ||
| 189 | + - Ref: ALBTargetGroup | ||
| 190 | + Tags: | ||
| 191 | + - Key: Name | ||
| 192 | + Value: webapp-example | ||
| 193 | + PropagateAtLaunch: true | ||
| 194 | + ALBListener: | ||
| 195 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 196 | + Properties: | ||
| 197 | + DefaultActions: | ||
| 198 | + - | ||
| 199 | + Type: forward | ||
| 200 | + TargetGroupArn: | ||
| 201 | + Ref: ALBTargetGroup | ||
| 202 | + LoadBalancerArn: | ||
| 203 | + Ref: ApplicationLoadBalancer | ||
| 204 | + Port: 80 | ||
| 205 | + Protocol: HTTP | ||
| 206 | + ApplicationLoadBalancer: | ||
| 207 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 208 | + Properties: | ||
| 209 | + Name: testLoadbalancer | ||
| 210 | + Scheme: internet-facing | ||
| 211 | + Subnets: | ||
| 212 | + Ref: ALBSubnets | ||
| 213 | + SecurityGroups: | ||
| 214 | + - Ref: ALBSecurityGroup | ||
| 215 | + ALBTargetGroup: | ||
| 216 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 217 | + Properties: | ||
| 218 | + HealthCheckIntervalSeconds: 30 | ||
| 219 | + UnhealthyThresholdCount: 2 | ||
| 220 | + HealthyThresholdCount: 2 | ||
| 221 | + HealthCheckPath: / | ||
| 222 | + Port: 3000 | ||
| 223 | + Protocol: HTTP | ||
| 224 | + VpcId: | ||
| 225 | + Ref: VPC | ||
| 226 | +Outputs: | ||
| 227 | + WebappUrl: | ||
| 228 | + Description: Webapp URL | ||
| 229 | + Value: !GetAtt ApplicationLoadBalancer.DNSName | ||
| 230 | + DeploymentGroup: | ||
| 231 | + Description: Webapp Deployment Group | ||
| 232 | + Value: !Ref WebappDeploymentGroup | ||
| 233 | + DeploymentBucket: | ||
| 234 | + Description: Deployment bucket | ||
| 235 | + Value: !Ref WebappDeploymentBucket | ||
| 236 | + ApplicationName: | ||
| 237 | + Description: CodeDeploy Application name | ||
| 238 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: testLoadbalancer | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + - autoscaling:* | ||
| 115 | + Resource: "*" | ||
| 116 | + - | ||
| 117 | + Effect: Allow | ||
| 118 | + Action: | ||
| 119 | + - elasticloadbalancing:* | ||
| 120 | + Resource: "*" | ||
| 121 | + WebappRole: | ||
| 122 | + Type: "AWS::IAM::Role" | ||
| 123 | + Properties: | ||
| 124 | + AssumeRolePolicyDocument: | ||
| 125 | + Version: "2012-10-17" | ||
| 126 | + Statement: | ||
| 127 | + - | ||
| 128 | + Effect: "Allow" | ||
| 129 | + Principal: | ||
| 130 | + Service: | ||
| 131 | + - "ec2.amazonaws.com" | ||
| 132 | + - "codedeploy.amazonaws.com" | ||
| 133 | + Action: | ||
| 134 | + - "sts:AssumeRole" | ||
| 135 | + Policies: | ||
| 136 | + - | ||
| 137 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 138 | + PolicyDocument: | ||
| 139 | + Version: "2012-10-17" | ||
| 140 | + Statement: | ||
| 141 | + - | ||
| 142 | + Effect: "Allow" | ||
| 143 | + Action: "s3:getObject" | ||
| 144 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 145 | + WebappInstanceProfile: | ||
| 146 | + Type: "AWS::IAM::InstanceProfile" | ||
| 147 | + Properties: | ||
| 148 | + Roles: | ||
| 149 | + - Ref: WebappRole | ||
| 150 | + WebappLaunchConfig: | ||
| 151 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 152 | + Properties: | ||
| 153 | + AssociatePublicIpAddress: true | ||
| 154 | + ImageId: | ||
| 155 | + Ref: AMIID | ||
| 156 | + InstanceType: t2.micro | ||
| 157 | + KeyName: | ||
| 158 | + Ref: KeyName | ||
| 159 | + SecurityGroups: | ||
| 160 | + - Ref: WebappSecurityGroup | ||
| 161 | + IamInstanceProfile: | ||
| 162 | + Ref: WebappInstanceProfile | ||
| 163 | + UserData: | ||
| 164 | + Fn::Base64: !Sub | | ||
| 165 | + #! /bin/bash -xe | ||
| 166 | + # update yum just in case | ||
| 167 | + yum update -y | ||
| 168 | + # get node into yum | ||
| 169 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 170 | + # install node and npm in one line | ||
| 171 | + yum install -y nodejs | ||
| 172 | + install pm2 to restart node app | ||
| 173 | + npm i -g pm2@2.4.3 | ||
| 174 | + AutoScalingGroup: | ||
| 175 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 176 | + Properties: | ||
| 177 | + HealthCheckType: ELB | ||
| 178 | + HealthCheckGracePeriod: 300 | ||
| 179 | + MinSize: | ||
| 180 | + Ref: MinSize | ||
| 181 | + MaxSize: | ||
| 182 | + Ref: MaxSize | ||
| 183 | + LaunchConfigurationName: | ||
| 184 | + Ref: WebappLaunchConfig | ||
| 185 | + VPCZoneIdentifier: | ||
| 186 | + Ref: WebappSubnets | ||
| 187 | + TargetGroupARNs: | ||
| 188 | + - Ref: ALBTargetGroup | ||
| 189 | + Tags: | ||
| 190 | + - Key: Name | ||
| 191 | + Value: webapp-example | ||
| 192 | + PropagateAtLaunch: true | ||
| 193 | + ALBListener: | ||
| 194 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 195 | + Properties: | ||
| 196 | + DefaultActions: | ||
| 197 | + - | ||
| 198 | + Type: forward | ||
| 199 | + TargetGroupArn: | ||
| 200 | + Ref: ALBTargetGroup | ||
| 201 | + LoadBalancerArn: | ||
| 202 | + Ref: ApplicationLoadBalancer | ||
| 203 | + Port: 80 | ||
| 204 | + Protocol: HTTP | ||
| 205 | + ApplicationLoadBalancer: | ||
| 206 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 207 | + Properties: | ||
| 208 | + Name: testLoadbalancer | ||
| 209 | + Scheme: internet-facing | ||
| 210 | + Subnets: | ||
| 211 | + Ref: ALBSubnets | ||
| 212 | + SecurityGroups: | ||
| 213 | + - Ref: ALBSecurityGroup | ||
| 214 | + ALBTargetGroup: | ||
| 215 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 216 | + Properties: | ||
| 217 | + HealthCheckIntervalSeconds: 30 | ||
| 218 | + UnhealthyThresholdCount: 2 | ||
| 219 | + HealthyThresholdCount: 2 | ||
| 220 | + HealthCheckPath: / | ||
| 221 | + Port: 3000 | ||
| 222 | + Protocol: HTTP | ||
| 223 | + VpcId: | ||
| 224 | + Ref: VPC | ||
| 225 | +Outputs: | ||
| 226 | + WebappUrl: | ||
| 227 | + Description: Webapp URL | ||
| 228 | + Value: !GetAtt ApplicationLoadBalancer.DNSName | ||
| 229 | + DeploymentGroup: | ||
| 230 | + Description: Webapp Deployment Group | ||
| 231 | + Value: !Ref WebappDeploymentGroup | ||
| 232 | + DeploymentBucket: | ||
| 233 | + Description: Deployment bucket | ||
| 234 | + Value: !Ref WebappDeploymentBucket | ||
| 235 | + ApplicationName: | ||
| 236 | + Description: CodeDeploy Application name | ||
| 237 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: testLoadbalancer | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + Resource: "*" | ||
| 115 | + - | ||
| 116 | + Effect: Allow | ||
| 117 | + Action: | ||
| 118 | + - elasticloadbalancing:* | ||
| 119 | + Resource: "*" | ||
| 120 | + WebappRole: | ||
| 121 | + Type: "AWS::IAM::Role" | ||
| 122 | + Properties: | ||
| 123 | + AssumeRolePolicyDocument: | ||
| 124 | + Version: "2012-10-17" | ||
| 125 | + Statement: | ||
| 126 | + - | ||
| 127 | + Effect: "Allow" | ||
| 128 | + Principal: | ||
| 129 | + Service: | ||
| 130 | + - "ec2.amazonaws.com" | ||
| 131 | + - "codedeploy.amazonaws.com" | ||
| 132 | + Action: | ||
| 133 | + - "sts:AssumeRole" | ||
| 134 | + Policies: | ||
| 135 | + - | ||
| 136 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 137 | + PolicyDocument: | ||
| 138 | + Version: "2012-10-17" | ||
| 139 | + Statement: | ||
| 140 | + - | ||
| 141 | + Effect: "Allow" | ||
| 142 | + Action: "s3:getObject" | ||
| 143 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 144 | + WebappInstanceProfile: | ||
| 145 | + Type: "AWS::IAM::InstanceProfile" | ||
| 146 | + Properties: | ||
| 147 | + Roles: | ||
| 148 | + - Ref: WebappRole | ||
| 149 | + WebappLaunchConfig: | ||
| 150 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 151 | + Properties: | ||
| 152 | + AssociatePublicIpAddress: true | ||
| 153 | + ImageId: | ||
| 154 | + Ref: AMIID | ||
| 155 | + InstanceType: t2.micro | ||
| 156 | + KeyName: | ||
| 157 | + Ref: KeyName | ||
| 158 | + SecurityGroups: | ||
| 159 | + - Ref: WebappSecurityGroup | ||
| 160 | + IamInstanceProfile: | ||
| 161 | + Ref: WebappInstanceProfile | ||
| 162 | + UserData: | ||
| 163 | + Fn::Base64: !Sub | | ||
| 164 | + #! /bin/bash -xe | ||
| 165 | + # update yum just in case | ||
| 166 | + yum update -y | ||
| 167 | + # get node into yum | ||
| 168 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 169 | + # install node and npm in one line | ||
| 170 | + yum install -y nodejs | ||
| 171 | + install pm2 to restart node app | ||
| 172 | + npm i -g pm2@2.4.3 | ||
| 173 | + AutoScalingGroup: | ||
| 174 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 175 | + Properties: | ||
| 176 | + HealthCheckType: ELB | ||
| 177 | + HealthCheckGracePeriod: 300 | ||
| 178 | + MinSize: | ||
| 179 | + Ref: MinSize | ||
| 180 | + MaxSize: | ||
| 181 | + Ref: MaxSize | ||
| 182 | + LaunchConfigurationName: | ||
| 183 | + Ref: WebappLaunchConfig | ||
| 184 | + VPCZoneIdentifier: | ||
| 185 | + Ref: WebappSubnets | ||
| 186 | + TargetGroupARNs: | ||
| 187 | + - Ref: ALBTargetGroup | ||
| 188 | + Tags: | ||
| 189 | + - Key: Name | ||
| 190 | + Value: webapp-example | ||
| 191 | + PropagateAtLaunch: true | ||
| 192 | + ALBListener: | ||
| 193 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 194 | + Properties: | ||
| 195 | + DefaultActions: | ||
| 196 | + - | ||
| 197 | + Type: forward | ||
| 198 | + TargetGroupArn: | ||
| 199 | + Ref: ALBTargetGroup | ||
| 200 | + LoadBalancerArn: | ||
| 201 | + Ref: ApplicationLoadBalancer | ||
| 202 | + Port: 80 | ||
| 203 | + Protocol: HTTP | ||
| 204 | + ApplicationLoadBalancer: | ||
| 205 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 206 | + Properties: | ||
| 207 | + Name: testLoadbalancer | ||
| 208 | + Scheme: internet-facing | ||
| 209 | + Subnets: | ||
| 210 | + Ref: ALBSubnets | ||
| 211 | + SecurityGroups: | ||
| 212 | + - Ref: ALBSecurityGroup | ||
| 213 | + ALBTargetGroup: | ||
| 214 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 215 | + Properties: | ||
| 216 | + HealthCheckIntervalSeconds: 30 | ||
| 217 | + UnhealthyThresholdCount: 2 | ||
| 218 | + HealthyThresholdCount: 2 | ||
| 219 | + HealthCheckPath: / | ||
| 220 | + Port: 3000 | ||
| 221 | + Protocol: HTTP | ||
| 222 | + VpcId: | ||
| 223 | + Ref: VPC | ||
| 224 | +Outputs: | ||
| 225 | + WebappUrl: | ||
| 226 | + Description: Webapp URL | ||
| 227 | + Value: !GetAtt ApplicationLoadBalancer.DNSName | ||
| 228 | + DeploymentGroup: | ||
| 229 | + Description: Webapp Deployment Group | ||
| 230 | + Value: !Ref WebappDeploymentGroup | ||
| 231 | + DeploymentBucket: | ||
| 232 | + Description: Deployment bucket | ||
| 233 | + Value: !Ref WebappDeploymentBucket | ||
| 234 | + ApplicationName: | ||
| 235 | + Description: CodeDeploy Application name | ||
| 236 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: !Ref ApplicationLoadBalancer: | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + Resource: "*" | ||
| 115 | + - | ||
| 116 | + Effect: Allow | ||
| 117 | + Action: | ||
| 118 | + - elasticloadbalancing:* | ||
| 119 | + Resource: "*" | ||
| 120 | + WebappRole: | ||
| 121 | + Type: "AWS::IAM::Role" | ||
| 122 | + Properties: | ||
| 123 | + AssumeRolePolicyDocument: | ||
| 124 | + Version: "2012-10-17" | ||
| 125 | + Statement: | ||
| 126 | + - | ||
| 127 | + Effect: "Allow" | ||
| 128 | + Principal: | ||
| 129 | + Service: | ||
| 130 | + - "ec2.amazonaws.com" | ||
| 131 | + - "codedeploy.amazonaws.com" | ||
| 132 | + Action: | ||
| 133 | + - "sts:AssumeRole" | ||
| 134 | + Policies: | ||
| 135 | + - | ||
| 136 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 137 | + PolicyDocument: | ||
| 138 | + Version: "2012-10-17" | ||
| 139 | + Statement: | ||
| 140 | + - | ||
| 141 | + Effect: "Allow" | ||
| 142 | + Action: "s3:getObject" | ||
| 143 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 144 | + WebappInstanceProfile: | ||
| 145 | + Type: "AWS::IAM::InstanceProfile" | ||
| 146 | + Properties: | ||
| 147 | + Roles: | ||
| 148 | + - Ref: WebappRole | ||
| 149 | + WebappLaunchConfig: | ||
| 150 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 151 | + Properties: | ||
| 152 | + AssociatePublicIpAddress: true | ||
| 153 | + ImageId: | ||
| 154 | + Ref: AMIID | ||
| 155 | + InstanceType: t2.micro | ||
| 156 | + KeyName: | ||
| 157 | + Ref: KeyName | ||
| 158 | + SecurityGroups: | ||
| 159 | + - Ref: WebappSecurityGroup | ||
| 160 | + IamInstanceProfile: | ||
| 161 | + Ref: WebappInstanceProfile | ||
| 162 | + UserData: | ||
| 163 | + Fn::Base64: !Sub | | ||
| 164 | + #! /bin/bash -xe | ||
| 165 | + # update yum just in case | ||
| 166 | + yum update -y | ||
| 167 | + # get node into yum | ||
| 168 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 169 | + # install node and npm in one line | ||
| 170 | + yum install -y nodejs | ||
| 171 | + install pm2 to restart node app | ||
| 172 | + npm i -g pm2@2.4.3 | ||
| 173 | + AutoScalingGroup: | ||
| 174 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 175 | + Properties: | ||
| 176 | + HealthCheckType: ELB | ||
| 177 | + HealthCheckGracePeriod: 300 | ||
| 178 | + MinSize: | ||
| 179 | + Ref: MinSize | ||
| 180 | + MaxSize: | ||
| 181 | + Ref: MaxSize | ||
| 182 | + LaunchConfigurationName: | ||
| 183 | + Ref: WebappLaunchConfig | ||
| 184 | + VPCZoneIdentifier: | ||
| 185 | + Ref: WebappSubnets | ||
| 186 | + TargetGroupARNs: | ||
| 187 | + - Ref: ALBTargetGroup | ||
| 188 | + Tags: | ||
| 189 | + - Key: Name | ||
| 190 | + Value: webapp-example | ||
| 191 | + PropagateAtLaunch: true | ||
| 192 | + ALBListener: | ||
| 193 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 194 | + Properties: | ||
| 195 | + DefaultActions: | ||
| 196 | + - | ||
| 197 | + Type: forward | ||
| 198 | + TargetGroupArn: | ||
| 199 | + Ref: ALBTargetGroup | ||
| 200 | + LoadBalancerArn: | ||
| 201 | + Ref: ApplicationLoadBalancer | ||
| 202 | + Port: 80 | ||
| 203 | + Protocol: HTTP | ||
| 204 | + ApplicationLoadBalancer: | ||
| 205 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 206 | + Properties: | ||
| 207 | + Name: testLoadbalancer | ||
| 208 | + Scheme: internet-facing | ||
| 209 | + Subnets: | ||
| 210 | + Ref: ALBSubnets | ||
| 211 | + SecurityGroups: | ||
| 212 | + - Ref: ALBSecurityGroup | ||
| 213 | + ALBTargetGroup: | ||
| 214 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 215 | + Properties: | ||
| 216 | + HealthCheckIntervalSeconds: 30 | ||
| 217 | + UnhealthyThresholdCount: 2 | ||
| 218 | + HealthyThresholdCount: 2 | ||
| 219 | + HealthCheckPath: / | ||
| 220 | + Port: 3000 | ||
| 221 | + Protocol: HTTP | ||
| 222 | + VpcId: | ||
| 223 | + Ref: VPC | ||
| 224 | +Outputs: | ||
| 225 | + WebappUrl: | ||
| 226 | + Description: Webapp URL | ||
| 227 | + Value: !GetAtt ApplicationLoadBalancer.DNSName | ||
| 228 | + DeploymentGroup: | ||
| 229 | + Description: Webapp Deployment Group | ||
| 230 | + Value: !Ref WebappDeploymentGroup | ||
| 231 | + DeploymentBucket: | ||
| 232 | + Description: Deployment bucket | ||
| 233 | + Value: !Ref WebappDeploymentBucket | ||
| 234 | + ApplicationName: | ||
| 235 | + Description: CodeDeploy Application name | ||
| 236 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: !Ref ApplicationLoadBalancer | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + Resource: "*" | ||
| 115 | + - | ||
| 116 | + Effect: Allow | ||
| 117 | + Action: | ||
| 118 | + - elasticloadbalancing:* | ||
| 119 | + Resource: "*" | ||
| 120 | + WebappRole: | ||
| 121 | + Type: "AWS::IAM::Role" | ||
| 122 | + Properties: | ||
| 123 | + AssumeRolePolicyDocument: | ||
| 124 | + Version: "2012-10-17" | ||
| 125 | + Statement: | ||
| 126 | + - | ||
| 127 | + Effect: "Allow" | ||
| 128 | + Principal: | ||
| 129 | + Service: | ||
| 130 | + - "ec2.amazonaws.com" | ||
| 131 | + - "codedeploy.amazonaws.com" | ||
| 132 | + Action: | ||
| 133 | + - "sts:AssumeRole" | ||
| 134 | + Policies: | ||
| 135 | + - | ||
| 136 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 137 | + PolicyDocument: | ||
| 138 | + Version: "2012-10-17" | ||
| 139 | + Statement: | ||
| 140 | + - | ||
| 141 | + Effect: "Allow" | ||
| 142 | + Action: "s3:getObject" | ||
| 143 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 144 | + WebappInstanceProfile: | ||
| 145 | + Type: "AWS::IAM::InstanceProfile" | ||
| 146 | + Properties: | ||
| 147 | + Roles: | ||
| 148 | + - Ref: WebappRole | ||
| 149 | + WebappLaunchConfig: | ||
| 150 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 151 | + Properties: | ||
| 152 | + AssociatePublicIpAddress: true | ||
| 153 | + ImageId: | ||
| 154 | + Ref: AMIID | ||
| 155 | + InstanceType: t2.micro | ||
| 156 | + KeyName: | ||
| 157 | + Ref: KeyName | ||
| 158 | + SecurityGroups: | ||
| 159 | + - Ref: WebappSecurityGroup | ||
| 160 | + IamInstanceProfile: | ||
| 161 | + Ref: WebappInstanceProfile | ||
| 162 | + UserData: | ||
| 163 | + Fn::Base64: !Sub | | ||
| 164 | + #! /bin/bash -xe | ||
| 165 | + # update yum just in case | ||
| 166 | + yum update -y | ||
| 167 | + # get node into yum | ||
| 168 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 169 | + # install node and npm in one line | ||
| 170 | + yum install -y nodejs | ||
| 171 | + install pm2 to restart node app | ||
| 172 | + npm i -g pm2@2.4.3 | ||
| 173 | + AutoScalingGroup: | ||
| 174 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 175 | + Properties: | ||
| 176 | + HealthCheckType: ELB | ||
| 177 | + HealthCheckGracePeriod: 300 | ||
| 178 | + MinSize: | ||
| 179 | + Ref: MinSize | ||
| 180 | + MaxSize: | ||
| 181 | + Ref: MaxSize | ||
| 182 | + LaunchConfigurationName: | ||
| 183 | + Ref: WebappLaunchConfig | ||
| 184 | + VPCZoneIdentifier: | ||
| 185 | + Ref: WebappSubnets | ||
| 186 | + TargetGroupARNs: | ||
| 187 | + - Ref: ALBTargetGroup | ||
| 188 | + Tags: | ||
| 189 | + - Key: Name | ||
| 190 | + Value: webapp-example | ||
| 191 | + PropagateAtLaunch: true | ||
| 192 | + ALBListener: | ||
| 193 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 194 | + Properties: | ||
| 195 | + DefaultActions: | ||
| 196 | + - | ||
| 197 | + Type: forward | ||
| 198 | + TargetGroupArn: | ||
| 199 | + Ref: ALBTargetGroup | ||
| 200 | + LoadBalancerArn: | ||
| 201 | + Ref: ApplicationLoadBalancer | ||
| 202 | + Port: 80 | ||
| 203 | + Protocol: HTTP | ||
| 204 | + ApplicationLoadBalancer: | ||
| 205 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 206 | + Properties: | ||
| 207 | + Name: testLoadbalancer | ||
| 208 | + Scheme: internet-facing | ||
| 209 | + Subnets: | ||
| 210 | + Ref: ALBSubnets | ||
| 211 | + SecurityGroups: | ||
| 212 | + - Ref: ALBSecurityGroup | ||
| 213 | + ALBTargetGroup: | ||
| 214 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 215 | + Properties: | ||
| 216 | + HealthCheckIntervalSeconds: 30 | ||
| 217 | + UnhealthyThresholdCount: 2 | ||
| 218 | + HealthyThresholdCount: 2 | ||
| 219 | + HealthCheckPath: / | ||
| 220 | + Port: 3000 | ||
| 221 | + Protocol: HTTP | ||
| 222 | + VpcId: | ||
| 223 | + Ref: VPC | ||
| 224 | +Outputs: | ||
| 225 | + WebappUrl: | ||
| 226 | + Description: Webapp URL | ||
| 227 | + Value: !GetAtt ApplicationLoadBalancer.DNSName | ||
| 228 | + DeploymentGroup: | ||
| 229 | + Description: Webapp Deployment Group | ||
| 230 | + Value: !Ref WebappDeploymentGroup | ||
| 231 | + DeploymentBucket: | ||
| 232 | + Description: Deployment bucket | ||
| 233 | + Value: !Ref WebappDeploymentBucket | ||
| 234 | + ApplicationName: | ||
| 235 | + Description: CodeDeploy Application name | ||
| 236 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: !Ref ApplicationLoadBalancer.name | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + Resource: "*" | ||
| 115 | + - | ||
| 116 | + Effect: Allow | ||
| 117 | + Action: | ||
| 118 | + - elasticloadbalancing:* | ||
| 119 | + Resource: "*" | ||
| 120 | + WebappRole: | ||
| 121 | + Type: "AWS::IAM::Role" | ||
| 122 | + Properties: | ||
| 123 | + AssumeRolePolicyDocument: | ||
| 124 | + Version: "2012-10-17" | ||
| 125 | + Statement: | ||
| 126 | + - | ||
| 127 | + Effect: "Allow" | ||
| 128 | + Principal: | ||
| 129 | + Service: | ||
| 130 | + - "ec2.amazonaws.com" | ||
| 131 | + - "codedeploy.amazonaws.com" | ||
| 132 | + Action: | ||
| 133 | + - "sts:AssumeRole" | ||
| 134 | + Policies: | ||
| 135 | + - | ||
| 136 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 137 | + PolicyDocument: | ||
| 138 | + Version: "2012-10-17" | ||
| 139 | + Statement: | ||
| 140 | + - | ||
| 141 | + Effect: "Allow" | ||
| 142 | + Action: "s3:getObject" | ||
| 143 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 144 | + WebappInstanceProfile: | ||
| 145 | + Type: "AWS::IAM::InstanceProfile" | ||
| 146 | + Properties: | ||
| 147 | + Roles: | ||
| 148 | + - Ref: WebappRole | ||
| 149 | + WebappLaunchConfig: | ||
| 150 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 151 | + Properties: | ||
| 152 | + AssociatePublicIpAddress: true | ||
| 153 | + ImageId: | ||
| 154 | + Ref: AMIID | ||
| 155 | + InstanceType: t2.micro | ||
| 156 | + KeyName: | ||
| 157 | + Ref: KeyName | ||
| 158 | + SecurityGroups: | ||
| 159 | + - Ref: WebappSecurityGroup | ||
| 160 | + IamInstanceProfile: | ||
| 161 | + Ref: WebappInstanceProfile | ||
| 162 | + UserData: | ||
| 163 | + Fn::Base64: !Sub | | ||
| 164 | + #! /bin/bash -xe | ||
| 165 | + # update yum just in case | ||
| 166 | + yum update -y | ||
| 167 | + # get node into yum | ||
| 168 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 169 | + # install node and npm in one line | ||
| 170 | + yum install -y nodejs | ||
| 171 | + install pm2 to restart node app | ||
| 172 | + npm i -g pm2@2.4.3 | ||
| 173 | + AutoScalingGroup: | ||
| 174 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 175 | + Properties: | ||
| 176 | + HealthCheckType: ELB | ||
| 177 | + HealthCheckGracePeriod: 300 | ||
| 178 | + MinSize: | ||
| 179 | + Ref: MinSize | ||
| 180 | + MaxSize: | ||
| 181 | + Ref: MaxSize | ||
| 182 | + LaunchConfigurationName: | ||
| 183 | + Ref: WebappLaunchConfig | ||
| 184 | + VPCZoneIdentifier: | ||
| 185 | + Ref: WebappSubnets | ||
| 186 | + TargetGroupARNs: | ||
| 187 | + - Ref: ALBTargetGroup | ||
| 188 | + Tags: | ||
| 189 | + - Key: Name | ||
| 190 | + Value: webapp-example | ||
| 191 | + PropagateAtLaunch: true | ||
| 192 | + ALBListener: | ||
| 193 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 194 | + Properties: | ||
| 195 | + DefaultActions: | ||
| 196 | + - | ||
| 197 | + Type: forward | ||
| 198 | + TargetGroupArn: | ||
| 199 | + Ref: ALBTargetGroup | ||
| 200 | + LoadBalancerArn: | ||
| 201 | + Ref: ApplicationLoadBalancer | ||
| 202 | + Port: 80 | ||
| 203 | + Protocol: HTTP | ||
| 204 | + ApplicationLoadBalancer: | ||
| 205 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 206 | + Properties: | ||
| 207 | + Name: testLoadbalancer | ||
| 208 | + Scheme: internet-facing | ||
| 209 | + Subnets: | ||
| 210 | + Ref: ALBSubnets | ||
| 211 | + SecurityGroups: | ||
| 212 | + - Ref: ALBSecurityGroup | ||
| 213 | + ALBTargetGroup: | ||
| 214 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 215 | + Properties: | ||
| 216 | + HealthCheckIntervalSeconds: 30 | ||
| 217 | + UnhealthyThresholdCount: 2 | ||
| 218 | + HealthyThresholdCount: 2 | ||
| 219 | + HealthCheckPath: / | ||
| 220 | + Port: 3000 | ||
| 221 | + Protocol: HTTP | ||
| 222 | + VpcId: | ||
| 223 | + Ref: VPC | ||
| 224 | +Outputs: | ||
| 225 | + WebappUrl: | ||
| 226 | + Description: Webapp URL | ||
| 227 | + Value: !GetAtt ApplicationLoadBalancer.DNSName | ||
| 228 | + DeploymentGroup: | ||
| 229 | + Description: Webapp Deployment Group | ||
| 230 | + Value: !Ref WebappDeploymentGroup | ||
| 231 | + DeploymentBucket: | ||
| 232 | + Description: Deployment bucket | ||
| 233 | + Value: !Ref WebappDeploymentBucket | ||
| 234 | + ApplicationName: | ||
| 235 | + Description: CodeDeploy Application name | ||
| 236 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: !GetAtt ApplicationLoadBalancer.name | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + Resource: "*" | ||
| 115 | + - | ||
| 116 | + Effect: Allow | ||
| 117 | + Action: | ||
| 118 | + - elasticloadbalancing:* | ||
| 119 | + Resource: "*" | ||
| 120 | + WebappRole: | ||
| 121 | + Type: "AWS::IAM::Role" | ||
| 122 | + Properties: | ||
| 123 | + AssumeRolePolicyDocument: | ||
| 124 | + Version: "2012-10-17" | ||
| 125 | + Statement: | ||
| 126 | + - | ||
| 127 | + Effect: "Allow" | ||
| 128 | + Principal: | ||
| 129 | + Service: | ||
| 130 | + - "ec2.amazonaws.com" | ||
| 131 | + - "codedeploy.amazonaws.com" | ||
| 132 | + Action: | ||
| 133 | + - "sts:AssumeRole" | ||
| 134 | + Policies: | ||
| 135 | + - | ||
| 136 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 137 | + PolicyDocument: | ||
| 138 | + Version: "2012-10-17" | ||
| 139 | + Statement: | ||
| 140 | + - | ||
| 141 | + Effect: "Allow" | ||
| 142 | + Action: "s3:getObject" | ||
| 143 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 144 | + WebappInstanceProfile: | ||
| 145 | + Type: "AWS::IAM::InstanceProfile" | ||
| 146 | + Properties: | ||
| 147 | + Roles: | ||
| 148 | + - Ref: WebappRole | ||
| 149 | + WebappLaunchConfig: | ||
| 150 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 151 | + Properties: | ||
| 152 | + AssociatePublicIpAddress: true | ||
| 153 | + ImageId: | ||
| 154 | + Ref: AMIID | ||
| 155 | + InstanceType: t2.micro | ||
| 156 | + KeyName: | ||
| 157 | + Ref: KeyName | ||
| 158 | + SecurityGroups: | ||
| 159 | + - Ref: WebappSecurityGroup | ||
| 160 | + IamInstanceProfile: | ||
| 161 | + Ref: WebappInstanceProfile | ||
| 162 | + UserData: | ||
| 163 | + Fn::Base64: !Sub | | ||
| 164 | + #! /bin/bash -xe | ||
| 165 | + # update yum just in case | ||
| 166 | + yum update -y | ||
| 167 | + # get node into yum | ||
| 168 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 169 | + # install node and npm in one line | ||
| 170 | + yum install -y nodejs | ||
| 171 | + install pm2 to restart node app | ||
| 172 | + npm i -g pm2@2.4.3 | ||
| 173 | + AutoScalingGroup: | ||
| 174 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 175 | + Properties: | ||
| 176 | + HealthCheckType: ELB | ||
| 177 | + HealthCheckGracePeriod: 300 | ||
| 178 | + MinSize: | ||
| 179 | + Ref: MinSize | ||
| 180 | + MaxSize: | ||
| 181 | + Ref: MaxSize | ||
| 182 | + LaunchConfigurationName: | ||
| 183 | + Ref: WebappLaunchConfig | ||
| 184 | + VPCZoneIdentifier: | ||
| 185 | + Ref: WebappSubnets | ||
| 186 | + TargetGroupARNs: | ||
| 187 | + - Ref: ALBTargetGroup | ||
| 188 | + Tags: | ||
| 189 | + - Key: Name | ||
| 190 | + Value: webapp-example | ||
| 191 | + PropagateAtLaunch: true | ||
| 192 | + ALBListener: | ||
| 193 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 194 | + Properties: | ||
| 195 | + DefaultActions: | ||
| 196 | + - | ||
| 197 | + Type: forward | ||
| 198 | + TargetGroupArn: | ||
| 199 | + Ref: ALBTargetGroup | ||
| 200 | + LoadBalancerArn: | ||
| 201 | + Ref: ApplicationLoadBalancer | ||
| 202 | + Port: 80 | ||
| 203 | + Protocol: HTTP | ||
| 204 | + ApplicationLoadBalancer: | ||
| 205 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 206 | + Properties: | ||
| 207 | + Name: testLoadbalancer | ||
| 208 | + Scheme: internet-facing | ||
| 209 | + Subnets: | ||
| 210 | + Ref: ALBSubnets | ||
| 211 | + SecurityGroups: | ||
| 212 | + - Ref: ALBSecurityGroup | ||
| 213 | + ALBTargetGroup: | ||
| 214 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 215 | + Properties: | ||
| 216 | + HealthCheckIntervalSeconds: 30 | ||
| 217 | + UnhealthyThresholdCount: 2 | ||
| 218 | + HealthyThresholdCount: 2 | ||
| 219 | + HealthCheckPath: / | ||
| 220 | + Port: 3000 | ||
| 221 | + Protocol: HTTP | ||
| 222 | + VpcId: | ||
| 223 | + Ref: VPC | ||
| 224 | +Outputs: | ||
| 225 | + WebappUrl: | ||
| 226 | + Description: Webapp URL | ||
| 227 | + Value: !GetAtt ApplicationLoadBalancer.DNSName | ||
| 228 | + DeploymentGroup: | ||
| 229 | + Description: Webapp Deployment Group | ||
| 230 | + Value: !Ref WebappDeploymentGroup | ||
| 231 | + DeploymentBucket: | ||
| 232 | + Description: Deployment bucket | ||
| 233 | + Value: !Ref WebappDeploymentBucket | ||
| 234 | + ApplicationName: | ||
| 235 | + Description: CodeDeploy Application name | ||
| 236 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: testLoadbalancer | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + Resource: "*" | ||
| 115 | + - | ||
| 116 | + Effect: Allow | ||
| 117 | + Action: | ||
| 118 | + - elasticloadbalancing:* | ||
| 119 | + Resource: "*" | ||
| 120 | + WebappRole: | ||
| 121 | + Type: "AWS::IAM::Role" | ||
| 122 | + Properties: | ||
| 123 | + AssumeRolePolicyDocument: | ||
| 124 | + Version: "2012-10-17" | ||
| 125 | + Statement: | ||
| 126 | + - | ||
| 127 | + Effect: "Allow" | ||
| 128 | + Principal: | ||
| 129 | + Service: | ||
| 130 | + - "ec2.amazonaws.com" | ||
| 131 | + - "codedeploy.amazonaws.com" | ||
| 132 | + Action: | ||
| 133 | + - "sts:AssumeRole" | ||
| 134 | + Policies: | ||
| 135 | + - | ||
| 136 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 137 | + PolicyDocument: | ||
| 138 | + Version: "2012-10-17" | ||
| 139 | + Statement: | ||
| 140 | + - | ||
| 141 | + Effect: "Allow" | ||
| 142 | + Action: "s3:getObject" | ||
| 143 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 144 | + WebappInstanceProfile: | ||
| 145 | + Type: "AWS::IAM::InstanceProfile" | ||
| 146 | + Properties: | ||
| 147 | + Roles: | ||
| 148 | + - Ref: WebappRole | ||
| 149 | + WebappLaunchConfig: | ||
| 150 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 151 | + Properties: | ||
| 152 | + AssociatePublicIpAddress: true | ||
| 153 | + ImageId: | ||
| 154 | + Ref: AMIID | ||
| 155 | + InstanceType: t2.micro | ||
| 156 | + KeyName: | ||
| 157 | + Ref: KeyName | ||
| 158 | + SecurityGroups: | ||
| 159 | + - Ref: WebappSecurityGroup | ||
| 160 | + IamInstanceProfile: | ||
| 161 | + Ref: WebappInstanceProfile | ||
| 162 | + UserData: | ||
| 163 | + Fn::Base64: !Sub | | ||
| 164 | + #! /bin/bash -xe | ||
| 165 | + # update yum just in case | ||
| 166 | + yum update -y | ||
| 167 | + # get node into yum | ||
| 168 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 169 | + # install node and npm in one line | ||
| 170 | + yum install -y nodejs | ||
| 171 | + install pm2 to restart node app | ||
| 172 | + npm i -g pm2@2.4.3 | ||
| 173 | + AutoScalingGroup: | ||
| 174 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 175 | + Properties: | ||
| 176 | + HealthCheckType: ELB | ||
| 177 | + HealthCheckGracePeriod: 300 | ||
| 178 | + MinSize: | ||
| 179 | + Ref: MinSize | ||
| 180 | + MaxSize: | ||
| 181 | + Ref: MaxSize | ||
| 182 | + LaunchConfigurationName: | ||
| 183 | + Ref: WebappLaunchConfig | ||
| 184 | + VPCZoneIdentifier: | ||
| 185 | + Ref: WebappSubnets | ||
| 186 | + TargetGroupARNs: | ||
| 187 | + - Ref: ALBTargetGroup | ||
| 188 | + Tags: | ||
| 189 | + - Key: Name | ||
| 190 | + Value: webapp-example | ||
| 191 | + PropagateAtLaunch: true | ||
| 192 | + ALBListener: | ||
| 193 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 194 | + Properties: | ||
| 195 | + DefaultActions: | ||
| 196 | + - | ||
| 197 | + Type: forward | ||
| 198 | + TargetGroupArn: | ||
| 199 | + Ref: ALBTargetGroup | ||
| 200 | + LoadBalancerArn: | ||
| 201 | + Ref: ApplicationLoadBalancer | ||
| 202 | + Port: 80 | ||
| 203 | + Protocol: HTTP | ||
| 204 | + ApplicationLoadBalancer: | ||
| 205 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 206 | + Properties: | ||
| 207 | + Name: testLoadbalancer | ||
| 208 | + Scheme: internet-facing | ||
| 209 | + Subnets: | ||
| 210 | + Ref: ALBSubnets | ||
| 211 | + SecurityGroups: | ||
| 212 | + - Ref: ALBSecurityGroup | ||
| 213 | + ALBTargetGroup: | ||
| 214 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 215 | + Properties: | ||
| 216 | + HealthCheckIntervalSeconds: 30 | ||
| 217 | + UnhealthyThresholdCount: 2 | ||
| 218 | + HealthyThresholdCount: 2 | ||
| 219 | + HealthCheckPath: / | ||
| 220 | + Port: 3000 | ||
| 221 | + Protocol: HTTP | ||
| 222 | + VpcId: | ||
| 223 | + Ref: VPC | ||
| 224 | +Outputs: | ||
| 225 | + WebappUrl: | ||
| 226 | + Description: Webapp URL | ||
| 227 | + Value: !GetAtt ApplicationLoadBalancer.DNSName | ||
| 228 | + DeploymentGroup: | ||
| 229 | + Description: Webapp Deployment Group | ||
| 230 | + Value: !Ref WebappDeploymentGroup | ||
| 231 | + DeploymentBucket: | ||
| 232 | + Description: Deployment bucket | ||
| 233 | + Value: !Ref WebappDeploymentBucket | ||
| 234 | + ApplicationName: | ||
| 235 | + Description: CodeDeploy Application name | ||
| 236 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: testLoadbalancer | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + Resource: "*" | ||
| 115 | + - | ||
| 116 | + Effect: Allow | ||
| 117 | + Action: | ||
| 118 | + - elasticloadbalancing:* | ||
| 119 | + Resource: "*" | ||
| 120 | + WebappRole: | ||
| 121 | + Type: "AWS::IAM::Role" | ||
| 122 | + Properties: | ||
| 123 | + AssumeRolePolicyDocument: | ||
| 124 | + Version: "2012-10-17" | ||
| 125 | + Statement: | ||
| 126 | + - | ||
| 127 | + Effect: "Allow" | ||
| 128 | + Principal: | ||
| 129 | + Service: | ||
| 130 | + - "ec2.amazonaws.com" | ||
| 131 | + - "codedeploy.amazonaws.com" | ||
| 132 | + Action: | ||
| 133 | + - "sts:AssumeRole" | ||
| 134 | + Policies: | ||
| 135 | + - | ||
| 136 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 137 | + PolicyDocument: | ||
| 138 | + Version: "2012-10-17" | ||
| 139 | + Statement: | ||
| 140 | + - | ||
| 141 | + Effect: "Allow" | ||
| 142 | + Action: "s3:getObject" | ||
| 143 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 144 | + WebappInstanceProfile: | ||
| 145 | + Type: "AWS::IAM::InstanceProfile" | ||
| 146 | + Properties: | ||
| 147 | + Roles: | ||
| 148 | + - Ref: WebappRole | ||
| 149 | + WebappLaunchConfig: | ||
| 150 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 151 | + Properties: | ||
| 152 | + AssociatePublicIpAddress: true | ||
| 153 | + ImageId: | ||
| 154 | + Ref: AMIID | ||
| 155 | + InstanceType: t2.micro | ||
| 156 | + KeyName: | ||
| 157 | + Ref: KeyName | ||
| 158 | + SecurityGroups: | ||
| 159 | + - Ref: WebappSecurityGroup | ||
| 160 | + IamInstanceProfile: | ||
| 161 | + Ref: WebappInstanceProfile | ||
| 162 | + UserData: | ||
| 163 | + Fn::Base64: !Sub | | ||
| 164 | + #! /bin/bash -xe | ||
| 165 | + # update yum just in case | ||
| 166 | + yum update -y | ||
| 167 | + # get node into yum | ||
| 168 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 169 | + # install node and npm in one line | ||
| 170 | + yum install -y nodejs | ||
| 171 | + install pm2 to restart node app | ||
| 172 | + npm i -g pm2@2.4.3 | ||
| 173 | + AutoScalingGroup: | ||
| 174 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 175 | + Properties: | ||
| 176 | + HealthCheckType: ELB | ||
| 177 | + HealthCheckGracePeriod: 300 | ||
| 178 | + MinSize: | ||
| 179 | + Ref: MinSize | ||
| 180 | + MaxSize: | ||
| 181 | + Ref: MaxSize | ||
| 182 | + LaunchConfigurationName: | ||
| 183 | + Ref: WebappLaunchConfig | ||
| 184 | + VPCZoneIdentifier: | ||
| 185 | + Ref: WebappSubnets | ||
| 186 | + TargetGroupARNs: | ||
| 187 | + - Ref: ALBTargetGroup | ||
| 188 | + Tags: | ||
| 189 | + - Key: Name | ||
| 190 | + Value: webapp-example | ||
| 191 | + PropagateAtLaunch: true | ||
| 192 | + ALBListener: | ||
| 193 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 194 | + Properties: | ||
| 195 | + DefaultActions: | ||
| 196 | + - | ||
| 197 | + Type: forward | ||
| 198 | + TargetGroupArn: | ||
| 199 | + Ref: ALBTargetGroup | ||
| 200 | + LoadBalancerArn: | ||
| 201 | + Ref: ApplicationLoadBalancer | ||
| 202 | + Port: 80 | ||
| 203 | + Protocol: HTTP | ||
| 204 | + ApplicationLoadBalancer: | ||
| 205 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 206 | + Properties: | ||
| 207 | + Name: testLoadbalancer | ||
| 208 | + Scheme: internet-facing | ||
| 209 | + Subnets: | ||
| 210 | + Ref: ALBSubnets | ||
| 211 | + SecurityGroups: | ||
| 212 | + - Ref: ALBSecurityGroup | ||
| 213 | + ALBTargetGroup: | ||
| 214 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 215 | + Properties: | ||
| 216 | + HealthCheckIntervalSeconds: 30 | ||
| 217 | + UnhealthyThresholdCount: 2 | ||
| 218 | + HealthyThresholdCount: 2 | ||
| 219 | + HealthCheckPath: / | ||
| 220 | + Port: 3000 | ||
| 221 | + Protocol: HTTP | ||
| 222 | + VpcId: | ||
| 223 | + Ref: VPC | ||
| 224 | +Outputs: | ||
| 225 | + WebappUrl: | ||
| 226 | + Description: Webapp URL | ||
| 227 | + Value: !GetAtt ApplicationLoadBalancer.DNSName | ||
| 228 | + DeploymentGroup: | ||
| 229 | + Description: Webapp Deployment Group | ||
| 230 | + Value: !Ref WebappDeploymentGroup | ||
| 231 | + DeploymentBucket: | ||
| 232 | + Description: Deployment bucket | ||
| 233 | + Value: !Ref WebappDeploymentBucket | ||
| 234 | + ApplicationName: | ||
| 235 | + Description: CodeDeploy Application name | ||
| 236 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: testLoadbalancer | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + Resource: "*" | ||
| 115 | + - | ||
| 116 | + Effect: Allow | ||
| 117 | + Action: | ||
| 118 | + - elasticloadbalancing:* | ||
| 119 | + Resource: "*" | ||
| 120 | + WebappRole: | ||
| 121 | + Type: "AWS::IAM::Role" | ||
| 122 | + Properties: | ||
| 123 | + AssumeRolePolicyDocument: | ||
| 124 | + Version: "2012-10-17" | ||
| 125 | + Statement: | ||
| 126 | + - | ||
| 127 | + Effect: "Allow" | ||
| 128 | + Principal: | ||
| 129 | + Service: | ||
| 130 | + - "ec2.amazonaws.com" | ||
| 131 | + - "codedeploy.amazonaws.com" | ||
| 132 | + Action: | ||
| 133 | + - "sts:AssumeRole" | ||
| 134 | + Policies: | ||
| 135 | + - | ||
| 136 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 137 | + PolicyDocument: | ||
| 138 | + Version: "2012-10-17" | ||
| 139 | + Statement: | ||
| 140 | + - | ||
| 141 | + Effect: "Allow" | ||
| 142 | + Action: "s3:getObject" | ||
| 143 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 144 | + WebappInstanceProfile: | ||
| 145 | + Type: "AWS::IAM::InstanceProfile" | ||
| 146 | + Properties: | ||
| 147 | + Roles: | ||
| 148 | + - Ref: WebappRole | ||
| 149 | + WebappLaunchConfig: | ||
| 150 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 151 | + Properties: | ||
| 152 | + AssociatePublicIpAddress: true | ||
| 153 | + ImageId: | ||
| 154 | + Ref: AMIID | ||
| 155 | + InstanceType: t2.micro | ||
| 156 | + KeyName: | ||
| 157 | + Ref: KeyName | ||
| 158 | + SecurityGroups: | ||
| 159 | + - Ref: WebappSecurityGroup | ||
| 160 | + IamInstanceProfile: | ||
| 161 | + Ref: WebappInstanceProfile | ||
| 162 | + UserData: | ||
| 163 | + Fn::Base64: !Sub | | ||
| 164 | + #! /bin/bash -xe | ||
| 165 | + # update yum just in case | ||
| 166 | + yum update -y | ||
| 167 | + # get node into yum | ||
| 168 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 169 | + # install node and npm in one line | ||
| 170 | + yum install -y nodejs | ||
| 171 | + install pm2 to restart node app | ||
| 172 | + npm i -g pm2@2.4.3 | ||
| 173 | + AutoScalingGroup: | ||
| 174 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 175 | + Properties: | ||
| 176 | + HealthCheckType: ELB | ||
| 177 | + HealthCheckGracePeriod: 300 | ||
| 178 | + MinSize: | ||
| 179 | + Ref: MinSize | ||
| 180 | + MaxSize: | ||
| 181 | + Ref: MaxSize | ||
| 182 | + LaunchConfigurationName: | ||
| 183 | + Ref: WebappLaunchConfig | ||
| 184 | + VPCZoneIdentifier: | ||
| 185 | + Ref: WebappSubnets | ||
| 186 | + TargetGroupARNs: | ||
| 187 | + - Ref: ALBTargetGroup | ||
| 188 | + Tags: | ||
| 189 | + - Key: Name | ||
| 190 | + Value: webapp-example | ||
| 191 | + PropagateAtLaunch: true | ||
| 192 | + ALBListener: | ||
| 193 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 194 | + Properties: | ||
| 195 | + DefaultActions: | ||
| 196 | + - | ||
| 197 | + Type: forward | ||
| 198 | + TargetGroupArn: | ||
| 199 | + Ref: ALBTargetGroup | ||
| 200 | + LoadBalancerArn: | ||
| 201 | + Ref: ApplicationLoadBalancer | ||
| 202 | + Port: 80 | ||
| 203 | + Protocol: HTTP | ||
| 204 | + ApplicationLoadBalancer: | ||
| 205 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 206 | + Properties: | ||
| 207 | + Name: testLoadbalancer | ||
| 208 | + Scheme: internet-facing | ||
| 209 | + Subnets: | ||
| 210 | + Ref: ALBSubnets | ||
| 211 | + SecurityGroups: | ||
| 212 | + - Ref: ALBSecurityGroup | ||
| 213 | + ALBTargetGroup: | ||
| 214 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 215 | + Properties: | ||
| 216 | + HealthCheckIntervalSeconds: 30 | ||
| 217 | + UnhealthyThresholdCount: 2 | ||
| 218 | + HealthyThresholdCount: 2 | ||
| 219 | + HealthCheckPath: / | ||
| 220 | + Port: 3000 | ||
| 221 | + Protocol: HTTP | ||
| 222 | + VpcId: | ||
| 223 | + Ref: VPC | ||
| 224 | +Outputs: | ||
| 225 | + WebappUrl: | ||
| 226 | + Description: Webapp URL | ||
| 227 | + Value: !GetAtt ApplicationLoadBalancer.DNSName | ||
| 228 | + DeploymentGroup: | ||
| 229 | + Description: Webapp Deployment Group | ||
| 230 | + Value: !Ref WebappDeploymentGroup | ||
| 231 | + DeploymentBucket: | ||
| 232 | + Description: Deployment bucket | ||
| 233 | + Value: !Ref WebappDeploymentBucket | ||
| 234 | + ApplicationName: | ||
| 235 | + Description: CodeDeploy Application name | ||
| 236 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: testLoadbalancer | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + Resource: "*" | ||
| 115 | + - | ||
| 116 | + Effect: Allow | ||
| 117 | + Action: | ||
| 118 | + - elasticloadbalancing:* | ||
| 119 | + Resource: "*" | ||
| 120 | + WebappRole: | ||
| 121 | + Type: "AWS::IAM::Role" | ||
| 122 | + Properties: | ||
| 123 | + AssumeRolePolicyDocument: | ||
| 124 | + Version: "2012-10-17" | ||
| 125 | + Statement: | ||
| 126 | + - | ||
| 127 | + Effect: "Allow" | ||
| 128 | + Principal: | ||
| 129 | + Service: | ||
| 130 | + - "ec2.amazonaws.com" | ||
| 131 | + - "codedeploy.amazonaws.com" | ||
| 132 | + Action: | ||
| 133 | + - "sts:AssumeRole" | ||
| 134 | + Policies: | ||
| 135 | + - | ||
| 136 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 137 | + PolicyDocument: | ||
| 138 | + Version: "2012-10-17" | ||
| 139 | + Statement: | ||
| 140 | + - | ||
| 141 | + Effect: "Allow" | ||
| 142 | + Action: "s3:getObject" | ||
| 143 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 144 | + WebappInstanceProfile: | ||
| 145 | + Type: "AWS::IAM::InstanceProfile" | ||
| 146 | + Properties: | ||
| 147 | + Roles: | ||
| 148 | + - Ref: WebappRole | ||
| 149 | + WebappLaunchConfig: | ||
| 150 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 151 | + Properties: | ||
| 152 | + AssociatePublicIpAddress: true | ||
| 153 | + ImageId: | ||
| 154 | + Ref: AMIID | ||
| 155 | + InstanceType: t2.micro | ||
| 156 | + KeyName: | ||
| 157 | + Ref: KeyName | ||
| 158 | + SecurityGroups: | ||
| 159 | + - Ref: WebappSecurityGroup | ||
| 160 | + IamInstanceProfile: | ||
| 161 | + Ref: WebappInstanceProfile | ||
| 162 | + UserData: | ||
| 163 | + Fn::Base64: !Sub | | ||
| 164 | + #! /bin/bash -xe | ||
| 165 | + # update yum just in case | ||
| 166 | + yum update -y | ||
| 167 | + # get node into yum | ||
| 168 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 169 | + # install node and npm in one line | ||
| 170 | + yum install -y nodejs | ||
| 171 | + install pm2 to restart node app | ||
| 172 | + npm i -g pm2@2.4.3 | ||
| 173 | + AutoScalingGroup: | ||
| 174 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 175 | + Properties: | ||
| 176 | + HealthCheckType: ELB | ||
| 177 | + HealthCheckGracePeriod: 300 | ||
| 178 | + MinSize: | ||
| 179 | + Ref: MinSize | ||
| 180 | + MaxSize: | ||
| 181 | + Ref: MaxSize | ||
| 182 | + LaunchConfigurationName: | ||
| 183 | + Ref: WebappLaunchConfig | ||
| 184 | + VPCZoneIdentifier: | ||
| 185 | + Ref: WebappSubnets | ||
| 186 | + TargetGroupARNs: | ||
| 187 | + - Ref: ALBTargetGroup | ||
| 188 | + Tags: | ||
| 189 | + - Key: Name | ||
| 190 | + Value: webapp-example | ||
| 191 | + PropagateAtLaunch: true | ||
| 192 | + ALBListener: | ||
| 193 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 194 | + Properties: | ||
| 195 | + DefaultActions: | ||
| 196 | + - | ||
| 197 | + Type: forward | ||
| 198 | + TargetGroupArn: | ||
| 199 | + Ref: ALBTargetGroup | ||
| 200 | + LoadBalancerArn: | ||
| 201 | + Ref: LoadBalancer | ||
| 202 | + Port: 80 | ||
| 203 | + Protocol: HTTP | ||
| 204 | + LoadBalancer: | ||
| 205 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 206 | + Properties: | ||
| 207 | + Name: testLoadbalancer | ||
| 208 | + Scheme: internet-facing | ||
| 209 | + Subnets: | ||
| 210 | + Ref: ALBSubnets | ||
| 211 | + SecurityGroups: | ||
| 212 | + - Ref: ALBSecurityGroup | ||
| 213 | + ALBTargetGroup: | ||
| 214 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 215 | + Properties: | ||
| 216 | + HealthCheckIntervalSeconds: 30 | ||
| 217 | + UnhealthyThresholdCount: 2 | ||
| 218 | + HealthyThresholdCount: 2 | ||
| 219 | + HealthCheckPath: / | ||
| 220 | + Port: 3000 | ||
| 221 | + Protocol: HTTP | ||
| 222 | + VpcId: | ||
| 223 | + Ref: VPC | ||
| 224 | +Outputs: | ||
| 225 | + WebappUrl: | ||
| 226 | + Description: Webapp URL | ||
| 227 | + Value: !GetAtt LoadBalancer.DNSName | ||
| 228 | + DeploymentGroup: | ||
| 229 | + Description: Webapp Deployment Group | ||
| 230 | + Value: !Ref WebappDeploymentGroup | ||
| 231 | + DeploymentBucket: | ||
| 232 | + Description: Deployment bucket | ||
| 233 | + Value: !Ref WebappDeploymentBucket | ||
| 234 | + ApplicationName: | ||
| 235 | + Description: CodeDeploy Application name | ||
| 236 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: !Ref LoadBalancer | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + Resource: "*" | ||
| 115 | + - | ||
| 116 | + Effect: Allow | ||
| 117 | + Action: | ||
| 118 | + - elasticloadbalancing:* | ||
| 119 | + Resource: "*" | ||
| 120 | + WebappRole: | ||
| 121 | + Type: "AWS::IAM::Role" | ||
| 122 | + Properties: | ||
| 123 | + AssumeRolePolicyDocument: | ||
| 124 | + Version: "2012-10-17" | ||
| 125 | + Statement: | ||
| 126 | + - | ||
| 127 | + Effect: "Allow" | ||
| 128 | + Principal: | ||
| 129 | + Service: | ||
| 130 | + - "ec2.amazonaws.com" | ||
| 131 | + - "codedeploy.amazonaws.com" | ||
| 132 | + Action: | ||
| 133 | + - "sts:AssumeRole" | ||
| 134 | + Policies: | ||
| 135 | + - | ||
| 136 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 137 | + PolicyDocument: | ||
| 138 | + Version: "2012-10-17" | ||
| 139 | + Statement: | ||
| 140 | + - | ||
| 141 | + Effect: "Allow" | ||
| 142 | + Action: "s3:getObject" | ||
| 143 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 144 | + WebappInstanceProfile: | ||
| 145 | + Type: "AWS::IAM::InstanceProfile" | ||
| 146 | + Properties: | ||
| 147 | + Roles: | ||
| 148 | + - Ref: WebappRole | ||
| 149 | + WebappLaunchConfig: | ||
| 150 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 151 | + Properties: | ||
| 152 | + AssociatePublicIpAddress: true | ||
| 153 | + ImageId: | ||
| 154 | + Ref: AMIID | ||
| 155 | + InstanceType: t2.micro | ||
| 156 | + KeyName: | ||
| 157 | + Ref: KeyName | ||
| 158 | + SecurityGroups: | ||
| 159 | + - Ref: WebappSecurityGroup | ||
| 160 | + IamInstanceProfile: | ||
| 161 | + Ref: WebappInstanceProfile | ||
| 162 | + UserData: | ||
| 163 | + Fn::Base64: !Sub | | ||
| 164 | + #! /bin/bash -xe | ||
| 165 | + # update yum just in case | ||
| 166 | + yum update -y | ||
| 167 | + # get node into yum | ||
| 168 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 169 | + # install node and npm in one line | ||
| 170 | + yum install -y nodejs | ||
| 171 | + install pm2 to restart node app | ||
| 172 | + npm i -g pm2@2.4.3 | ||
| 173 | + AutoScalingGroup: | ||
| 174 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 175 | + Properties: | ||
| 176 | + HealthCheckType: ELB | ||
| 177 | + HealthCheckGracePeriod: 300 | ||
| 178 | + MinSize: | ||
| 179 | + Ref: MinSize | ||
| 180 | + MaxSize: | ||
| 181 | + Ref: MaxSize | ||
| 182 | + LaunchConfigurationName: | ||
| 183 | + Ref: WebappLaunchConfig | ||
| 184 | + VPCZoneIdentifier: | ||
| 185 | + Ref: WebappSubnets | ||
| 186 | + TargetGroupARNs: | ||
| 187 | + - Ref: ALBTargetGroup | ||
| 188 | + Tags: | ||
| 189 | + - Key: Name | ||
| 190 | + Value: webapp-example | ||
| 191 | + PropagateAtLaunch: true | ||
| 192 | + ALBListener: | ||
| 193 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 194 | + Properties: | ||
| 195 | + DefaultActions: | ||
| 196 | + - | ||
| 197 | + Type: forward | ||
| 198 | + TargetGroupArn: | ||
| 199 | + Ref: ALBTargetGroup | ||
| 200 | + LoadBalancerArn: | ||
| 201 | + Ref: LoadBalancer | ||
| 202 | + Port: 80 | ||
| 203 | + Protocol: HTTP | ||
| 204 | + LoadBalancer: | ||
| 205 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 206 | + Properties: | ||
| 207 | + Name: testLoadbalancer | ||
| 208 | + Scheme: internet-facing | ||
| 209 | + Subnets: | ||
| 210 | + Ref: ALBSubnets | ||
| 211 | + SecurityGroups: | ||
| 212 | + - Ref: ALBSecurityGroup | ||
| 213 | + ALBTargetGroup: | ||
| 214 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 215 | + Properties: | ||
| 216 | + HealthCheckIntervalSeconds: 30 | ||
| 217 | + UnhealthyThresholdCount: 2 | ||
| 218 | + HealthyThresholdCount: 2 | ||
| 219 | + HealthCheckPath: / | ||
| 220 | + Port: 3000 | ||
| 221 | + Protocol: HTTP | ||
| 222 | + VpcId: | ||
| 223 | + Ref: VPC | ||
| 224 | +Outputs: | ||
| 225 | + WebappUrl: | ||
| 226 | + Description: Webapp URL | ||
| 227 | + Value: !GetAtt LoadBalancer.DNSName | ||
| 228 | + DeploymentGroup: | ||
| 229 | + Description: Webapp Deployment Group | ||
| 230 | + Value: !Ref WebappDeploymentGroup | ||
| 231 | + DeploymentBucket: | ||
| 232 | + Description: Deployment bucket | ||
| 233 | + Value: !Ref WebappDeploymentBucket | ||
| 234 | + ApplicationName: | ||
| 235 | + Description: CodeDeploy Application name | ||
| 236 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: testLoadbalancer | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + Resource: "*" | ||
| 115 | + - | ||
| 116 | + Effect: Allow | ||
| 117 | + Action: | ||
| 118 | + - elasticloadbalancing:* | ||
| 119 | + Resource: "*" | ||
| 120 | + WebappRole: | ||
| 121 | + Type: "AWS::IAM::Role" | ||
| 122 | + Properties: | ||
| 123 | + AssumeRolePolicyDocument: | ||
| 124 | + Version: "2012-10-17" | ||
| 125 | + Statement: | ||
| 126 | + - | ||
| 127 | + Effect: "Allow" | ||
| 128 | + Principal: | ||
| 129 | + Service: | ||
| 130 | + - "ec2.amazonaws.com" | ||
| 131 | + - "codedeploy.amazonaws.com" | ||
| 132 | + Action: | ||
| 133 | + - "sts:AssumeRole" | ||
| 134 | + Policies: | ||
| 135 | + - | ||
| 136 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 137 | + PolicyDocument: | ||
| 138 | + Version: "2012-10-17" | ||
| 139 | + Statement: | ||
| 140 | + - | ||
| 141 | + Effect: "Allow" | ||
| 142 | + Action: "s3:getObject" | ||
| 143 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 144 | + WebappInstanceProfile: | ||
| 145 | + Type: "AWS::IAM::InstanceProfile" | ||
| 146 | + Properties: | ||
| 147 | + Roles: | ||
| 148 | + - Ref: WebappRole | ||
| 149 | + WebappLaunchConfig: | ||
| 150 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 151 | + Properties: | ||
| 152 | + AssociatePublicIpAddress: true | ||
| 153 | + ImageId: | ||
| 154 | + Ref: AMIID | ||
| 155 | + InstanceType: t2.micro | ||
| 156 | + KeyName: | ||
| 157 | + Ref: KeyName | ||
| 158 | + SecurityGroups: | ||
| 159 | + - Ref: WebappSecurityGroup | ||
| 160 | + IamInstanceProfile: | ||
| 161 | + Ref: WebappInstanceProfile | ||
| 162 | + UserData: | ||
| 163 | + Fn::Base64: !Sub | | ||
| 164 | + #! /bin/bash -xe | ||
| 165 | + # update yum just in case | ||
| 166 | + yum update -y | ||
| 167 | + # get node into yum | ||
| 168 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 169 | + # install node and npm in one line | ||
| 170 | + yum install -y nodejs | ||
| 171 | + install pm2 to restart node app | ||
| 172 | + npm i -g pm2@2.4.3 | ||
| 173 | + AutoScalingGroup: | ||
| 174 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 175 | + Properties: | ||
| 176 | + HealthCheckType: ELB | ||
| 177 | + HealthCheckGracePeriod: 300 | ||
| 178 | + MinSize: | ||
| 179 | + Ref: MinSize | ||
| 180 | + MaxSize: | ||
| 181 | + Ref: MaxSize | ||
| 182 | + LaunchConfigurationName: | ||
| 183 | + Ref: WebappLaunchConfig | ||
| 184 | + VPCZoneIdentifier: | ||
| 185 | + Ref: WebappSubnets | ||
| 186 | + TargetGroupARNs: | ||
| 187 | + - Ref: ALBTargetGroup | ||
| 188 | + Tags: | ||
| 189 | + - Key: Name | ||
| 190 | + Value: webapp-example | ||
| 191 | + PropagateAtLaunch: true | ||
| 192 | + ALBListener: | ||
| 193 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 194 | + Properties: | ||
| 195 | + DefaultActions: | ||
| 196 | + - | ||
| 197 | + Type: forward | ||
| 198 | + TargetGroupArn: | ||
| 199 | + Ref: ALBTargetGroup | ||
| 200 | + LoadBalancerArn: | ||
| 201 | + Ref: ApplicationLoadBalancer | ||
| 202 | + Port: 80 | ||
| 203 | + Protocol: HTTP | ||
| 204 | + ApplicationLoadBalancer: | ||
| 205 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 206 | + Properties: | ||
| 207 | + Name: testLoadbalancer | ||
| 208 | + Scheme: internet-facing | ||
| 209 | + Subnets: | ||
| 210 | + Ref: ALBSubnets | ||
| 211 | + SecurityGroups: | ||
| 212 | + - Ref: ALBSecurityGroup | ||
| 213 | + ALBTargetGroup: | ||
| 214 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 215 | + Properties: | ||
| 216 | + HealthCheckIntervalSeconds: 30 | ||
| 217 | + UnhealthyThresholdCount: 2 | ||
| 218 | + HealthyThresholdCount: 2 | ||
| 219 | + HealthCheckPath: / | ||
| 220 | + Port: 3000 | ||
| 221 | + Protocol: HTTP | ||
| 222 | + VpcId: | ||
| 223 | + Ref: VPC | ||
| 224 | +Outputs: | ||
| 225 | + WebappUrl: | ||
| 226 | + Description: Webapp URL | ||
| 227 | + Value: !GetAtt ApplicationLoadBalancer.DNSName | ||
| 228 | + DeploymentGroup: | ||
| 229 | + Description: Webapp Deployment Group | ||
| 230 | + Value: !Ref WebappDeploymentGroup | ||
| 231 | + DeploymentBucket: | ||
| 232 | + Description: Deployment bucket | ||
| 233 | + Value: !Ref WebappDeploymentBucket | ||
| 234 | + ApplicationName: | ||
| 235 | + Description: CodeDeploy Application name | ||
| 236 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: !Ref LoadBalancer | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + Resource: "*" | ||
| 115 | + - | ||
| 116 | + Effect: Allow | ||
| 117 | + Action: | ||
| 118 | + - elasticloadbalancing:* | ||
| 119 | + Resource: "*" | ||
| 120 | + WebappRole: | ||
| 121 | + Type: "AWS::IAM::Role" | ||
| 122 | + Properties: | ||
| 123 | + AssumeRolePolicyDocument: | ||
| 124 | + Version: "2012-10-17" | ||
| 125 | + Statement: | ||
| 126 | + - | ||
| 127 | + Effect: "Allow" | ||
| 128 | + Principal: | ||
| 129 | + Service: | ||
| 130 | + - "ec2.amazonaws.com" | ||
| 131 | + - "codedeploy.amazonaws.com" | ||
| 132 | + Action: | ||
| 133 | + - "sts:AssumeRole" | ||
| 134 | + Policies: | ||
| 135 | + - | ||
| 136 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 137 | + PolicyDocument: | ||
| 138 | + Version: "2012-10-17" | ||
| 139 | + Statement: | ||
| 140 | + - | ||
| 141 | + Effect: "Allow" | ||
| 142 | + Action: "s3:getObject" | ||
| 143 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 144 | + WebappInstanceProfile: | ||
| 145 | + Type: "AWS::IAM::InstanceProfile" | ||
| 146 | + Properties: | ||
| 147 | + Roles: | ||
| 148 | + - Ref: WebappRole | ||
| 149 | + WebappLaunchConfig: | ||
| 150 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 151 | + Properties: | ||
| 152 | + AssociatePublicIpAddress: true | ||
| 153 | + ImageId: | ||
| 154 | + Ref: AMIID | ||
| 155 | + InstanceType: t2.micro | ||
| 156 | + KeyName: | ||
| 157 | + Ref: KeyName | ||
| 158 | + SecurityGroups: | ||
| 159 | + - Ref: WebappSecurityGroup | ||
| 160 | + IamInstanceProfile: | ||
| 161 | + Ref: WebappInstanceProfile | ||
| 162 | + UserData: | ||
| 163 | + Fn::Base64: !Sub | | ||
| 164 | + #! /bin/bash -xe | ||
| 165 | + # update yum just in case | ||
| 166 | + yum update -y | ||
| 167 | + # get node into yum | ||
| 168 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 169 | + # install node and npm in one line | ||
| 170 | + yum install -y nodejs | ||
| 171 | + install pm2 to restart node app | ||
| 172 | + npm i -g pm2@2.4.3 | ||
| 173 | + AutoScalingGroup: | ||
| 174 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 175 | + Properties: | ||
| 176 | + HealthCheckType: ELB | ||
| 177 | + HealthCheckGracePeriod: 300 | ||
| 178 | + MinSize: | ||
| 179 | + Ref: MinSize | ||
| 180 | + MaxSize: | ||
| 181 | + Ref: MaxSize | ||
| 182 | + LaunchConfigurationName: | ||
| 183 | + Ref: WebappLaunchConfig | ||
| 184 | + VPCZoneIdentifier: | ||
| 185 | + Ref: WebappSubnets | ||
| 186 | + TargetGroupARNs: | ||
| 187 | + - Ref: ALBTargetGroup | ||
| 188 | + Tags: | ||
| 189 | + - Key: Name | ||
| 190 | + Value: webapp-example | ||
| 191 | + PropagateAtLaunch: true | ||
| 192 | + ALBListener: | ||
| 193 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 194 | + Properties: | ||
| 195 | + DefaultActions: | ||
| 196 | + - | ||
| 197 | + Type: forward | ||
| 198 | + TargetGroupArn: | ||
| 199 | + Ref: ALBTargetGroup | ||
| 200 | + LoadBalancerArn: | ||
| 201 | + Ref: LoadBalancer | ||
| 202 | + Port: 80 | ||
| 203 | + Protocol: HTTP | ||
| 204 | + LoadBalancer: | ||
| 205 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 206 | + Properties: | ||
| 207 | + Name: testLoadbalancer | ||
| 208 | + Scheme: internet-facing | ||
| 209 | + Subnets: | ||
| 210 | + Ref: ALBSubnets | ||
| 211 | + SecurityGroups: | ||
| 212 | + - Ref: ALBSecurityGroup | ||
| 213 | + ALBTargetGroup: | ||
| 214 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 215 | + Properties: | ||
| 216 | + HealthCheckIntervalSeconds: 30 | ||
| 217 | + UnhealthyThresholdCount: 2 | ||
| 218 | + HealthyThresholdCount: 2 | ||
| 219 | + HealthCheckPath: / | ||
| 220 | + Port: 3000 | ||
| 221 | + Protocol: HTTP | ||
| 222 | + VpcId: | ||
| 223 | + Ref: VPC | ||
| 224 | +Outputs: | ||
| 225 | + WebappUrl: | ||
| 226 | + Description: Webapp URL | ||
| 227 | + Value: !GetAtt LoadBalancer.DNSName | ||
| 228 | + DeploymentGroup: | ||
| 229 | + Description: Webapp Deployment Group | ||
| 230 | + Value: !Ref WebappDeploymentGroup | ||
| 231 | + DeploymentBucket: | ||
| 232 | + Description: Deployment bucket | ||
| 233 | + Value: !Ref WebappDeploymentBucket | ||
| 234 | + ApplicationName: | ||
| 235 | + Description: CodeDeploy Application name | ||
| 236 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | +Resources: | ||
| 24 | + WebappApplication: | ||
| 25 | + Type: "AWS::CodeDeploy::Application" | ||
| 26 | + Properties: | ||
| 27 | + ApplicationName: testApp | ||
| 28 | + WebappDeploymentGroup: | ||
| 29 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 30 | + Properties: | ||
| 31 | + DeploymentGroupName: test-group | ||
| 32 | + ApplicationName: !Ref WebappApplication | ||
| 33 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 34 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 35 | + DeploymentStyle: | ||
| 36 | + DeploymentType: IN_PLACE | ||
| 37 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 38 | + LoadBalancerInfo: | ||
| 39 | + ElbInfoList: | ||
| 40 | + - Name: testLoadbalancer | ||
| 41 | + AutoScalingGroups: | ||
| 42 | + - Ref: AutoScalingGroup | ||
| 43 | + ALBSecurityGroup: | ||
| 44 | + Type: AWS::EC2::SecurityGroup | ||
| 45 | + Properties: | ||
| 46 | + GroupDescription: allow access to ALB from internet | ||
| 47 | + VpcId: | ||
| 48 | + Ref: VPC | ||
| 49 | + SecurityGroupIngress: | ||
| 50 | + - IpProtocol: tcp | ||
| 51 | + FromPort: '80' | ||
| 52 | + ToPort: '80' | ||
| 53 | + CidrIp: 0.0.0.0/0 | ||
| 54 | + WebappSecurityGroup: | ||
| 55 | + Type: AWS::EC2::SecurityGroup | ||
| 56 | + Properties: | ||
| 57 | + GroupDescription: allow access to Webapp from ALB | ||
| 58 | + VpcId: | ||
| 59 | + Ref: VPC | ||
| 60 | + SecurityGroupIngress: | ||
| 61 | + - IpProtocol: tcp | ||
| 62 | + FromPort: '3000' | ||
| 63 | + ToPort: '3000' | ||
| 64 | + SourceSecurityGroupId: | ||
| 65 | + Ref: ALBSecurityGroup | ||
| 66 | + - IpProtocol: tcp | ||
| 67 | + FromPort: '22' | ||
| 68 | + ToPort: '22' | ||
| 69 | + CidrIp: 0.0.0.0/0 | ||
| 70 | + WebappDeploymentBucket: | ||
| 71 | + Type: "AWS::S3::Bucket" | ||
| 72 | + Properties: | ||
| 73 | + BucketName: 'testtest11324' | ||
| 74 | + CodeDeployRole: | ||
| 75 | + Type: "AWS::IAM::Role" | ||
| 76 | + Properties: | ||
| 77 | + AssumeRolePolicyDocument: | ||
| 78 | + Version: "2012-10-17" | ||
| 79 | + Statement: | ||
| 80 | + - | ||
| 81 | + Effect: "Allow" | ||
| 82 | + Principal: | ||
| 83 | + Service: | ||
| 84 | + - "codedeploy.amazonaws.com" | ||
| 85 | + Action: | ||
| 86 | + - "sts:AssumeRole" | ||
| 87 | + Policies: | ||
| 88 | + - | ||
| 89 | + PolicyName: allow-autoscaling | ||
| 90 | + PolicyDocument: | ||
| 91 | + Version: "2012-10-17" | ||
| 92 | + Statement: | ||
| 93 | + - | ||
| 94 | + Effect: Allow | ||
| 95 | + Action: | ||
| 96 | + - ec2:* | ||
| 97 | + - autoscaling:* | ||
| 98 | + Resource: "*" | ||
| 99 | + - | ||
| 100 | + PolicyName: allow-loadbalance | ||
| 101 | + PolicyDocument: | ||
| 102 | + Version: "2012-10-17" | ||
| 103 | + Statement: | ||
| 104 | + - | ||
| 105 | + Effect: Allow | ||
| 106 | + Action: | ||
| 107 | + - ec2:* | ||
| 108 | + - autoscaling:* | ||
| 109 | + Resource: "*" | ||
| 110 | + - | ||
| 111 | + Effect: Allow | ||
| 112 | + Action: | ||
| 113 | + - iam:CreateServiceLinkedRole | ||
| 114 | + Resource: "*" | ||
| 115 | + - | ||
| 116 | + Effect: Allow | ||
| 117 | + Action: | ||
| 118 | + - elasticloadbalancing:* | ||
| 119 | + Resource: "*" | ||
| 120 | + WebappRole: | ||
| 121 | + Type: "AWS::IAM::Role" | ||
| 122 | + Properties: | ||
| 123 | + AssumeRolePolicyDocument: | ||
| 124 | + Version: "2012-10-17" | ||
| 125 | + Statement: | ||
| 126 | + - | ||
| 127 | + Effect: "Allow" | ||
| 128 | + Principal: | ||
| 129 | + Service: | ||
| 130 | + - "ec2.amazonaws.com" | ||
| 131 | + - "codedeploy.amazonaws.com" | ||
| 132 | + Action: | ||
| 133 | + - "sts:AssumeRole" | ||
| 134 | + Policies: | ||
| 135 | + - | ||
| 136 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 137 | + PolicyDocument: | ||
| 138 | + Version: "2012-10-17" | ||
| 139 | + Statement: | ||
| 140 | + - | ||
| 141 | + Effect: "Allow" | ||
| 142 | + Action: "s3:getObject" | ||
| 143 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 144 | + WebappInstanceProfile: | ||
| 145 | + Type: "AWS::IAM::InstanceProfile" | ||
| 146 | + Properties: | ||
| 147 | + Roles: | ||
| 148 | + - Ref: WebappRole | ||
| 149 | + WebappLaunchConfig: | ||
| 150 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 151 | + Properties: | ||
| 152 | + AssociatePublicIpAddress: true | ||
| 153 | + ImageId: | ||
| 154 | + Ref: AMIID | ||
| 155 | + InstanceType: t2.micro | ||
| 156 | + KeyName: | ||
| 157 | + Ref: KeyName | ||
| 158 | + SecurityGroups: | ||
| 159 | + - Ref: WebappSecurityGroup | ||
| 160 | + IamInstanceProfile: | ||
| 161 | + Ref: WebappInstanceProfile | ||
| 162 | + UserData: | ||
| 163 | + Fn::Base64: !Sub | | ||
| 164 | + #! /bin/bash -xe | ||
| 165 | + # update yum just in case | ||
| 166 | + yum update -y | ||
| 167 | + # get node into yum | ||
| 168 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 169 | + # install node and npm in one line | ||
| 170 | + yum install -y nodejs | ||
| 171 | + install pm2 to restart node app | ||
| 172 | + npm i -g pm2@2.4.3 | ||
| 173 | + AutoScalingGroup: | ||
| 174 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 175 | + Properties: | ||
| 176 | + HealthCheckType: ELB | ||
| 177 | + HealthCheckGracePeriod: 300 | ||
| 178 | + MinSize: | ||
| 179 | + Ref: MinSize | ||
| 180 | + MaxSize: | ||
| 181 | + Ref: MaxSize | ||
| 182 | + LaunchConfigurationName: | ||
| 183 | + Ref: WebappLaunchConfig | ||
| 184 | + VPCZoneIdentifier: | ||
| 185 | + Ref: WebappSubnets | ||
| 186 | + TargetGroupARNs: | ||
| 187 | + - Ref: ALBTargetGroup | ||
| 188 | + Tags: | ||
| 189 | + - Key: Name | ||
| 190 | + Value: webapp-example | ||
| 191 | + PropagateAtLaunch: true | ||
| 192 | + ALBListener: | ||
| 193 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 194 | + Properties: | ||
| 195 | + DefaultActions: | ||
| 196 | + - | ||
| 197 | + Type: forward | ||
| 198 | + TargetGroupArn: | ||
| 199 | + Ref: ALBTargetGroup | ||
| 200 | + LoadBalancerArn: | ||
| 201 | + Ref: LoadBalancer | ||
| 202 | + Port: 80 | ||
| 203 | + Protocol: HTTP | ||
| 204 | + LoadBalancer: | ||
| 205 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 206 | + Properties: | ||
| 207 | + Name: testLoadbalancer | ||
| 208 | + Scheme: internet-facing | ||
| 209 | + Subnets: | ||
| 210 | + Ref: ALBSubnets | ||
| 211 | + SecurityGroups: | ||
| 212 | + - Ref: ALBSecurityGroup | ||
| 213 | + ALBTargetGroup: | ||
| 214 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 215 | + Properties: | ||
| 216 | + HealthCheckIntervalSeconds: 30 | ||
| 217 | + UnhealthyThresholdCount: 2 | ||
| 218 | + HealthyThresholdCount: 2 | ||
| 219 | + HealthCheckPath: / | ||
| 220 | + Port: 3000 | ||
| 221 | + Protocol: HTTP | ||
| 222 | + VpcId: | ||
| 223 | + Ref: VPC | ||
| 224 | +Outputs: | ||
| 225 | + WebappUrl: | ||
| 226 | + Description: Webapp URL | ||
| 227 | + Value: !GetAtt LoadBalancer.DNSName | ||
| 228 | + DeploymentGroup: | ||
| 229 | + Description: Webapp Deployment Group | ||
| 230 | + Value: !Ref WebappDeploymentGroup | ||
| 231 | + DeploymentBucket: | ||
| 232 | + Description: Deployment bucket | ||
| 233 | + Value: !Ref WebappDeploymentBucket | ||
| 234 | + ApplicationName: | ||
| 235 | + Description: CodeDeploy Application name | ||
| 236 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | + NamePrefix: | ||
| 24 | + AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*' | ||
| 25 | + Default: bluegreen | ||
| 26 | + Description: Prefix for resource tags made by this template (2-15 chars). | ||
| 27 | + MaxLength: 15 | ||
| 28 | + MinLength: 2 | ||
| 29 | + Type: String | ||
| 30 | +Resources: | ||
| 31 | + WebappApplication: | ||
| 32 | + Type: "AWS::CodeDeploy::Application" | ||
| 33 | + Properties: | ||
| 34 | + ApplicationName: testApp | ||
| 35 | + WebappDeploymentGroup: | ||
| 36 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 37 | + Properties: | ||
| 38 | + DeploymentGroupName: test-group | ||
| 39 | + ApplicationName: !Ref WebappApplication | ||
| 40 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 41 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 42 | + DeploymentStyle: | ||
| 43 | + DeploymentType: IN_PLACE | ||
| 44 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 45 | + LoadBalancerInfo: | ||
| 46 | + ElbInfoList: | ||
| 47 | + - Name: testLoadbalancer | ||
| 48 | + AutoScalingGroups: | ||
| 49 | + - Ref: AutoScalingGroup | ||
| 50 | + ALBSecurityGroup: | ||
| 51 | + Type: AWS::EC2::SecurityGroup | ||
| 52 | + Properties: | ||
| 53 | + GroupDescription: allow access to ALB from internet | ||
| 54 | + VpcId: | ||
| 55 | + Ref: VPC | ||
| 56 | + SecurityGroupIngress: | ||
| 57 | + - IpProtocol: tcp | ||
| 58 | + FromPort: '80' | ||
| 59 | + ToPort: '80' | ||
| 60 | + CidrIp: 0.0.0.0/0 | ||
| 61 | + WebappSecurityGroup: | ||
| 62 | + Type: AWS::EC2::SecurityGroup | ||
| 63 | + Properties: | ||
| 64 | + GroupDescription: allow access to Webapp from ALB | ||
| 65 | + VpcId: | ||
| 66 | + Ref: VPC | ||
| 67 | + SecurityGroupIngress: | ||
| 68 | + - IpProtocol: tcp | ||
| 69 | + FromPort: '3000' | ||
| 70 | + ToPort: '3000' | ||
| 71 | + SourceSecurityGroupId: | ||
| 72 | + Ref: ALBSecurityGroup | ||
| 73 | + - IpProtocol: tcp | ||
| 74 | + FromPort: '22' | ||
| 75 | + ToPort: '22' | ||
| 76 | + CidrIp: 0.0.0.0/0 | ||
| 77 | + WebappDeploymentBucket: | ||
| 78 | + Type: "AWS::S3::Bucket" | ||
| 79 | + Properties: | ||
| 80 | + BucketName: 'testtest11324' | ||
| 81 | + CodeDeployRole: | ||
| 82 | + Type: "AWS::IAM::Role" | ||
| 83 | + Properties: | ||
| 84 | + AssumeRolePolicyDocument: | ||
| 85 | + Version: "2012-10-17" | ||
| 86 | + Statement: | ||
| 87 | + - | ||
| 88 | + Effect: "Allow" | ||
| 89 | + Principal: | ||
| 90 | + Service: | ||
| 91 | + - "codedeploy.amazonaws.com" | ||
| 92 | + Action: | ||
| 93 | + - "sts:AssumeRole" | ||
| 94 | + Policies: | ||
| 95 | + - | ||
| 96 | + PolicyName: allow-autoscaling | ||
| 97 | + PolicyDocument: | ||
| 98 | + Version: "2012-10-17" | ||
| 99 | + Statement: | ||
| 100 | + - | ||
| 101 | + Effect: Allow | ||
| 102 | + Action: | ||
| 103 | + - ec2:* | ||
| 104 | + - autoscaling:* | ||
| 105 | + Resource: "*" | ||
| 106 | + - | ||
| 107 | + PolicyName: allow-loadbalance | ||
| 108 | + PolicyDocument: | ||
| 109 | + Version: "2012-10-17" | ||
| 110 | + Statement: | ||
| 111 | + - | ||
| 112 | + Effect: Allow | ||
| 113 | + Action: | ||
| 114 | + - ec2:* | ||
| 115 | + - autoscaling:* | ||
| 116 | + Resource: "*" | ||
| 117 | + - | ||
| 118 | + Effect: Allow | ||
| 119 | + Action: | ||
| 120 | + - iam:CreateServiceLinkedRole | ||
| 121 | + Resource: "*" | ||
| 122 | + - | ||
| 123 | + Effect: Allow | ||
| 124 | + Action: | ||
| 125 | + - elasticloadbalancing:* | ||
| 126 | + Resource: "*" | ||
| 127 | + WebappRole: | ||
| 128 | + Type: "AWS::IAM::Role" | ||
| 129 | + Properties: | ||
| 130 | + AssumeRolePolicyDocument: | ||
| 131 | + Version: "2012-10-17" | ||
| 132 | + Statement: | ||
| 133 | + - | ||
| 134 | + Effect: "Allow" | ||
| 135 | + Principal: | ||
| 136 | + Service: | ||
| 137 | + - "ec2.amazonaws.com" | ||
| 138 | + - "codedeploy.amazonaws.com" | ||
| 139 | + Action: | ||
| 140 | + - "sts:AssumeRole" | ||
| 141 | + Policies: | ||
| 142 | + - | ||
| 143 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 144 | + PolicyDocument: | ||
| 145 | + Version: "2012-10-17" | ||
| 146 | + Statement: | ||
| 147 | + - | ||
| 148 | + Effect: "Allow" | ||
| 149 | + Action: "s3:getObject" | ||
| 150 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 151 | + WebappInstanceProfile: | ||
| 152 | + Type: "AWS::IAM::InstanceProfile" | ||
| 153 | + Properties: | ||
| 154 | + Roles: | ||
| 155 | + - Ref: WebappRole | ||
| 156 | + WebappLaunchConfig: | ||
| 157 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 158 | + Properties: | ||
| 159 | + AssociatePublicIpAddress: true | ||
| 160 | + ImageId: | ||
| 161 | + Ref: AMIID | ||
| 162 | + InstanceType: t2.micro | ||
| 163 | + KeyName: | ||
| 164 | + Ref: KeyName | ||
| 165 | + SecurityGroups: | ||
| 166 | + - Ref: WebappSecurityGroup | ||
| 167 | + IamInstanceProfile: | ||
| 168 | + Ref: WebappInstanceProfile | ||
| 169 | + UserData: | ||
| 170 | + Fn::Base64: !Sub | | ||
| 171 | + #! /bin/bash -xe | ||
| 172 | + # update yum just in case | ||
| 173 | + yum update -y | ||
| 174 | + # get node into yum | ||
| 175 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 176 | + # install node and npm in one line | ||
| 177 | + yum install -y nodejs | ||
| 178 | + install pm2 to restart node app | ||
| 179 | + npm i -g pm2@2.4.3 | ||
| 180 | + AutoScalingGroup: | ||
| 181 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 182 | + Properties: | ||
| 183 | + HealthCheckType: ELB | ||
| 184 | + HealthCheckGracePeriod: 300 | ||
| 185 | + MinSize: | ||
| 186 | + Ref: MinSize | ||
| 187 | + MaxSize: | ||
| 188 | + Ref: MaxSize | ||
| 189 | + LaunchConfigurationName: | ||
| 190 | + Ref: WebappLaunchConfig | ||
| 191 | + VPCZoneIdentifier: | ||
| 192 | + Ref: WebappSubnets | ||
| 193 | + TargetGroupARNs: | ||
| 194 | + - Ref: ALBTargetGroup | ||
| 195 | + Tags: | ||
| 196 | + - Key: Name | ||
| 197 | + Value: webapp-example | ||
| 198 | + PropagateAtLaunch: true | ||
| 199 | + ALBListener: | ||
| 200 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 201 | + Properties: | ||
| 202 | + DefaultActions: | ||
| 203 | + - | ||
| 204 | + Type: forward | ||
| 205 | + TargetGroupArn: | ||
| 206 | + Ref: ALBTargetGroup | ||
| 207 | + LoadBalancerArn: | ||
| 208 | + Ref: LoadBalancer | ||
| 209 | + Port: 80 | ||
| 210 | + Protocol: HTTP | ||
| 211 | + LoadBalancer: | ||
| 212 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 213 | + Properties: | ||
| 214 | + Name: testLoadbalancer | ||
| 215 | + Scheme: internet-facing | ||
| 216 | + Subnets: | ||
| 217 | + Ref: ALBSubnets | ||
| 218 | + SecurityGroups: | ||
| 219 | + - Ref: ALBSecurityGroup | ||
| 220 | + ALBTargetGroup: | ||
| 221 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 222 | + Properties: | ||
| 223 | + HealthCheckIntervalSeconds: 30 | ||
| 224 | + UnhealthyThresholdCount: 2 | ||
| 225 | + HealthyThresholdCount: 2 | ||
| 226 | + HealthCheckPath: / | ||
| 227 | + Port: 3000 | ||
| 228 | + Protocol: HTTP | ||
| 229 | + VpcId: | ||
| 230 | + Ref: VPC | ||
| 231 | +Outputs: | ||
| 232 | + WebappUrl: | ||
| 233 | + Description: Webapp URL | ||
| 234 | + Value: !GetAtt LoadBalancer.DNSName | ||
| 235 | + DeploymentGroup: | ||
| 236 | + Description: Webapp Deployment Group | ||
| 237 | + Value: !Ref WebappDeploymentGroup | ||
| 238 | + DeploymentBucket: | ||
| 239 | + Description: Deployment bucket | ||
| 240 | + Value: !Ref WebappDeploymentBucket | ||
| 241 | + ApplicationName: | ||
| 242 | + Description: CodeDeploy Application name | ||
| 243 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | + NamePrefix: | ||
| 24 | + AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*' | ||
| 25 | + Default: bluegreen | ||
| 26 | + Description: Prefix for resource tags made by this template (2-15 chars). | ||
| 27 | + MaxLength: 15 | ||
| 28 | + MinLength: 2 | ||
| 29 | + Type: String | ||
| 30 | +Resources: | ||
| 31 | + WebappApplication: | ||
| 32 | + Type: "AWS::CodeDeploy::Application" | ||
| 33 | + Properties: | ||
| 34 | + ApplicationName: testApp | ||
| 35 | + WebappDeploymentGroup: | ||
| 36 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 37 | + Properties: | ||
| 38 | + DeploymentGroupName: test-group | ||
| 39 | + ApplicationName: !Ref WebappApplication | ||
| 40 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 41 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 42 | + DeploymentStyle: | ||
| 43 | + DeploymentType: IN_PLACE | ||
| 44 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 45 | + LoadBalancerInfo: | ||
| 46 | + ElbInfoList: | ||
| 47 | + - Name: testLoadbalancer | ||
| 48 | + AutoScalingGroups: | ||
| 49 | + - Ref: AutoScalingGroup | ||
| 50 | + ALBSecurityGroup: | ||
| 51 | + Type: AWS::EC2::SecurityGroup | ||
| 52 | + Properties: | ||
| 53 | + GroupDescription: allow access to ALB from internet | ||
| 54 | + VpcId: | ||
| 55 | + Ref: VPC | ||
| 56 | + SecurityGroupIngress: | ||
| 57 | + - IpProtocol: tcp | ||
| 58 | + FromPort: '80' | ||
| 59 | + ToPort: '80' | ||
| 60 | + CidrIp: 0.0.0.0/0 | ||
| 61 | + WebappSecurityGroup: | ||
| 62 | + Type: AWS::EC2::SecurityGroup | ||
| 63 | + Properties: | ||
| 64 | + GroupDescription: allow access to Webapp from ALB | ||
| 65 | + VpcId: | ||
| 66 | + Ref: VPC | ||
| 67 | + SecurityGroupIngress: | ||
| 68 | + - IpProtocol: tcp | ||
| 69 | + FromPort: '3000' | ||
| 70 | + ToPort: '3000' | ||
| 71 | + SourceSecurityGroupId: | ||
| 72 | + Ref: ALBSecurityGroup | ||
| 73 | + - IpProtocol: tcp | ||
| 74 | + FromPort: '22' | ||
| 75 | + ToPort: '22' | ||
| 76 | + CidrIp: 0.0.0.0/0 | ||
| 77 | + WebappDeploymentBucket: | ||
| 78 | + Type: "AWS::S3::Bucket" | ||
| 79 | + Properties: | ||
| 80 | + BucketName: 'testtest11324' | ||
| 81 | + CodeDeployRole: | ||
| 82 | + Type: "AWS::IAM::Role" | ||
| 83 | + Properties: | ||
| 84 | + AssumeRolePolicyDocument: | ||
| 85 | + Version: "2012-10-17" | ||
| 86 | + Statement: | ||
| 87 | + - | ||
| 88 | + Effect: "Allow" | ||
| 89 | + Principal: | ||
| 90 | + Service: | ||
| 91 | + - "codedeploy.amazonaws.com" | ||
| 92 | + Action: | ||
| 93 | + - "sts:AssumeRole" | ||
| 94 | + Policies: | ||
| 95 | + - | ||
| 96 | + PolicyName: allow-autoscaling | ||
| 97 | + PolicyDocument: | ||
| 98 | + Version: "2012-10-17" | ||
| 99 | + Statement: | ||
| 100 | + - | ||
| 101 | + Effect: Allow | ||
| 102 | + Action: | ||
| 103 | + - ec2:* | ||
| 104 | + - autoscaling:* | ||
| 105 | + Resource: "*" | ||
| 106 | + - | ||
| 107 | + PolicyName: allow-loadbalance | ||
| 108 | + PolicyDocument: | ||
| 109 | + Version: "2012-10-17" | ||
| 110 | + Statement: | ||
| 111 | + - | ||
| 112 | + Effect: Allow | ||
| 113 | + Action: | ||
| 114 | + - ec2:* | ||
| 115 | + - autoscaling:* | ||
| 116 | + Resource: "*" | ||
| 117 | + - | ||
| 118 | + Effect: Allow | ||
| 119 | + Action: | ||
| 120 | + - iam:CreateServiceLinkedRole | ||
| 121 | + Resource: "*" | ||
| 122 | + - | ||
| 123 | + Effect: Allow | ||
| 124 | + Action: | ||
| 125 | + - elasticloadbalancing:* | ||
| 126 | + Resource: "*" | ||
| 127 | + WebappRole: | ||
| 128 | + Type: "AWS::IAM::Role" | ||
| 129 | + Properties: | ||
| 130 | + AssumeRolePolicyDocument: | ||
| 131 | + Version: "2012-10-17" | ||
| 132 | + Statement: | ||
| 133 | + - | ||
| 134 | + Effect: "Allow" | ||
| 135 | + Principal: | ||
| 136 | + Service: | ||
| 137 | + - "ec2.amazonaws.com" | ||
| 138 | + - "codedeploy.amazonaws.com" | ||
| 139 | + Action: | ||
| 140 | + - "sts:AssumeRole" | ||
| 141 | + Policies: | ||
| 142 | + - | ||
| 143 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 144 | + PolicyDocument: | ||
| 145 | + Version: "2012-10-17" | ||
| 146 | + Statement: | ||
| 147 | + - | ||
| 148 | + Effect: "Allow" | ||
| 149 | + Action: "s3:getObject" | ||
| 150 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 151 | + WebappInstanceProfile: | ||
| 152 | + Type: "AWS::IAM::InstanceProfile" | ||
| 153 | + Properties: | ||
| 154 | + Roles: | ||
| 155 | + - Ref: WebappRole | ||
| 156 | + WebappLaunchConfig: | ||
| 157 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 158 | + Properties: | ||
| 159 | + AssociatePublicIpAddress: true | ||
| 160 | + ImageId: | ||
| 161 | + Ref: AMIID | ||
| 162 | + InstanceType: t2.micro | ||
| 163 | + KeyName: | ||
| 164 | + Ref: KeyName | ||
| 165 | + SecurityGroups: | ||
| 166 | + - Ref: WebappSecurityGroup | ||
| 167 | + IamInstanceProfile: | ||
| 168 | + Ref: WebappInstanceProfile | ||
| 169 | + UserData: | ||
| 170 | + Fn::Base64: !Sub | | ||
| 171 | + #! /bin/bash -xe | ||
| 172 | + # update yum just in case | ||
| 173 | + yum update -y | ||
| 174 | + # get node into yum | ||
| 175 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 176 | + # install node and npm in one line | ||
| 177 | + yum install -y nodejs | ||
| 178 | + install pm2 to restart node app | ||
| 179 | + npm i -g pm2@2.4.3 | ||
| 180 | + AutoScalingGroup: | ||
| 181 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 182 | + Properties: | ||
| 183 | + HealthCheckType: ELB | ||
| 184 | + HealthCheckGracePeriod: 300 | ||
| 185 | + MinSize: | ||
| 186 | + Ref: MinSize | ||
| 187 | + MaxSize: | ||
| 188 | + Ref: MaxSize | ||
| 189 | + LaunchConfigurationName: | ||
| 190 | + Ref: WebappLaunchConfig | ||
| 191 | + VPCZoneIdentifier: | ||
| 192 | + Ref: WebappSubnets | ||
| 193 | + TargetGroupARNs: | ||
| 194 | + - Ref: ALBTargetGroup | ||
| 195 | + Tags: | ||
| 196 | + - Key: Name | ||
| 197 | + Value: webapp-example | ||
| 198 | + PropagateAtLaunch: true | ||
| 199 | + ALBListener: | ||
| 200 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 201 | + Properties: | ||
| 202 | + DefaultActions: | ||
| 203 | + - | ||
| 204 | + Type: forward | ||
| 205 | + TargetGroupArn: | ||
| 206 | + Ref: ALBTargetGroup | ||
| 207 | + LoadBalancerArn: | ||
| 208 | + Ref: LoadBalancer | ||
| 209 | + Port: 80 | ||
| 210 | + Protocol: HTTP | ||
| 211 | + LoadBalancer: | ||
| 212 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 213 | + Properties: | ||
| 214 | + Name: testLoadbalancer | ||
| 215 | + Scheme: internet-facing | ||
| 216 | + Subnets: | ||
| 217 | + Ref: ALBSubnets | ||
| 218 | + SecurityGroups: | ||
| 219 | + - Ref: ALBSecurityGroup | ||
| 220 | + Tags: | ||
| 221 | + - Key: Name | ||
| 222 | + Value: | ||
| 223 | + !Join ["", [ Ref: NamePrefix, "-elb"] ] | ||
| 224 | + ALBTargetGroup: | ||
| 225 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 226 | + Properties: | ||
| 227 | + HealthCheckIntervalSeconds: 30 | ||
| 228 | + UnhealthyThresholdCount: 2 | ||
| 229 | + HealthyThresholdCount: 2 | ||
| 230 | + HealthCheckPath: / | ||
| 231 | + Port: 3000 | ||
| 232 | + Protocol: HTTP | ||
| 233 | + VpcId: | ||
| 234 | + Ref: VPC | ||
| 235 | +Outputs: | ||
| 236 | + WebappUrl: | ||
| 237 | + Description: Webapp URL | ||
| 238 | + Value: !GetAtt LoadBalancer.DNSName | ||
| 239 | + DeploymentGroup: | ||
| 240 | + Description: Webapp Deployment Group | ||
| 241 | + Value: !Ref WebappDeploymentGroup | ||
| 242 | + DeploymentBucket: | ||
| 243 | + Description: Deployment bucket | ||
| 244 | + Value: !Ref WebappDeploymentBucket | ||
| 245 | + ApplicationName: | ||
| 246 | + Description: CodeDeploy Application name | ||
| 247 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | + NamePrefix: | ||
| 24 | + AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*' | ||
| 25 | + Default: bluegreen | ||
| 26 | + Description: Prefix for resource tags made by this template (2-15 chars). | ||
| 27 | + MaxLength: 15 | ||
| 28 | + MinLength: 2 | ||
| 29 | + Type: String | ||
| 30 | +Resources: | ||
| 31 | + WebappApplication: | ||
| 32 | + Type: "AWS::CodeDeploy::Application" | ||
| 33 | + Properties: | ||
| 34 | + ApplicationName: testApp | ||
| 35 | + WebappDeploymentGroup: | ||
| 36 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 37 | + Properties: | ||
| 38 | + DeploymentGroupName: test-group | ||
| 39 | + ApplicationName: !Ref WebappApplication | ||
| 40 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 41 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 42 | + DeploymentStyle: | ||
| 43 | + DeploymentType: IN_PLACE | ||
| 44 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 45 | + LoadBalancerInfo: | ||
| 46 | + ElbInfoList: | ||
| 47 | + - Name: testLoadbalancer | ||
| 48 | + AutoScalingGroups: | ||
| 49 | + - Ref: AutoScalingGroup | ||
| 50 | + ALBSecurityGroup: | ||
| 51 | + Type: AWS::EC2::SecurityGroup | ||
| 52 | + Properties: | ||
| 53 | + GroupDescription: allow access to ALB from internet | ||
| 54 | + VpcId: | ||
| 55 | + Ref: VPC | ||
| 56 | + SecurityGroupIngress: | ||
| 57 | + - IpProtocol: tcp | ||
| 58 | + FromPort: '80' | ||
| 59 | + ToPort: '80' | ||
| 60 | + CidrIp: 0.0.0.0/0 | ||
| 61 | + WebappSecurityGroup: | ||
| 62 | + Type: AWS::EC2::SecurityGroup | ||
| 63 | + Properties: | ||
| 64 | + GroupDescription: allow access to Webapp from ALB | ||
| 65 | + VpcId: | ||
| 66 | + Ref: VPC | ||
| 67 | + SecurityGroupIngress: | ||
| 68 | + - IpProtocol: tcp | ||
| 69 | + FromPort: '3000' | ||
| 70 | + ToPort: '3000' | ||
| 71 | + SourceSecurityGroupId: | ||
| 72 | + Ref: ALBSecurityGroup | ||
| 73 | + - IpProtocol: tcp | ||
| 74 | + FromPort: '22' | ||
| 75 | + ToPort: '22' | ||
| 76 | + CidrIp: 0.0.0.0/0 | ||
| 77 | + WebappDeploymentBucket: | ||
| 78 | + Type: "AWS::S3::Bucket" | ||
| 79 | + Properties: | ||
| 80 | + BucketName: 'testtest11324' | ||
| 81 | + CodeDeployRole: | ||
| 82 | + Type: "AWS::IAM::Role" | ||
| 83 | + Properties: | ||
| 84 | + AssumeRolePolicyDocument: | ||
| 85 | + Version: "2012-10-17" | ||
| 86 | + Statement: | ||
| 87 | + - | ||
| 88 | + Effect: "Allow" | ||
| 89 | + Principal: | ||
| 90 | + Service: | ||
| 91 | + - "codedeploy.amazonaws.com" | ||
| 92 | + Action: | ||
| 93 | + - "sts:AssumeRole" | ||
| 94 | + Policies: | ||
| 95 | + - | ||
| 96 | + PolicyName: allow-autoscaling | ||
| 97 | + PolicyDocument: | ||
| 98 | + Version: "2012-10-17" | ||
| 99 | + Statement: | ||
| 100 | + - | ||
| 101 | + Effect: Allow | ||
| 102 | + Action: | ||
| 103 | + - ec2:* | ||
| 104 | + - autoscaling:* | ||
| 105 | + Resource: "*" | ||
| 106 | + - | ||
| 107 | + PolicyName: allow-loadbalance | ||
| 108 | + PolicyDocument: | ||
| 109 | + Version: "2012-10-17" | ||
| 110 | + Statement: | ||
| 111 | + - | ||
| 112 | + Effect: Allow | ||
| 113 | + Action: | ||
| 114 | + - ec2:* | ||
| 115 | + - autoscaling:* | ||
| 116 | + Resource: "*" | ||
| 117 | + - | ||
| 118 | + Effect: Allow | ||
| 119 | + Action: | ||
| 120 | + - iam:CreateServiceLinkedRole | ||
| 121 | + Resource: "*" | ||
| 122 | + - | ||
| 123 | + Effect: Allow | ||
| 124 | + Action: | ||
| 125 | + - elasticloadbalancing:* | ||
| 126 | + Resource: "*" | ||
| 127 | + WebappRole: | ||
| 128 | + Type: "AWS::IAM::Role" | ||
| 129 | + Properties: | ||
| 130 | + AssumeRolePolicyDocument: | ||
| 131 | + Version: "2012-10-17" | ||
| 132 | + Statement: | ||
| 133 | + - | ||
| 134 | + Effect: "Allow" | ||
| 135 | + Principal: | ||
| 136 | + Service: | ||
| 137 | + - "ec2.amazonaws.com" | ||
| 138 | + - "codedeploy.amazonaws.com" | ||
| 139 | + Action: | ||
| 140 | + - "sts:AssumeRole" | ||
| 141 | + Policies: | ||
| 142 | + - | ||
| 143 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 144 | + PolicyDocument: | ||
| 145 | + Version: "2012-10-17" | ||
| 146 | + Statement: | ||
| 147 | + - | ||
| 148 | + Effect: "Allow" | ||
| 149 | + Action: "s3:getObject" | ||
| 150 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 151 | + WebappInstanceProfile: | ||
| 152 | + Type: "AWS::IAM::InstanceProfile" | ||
| 153 | + Properties: | ||
| 154 | + Roles: | ||
| 155 | + - Ref: WebappRole | ||
| 156 | + WebappLaunchConfig: | ||
| 157 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 158 | + Properties: | ||
| 159 | + AssociatePublicIpAddress: true | ||
| 160 | + ImageId: | ||
| 161 | + Ref: AMIID | ||
| 162 | + InstanceType: t2.micro | ||
| 163 | + KeyName: | ||
| 164 | + Ref: KeyName | ||
| 165 | + SecurityGroups: | ||
| 166 | + - Ref: WebappSecurityGroup | ||
| 167 | + IamInstanceProfile: | ||
| 168 | + Ref: WebappInstanceProfile | ||
| 169 | + UserData: | ||
| 170 | + Fn::Base64: !Sub | | ||
| 171 | + #! /bin/bash -xe | ||
| 172 | + # update yum just in case | ||
| 173 | + yum update -y | ||
| 174 | + # get node into yum | ||
| 175 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 176 | + # install node and npm in one line | ||
| 177 | + yum install -y nodejs | ||
| 178 | + install pm2 to restart node app | ||
| 179 | + npm i -g pm2@2.4.3 | ||
| 180 | + AutoScalingGroup: | ||
| 181 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 182 | + Properties: | ||
| 183 | + HealthCheckType: ELB | ||
| 184 | + HealthCheckGracePeriod: 300 | ||
| 185 | + MinSize: | ||
| 186 | + Ref: MinSize | ||
| 187 | + MaxSize: | ||
| 188 | + Ref: MaxSize | ||
| 189 | + LaunchConfigurationName: | ||
| 190 | + Ref: WebappLaunchConfig | ||
| 191 | + VPCZoneIdentifier: | ||
| 192 | + Ref: WebappSubnets | ||
| 193 | + TargetGroupARNs: | ||
| 194 | + - Ref: ALBTargetGroup | ||
| 195 | + Tags: | ||
| 196 | + - Key: Name | ||
| 197 | + Value: webapp-example | ||
| 198 | + PropagateAtLaunch: true | ||
| 199 | + ALBListener: | ||
| 200 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 201 | + Properties: | ||
| 202 | + DefaultActions: | ||
| 203 | + - | ||
| 204 | + Type: forward | ||
| 205 | + TargetGroupArn: | ||
| 206 | + Ref: ALBTargetGroup | ||
| 207 | + LoadBalancerArn: | ||
| 208 | + Ref: LoadBalancer | ||
| 209 | + Port: 80 | ||
| 210 | + Protocol: HTTP | ||
| 211 | + LoadBalancer: | ||
| 212 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 213 | + Properties: | ||
| 214 | + Scheme: internet-facing | ||
| 215 | + Subnets: | ||
| 216 | + Ref: ALBSubnets | ||
| 217 | + SecurityGroups: | ||
| 218 | + - Ref: ALBSecurityGroup | ||
| 219 | + Tags: | ||
| 220 | + - Key: Name | ||
| 221 | + Value: | ||
| 222 | + !Join ["", [ Ref: NamePrefix, "-elb"] ] | ||
| 223 | + ALBTargetGroup: | ||
| 224 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 225 | + Properties: | ||
| 226 | + HealthCheckIntervalSeconds: 30 | ||
| 227 | + UnhealthyThresholdCount: 2 | ||
| 228 | + HealthyThresholdCount: 2 | ||
| 229 | + HealthCheckPath: / | ||
| 230 | + Port: 3000 | ||
| 231 | + Protocol: HTTP | ||
| 232 | + VpcId: | ||
| 233 | + Ref: VPC | ||
| 234 | +Outputs: | ||
| 235 | + WebappUrl: | ||
| 236 | + Description: Webapp URL | ||
| 237 | + Value: !GetAtt LoadBalancer.DNSName | ||
| 238 | + DeploymentGroup: | ||
| 239 | + Description: Webapp Deployment Group | ||
| 240 | + Value: !Ref WebappDeploymentGroup | ||
| 241 | + DeploymentBucket: | ||
| 242 | + Description: Deployment bucket | ||
| 243 | + Value: !Ref WebappDeploymentBucket | ||
| 244 | + ApplicationName: | ||
| 245 | + Description: CodeDeploy Application name | ||
| 246 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | + NamePrefix: | ||
| 24 | + AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*' | ||
| 25 | + Default: bluegreen | ||
| 26 | + Description: Prefix for resource tags made by this template (2-15 chars). | ||
| 27 | + MaxLength: 15 | ||
| 28 | + MinLength: 2 | ||
| 29 | + Type: String | ||
| 30 | +Resources: | ||
| 31 | + WebappApplication: | ||
| 32 | + Type: "AWS::CodeDeploy::Application" | ||
| 33 | + Properties: | ||
| 34 | + ApplicationName: testApp | ||
| 35 | + WebappDeploymentGroup: | ||
| 36 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 37 | + Properties: | ||
| 38 | + DeploymentGroupName: test-group | ||
| 39 | + ApplicationName: !Ref WebappApplication | ||
| 40 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 41 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 42 | + DeploymentStyle: | ||
| 43 | + DeploymentType: IN_PLACE | ||
| 44 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 45 | + LoadBalancerInfo: | ||
| 46 | + TargetGroupInfoList:: | ||
| 47 | + - Name: testLoadbalancer | ||
| 48 | + AutoScalingGroups: | ||
| 49 | + - Ref: AutoScalingGroup | ||
| 50 | + ALBSecurityGroup: | ||
| 51 | + Type: AWS::EC2::SecurityGroup | ||
| 52 | + Properties: | ||
| 53 | + GroupDescription: allow access to ALB from internet | ||
| 54 | + VpcId: | ||
| 55 | + Ref: VPC | ||
| 56 | + SecurityGroupIngress: | ||
| 57 | + - IpProtocol: tcp | ||
| 58 | + FromPort: '80' | ||
| 59 | + ToPort: '80' | ||
| 60 | + CidrIp: 0.0.0.0/0 | ||
| 61 | + WebappSecurityGroup: | ||
| 62 | + Type: AWS::EC2::SecurityGroup | ||
| 63 | + Properties: | ||
| 64 | + GroupDescription: allow access to Webapp from ALB | ||
| 65 | + VpcId: | ||
| 66 | + Ref: VPC | ||
| 67 | + SecurityGroupIngress: | ||
| 68 | + - IpProtocol: tcp | ||
| 69 | + FromPort: '3000' | ||
| 70 | + ToPort: '3000' | ||
| 71 | + SourceSecurityGroupId: | ||
| 72 | + Ref: ALBSecurityGroup | ||
| 73 | + - IpProtocol: tcp | ||
| 74 | + FromPort: '22' | ||
| 75 | + ToPort: '22' | ||
| 76 | + CidrIp: 0.0.0.0/0 | ||
| 77 | + WebappDeploymentBucket: | ||
| 78 | + Type: "AWS::S3::Bucket" | ||
| 79 | + Properties: | ||
| 80 | + BucketName: 'testtest11324' | ||
| 81 | + CodeDeployRole: | ||
| 82 | + Type: "AWS::IAM::Role" | ||
| 83 | + Properties: | ||
| 84 | + AssumeRolePolicyDocument: | ||
| 85 | + Version: "2012-10-17" | ||
| 86 | + Statement: | ||
| 87 | + - | ||
| 88 | + Effect: "Allow" | ||
| 89 | + Principal: | ||
| 90 | + Service: | ||
| 91 | + - "codedeploy.amazonaws.com" | ||
| 92 | + Action: | ||
| 93 | + - "sts:AssumeRole" | ||
| 94 | + Policies: | ||
| 95 | + - | ||
| 96 | + PolicyName: allow-autoscaling | ||
| 97 | + PolicyDocument: | ||
| 98 | + Version: "2012-10-17" | ||
| 99 | + Statement: | ||
| 100 | + - | ||
| 101 | + Effect: Allow | ||
| 102 | + Action: | ||
| 103 | + - ec2:* | ||
| 104 | + - autoscaling:* | ||
| 105 | + Resource: "*" | ||
| 106 | + - | ||
| 107 | + PolicyName: allow-loadbalance | ||
| 108 | + PolicyDocument: | ||
| 109 | + Version: "2012-10-17" | ||
| 110 | + Statement: | ||
| 111 | + - | ||
| 112 | + Effect: Allow | ||
| 113 | + Action: | ||
| 114 | + - ec2:* | ||
| 115 | + - autoscaling:* | ||
| 116 | + Resource: "*" | ||
| 117 | + - | ||
| 118 | + Effect: Allow | ||
| 119 | + Action: | ||
| 120 | + - iam:CreateServiceLinkedRole | ||
| 121 | + Resource: "*" | ||
| 122 | + - | ||
| 123 | + Effect: Allow | ||
| 124 | + Action: | ||
| 125 | + - elasticloadbalancing:* | ||
| 126 | + Resource: "*" | ||
| 127 | + WebappRole: | ||
| 128 | + Type: "AWS::IAM::Role" | ||
| 129 | + Properties: | ||
| 130 | + AssumeRolePolicyDocument: | ||
| 131 | + Version: "2012-10-17" | ||
| 132 | + Statement: | ||
| 133 | + - | ||
| 134 | + Effect: "Allow" | ||
| 135 | + Principal: | ||
| 136 | + Service: | ||
| 137 | + - "ec2.amazonaws.com" | ||
| 138 | + - "codedeploy.amazonaws.com" | ||
| 139 | + Action: | ||
| 140 | + - "sts:AssumeRole" | ||
| 141 | + Policies: | ||
| 142 | + - | ||
| 143 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 144 | + PolicyDocument: | ||
| 145 | + Version: "2012-10-17" | ||
| 146 | + Statement: | ||
| 147 | + - | ||
| 148 | + Effect: "Allow" | ||
| 149 | + Action: "s3:getObject" | ||
| 150 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 151 | + WebappInstanceProfile: | ||
| 152 | + Type: "AWS::IAM::InstanceProfile" | ||
| 153 | + Properties: | ||
| 154 | + Roles: | ||
| 155 | + - Ref: WebappRole | ||
| 156 | + WebappLaunchConfig: | ||
| 157 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 158 | + Properties: | ||
| 159 | + AssociatePublicIpAddress: true | ||
| 160 | + ImageId: | ||
| 161 | + Ref: AMIID | ||
| 162 | + InstanceType: t2.micro | ||
| 163 | + KeyName: | ||
| 164 | + Ref: KeyName | ||
| 165 | + SecurityGroups: | ||
| 166 | + - Ref: WebappSecurityGroup | ||
| 167 | + IamInstanceProfile: | ||
| 168 | + Ref: WebappInstanceProfile | ||
| 169 | + UserData: | ||
| 170 | + Fn::Base64: !Sub | | ||
| 171 | + #! /bin/bash -xe | ||
| 172 | + # update yum just in case | ||
| 173 | + yum update -y | ||
| 174 | + # get node into yum | ||
| 175 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 176 | + # install node and npm in one line | ||
| 177 | + yum install -y nodejs | ||
| 178 | + install pm2 to restart node app | ||
| 179 | + npm i -g pm2@2.4.3 | ||
| 180 | + AutoScalingGroup: | ||
| 181 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 182 | + Properties: | ||
| 183 | + HealthCheckType: ELB | ||
| 184 | + HealthCheckGracePeriod: 300 | ||
| 185 | + MinSize: | ||
| 186 | + Ref: MinSize | ||
| 187 | + MaxSize: | ||
| 188 | + Ref: MaxSize | ||
| 189 | + LaunchConfigurationName: | ||
| 190 | + Ref: WebappLaunchConfig | ||
| 191 | + VPCZoneIdentifier: | ||
| 192 | + Ref: WebappSubnets | ||
| 193 | + TargetGroupARNs: | ||
| 194 | + - Ref: ALBTargetGroup | ||
| 195 | + Tags: | ||
| 196 | + - Key: Name | ||
| 197 | + Value: webapp-example | ||
| 198 | + PropagateAtLaunch: true | ||
| 199 | + ALBListener: | ||
| 200 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 201 | + Properties: | ||
| 202 | + DefaultActions: | ||
| 203 | + - | ||
| 204 | + Type: forward | ||
| 205 | + TargetGroupArn: | ||
| 206 | + Ref: ALBTargetGroup | ||
| 207 | + LoadBalancerArn: | ||
| 208 | + Ref: LoadBalancer | ||
| 209 | + Port: 80 | ||
| 210 | + Protocol: HTTP | ||
| 211 | + LoadBalancer: | ||
| 212 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 213 | + Properties: | ||
| 214 | + Scheme: internet-facing | ||
| 215 | + Subnets: | ||
| 216 | + Ref: ALBSubnets | ||
| 217 | + SecurityGroups: | ||
| 218 | + - Ref: ALBSecurityGroup | ||
| 219 | + Tags: | ||
| 220 | + - Key: Name | ||
| 221 | + Value: | ||
| 222 | + !Join ["", [ Ref: NamePrefix, "-elb"] ] | ||
| 223 | + ALBTargetGroup: | ||
| 224 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 225 | + Properties: | ||
| 226 | + HealthCheckIntervalSeconds: 30 | ||
| 227 | + UnhealthyThresholdCount: 2 | ||
| 228 | + HealthyThresholdCount: 2 | ||
| 229 | + HealthCheckPath: / | ||
| 230 | + Port: 3000 | ||
| 231 | + Protocol: HTTP | ||
| 232 | + VpcId: | ||
| 233 | + Ref: VPC | ||
| 234 | +Outputs: | ||
| 235 | + WebappUrl: | ||
| 236 | + Description: Webapp URL | ||
| 237 | + Value: !GetAtt LoadBalancer.DNSName | ||
| 238 | + DeploymentGroup: | ||
| 239 | + Description: Webapp Deployment Group | ||
| 240 | + Value: !Ref WebappDeploymentGroup | ||
| 241 | + DeploymentBucket: | ||
| 242 | + Description: Deployment bucket | ||
| 243 | + Value: !Ref WebappDeploymentBucket | ||
| 244 | + ApplicationName: | ||
| 245 | + Description: CodeDeploy Application name | ||
| 246 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | + NamePrefix: | ||
| 24 | + AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*' | ||
| 25 | + Default: bluegreen | ||
| 26 | + Description: Prefix for resource tags made by this template (2-15 chars). | ||
| 27 | + MaxLength: 15 | ||
| 28 | + MinLength: 2 | ||
| 29 | + Type: String | ||
| 30 | +Resources: | ||
| 31 | + WebappApplication: | ||
| 32 | + Type: "AWS::CodeDeploy::Application" | ||
| 33 | + Properties: | ||
| 34 | + ApplicationName: testApp | ||
| 35 | + WebappDeploymentGroup: | ||
| 36 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 37 | + Properties: | ||
| 38 | + DeploymentGroupName: test-group | ||
| 39 | + ApplicationName: !Ref WebappApplication | ||
| 40 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 41 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 42 | + DeploymentStyle: | ||
| 43 | + DeploymentType: IN_PLACE | ||
| 44 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 45 | + LoadBalancerInfo: | ||
| 46 | + TargetGroupInfoList: | ||
| 47 | + - Name: testLoadbalancer | ||
| 48 | + AutoScalingGroups: | ||
| 49 | + - Ref: AutoScalingGroup | ||
| 50 | + ALBSecurityGroup: | ||
| 51 | + Type: AWS::EC2::SecurityGroup | ||
| 52 | + Properties: | ||
| 53 | + GroupDescription: allow access to ALB from internet | ||
| 54 | + VpcId: | ||
| 55 | + Ref: VPC | ||
| 56 | + SecurityGroupIngress: | ||
| 57 | + - IpProtocol: tcp | ||
| 58 | + FromPort: '80' | ||
| 59 | + ToPort: '80' | ||
| 60 | + CidrIp: 0.0.0.0/0 | ||
| 61 | + WebappSecurityGroup: | ||
| 62 | + Type: AWS::EC2::SecurityGroup | ||
| 63 | + Properties: | ||
| 64 | + GroupDescription: allow access to Webapp from ALB | ||
| 65 | + VpcId: | ||
| 66 | + Ref: VPC | ||
| 67 | + SecurityGroupIngress: | ||
| 68 | + - IpProtocol: tcp | ||
| 69 | + FromPort: '3000' | ||
| 70 | + ToPort: '3000' | ||
| 71 | + SourceSecurityGroupId: | ||
| 72 | + Ref: ALBSecurityGroup | ||
| 73 | + - IpProtocol: tcp | ||
| 74 | + FromPort: '22' | ||
| 75 | + ToPort: '22' | ||
| 76 | + CidrIp: 0.0.0.0/0 | ||
| 77 | + WebappDeploymentBucket: | ||
| 78 | + Type: "AWS::S3::Bucket" | ||
| 79 | + Properties: | ||
| 80 | + BucketName: 'testtest11324' | ||
| 81 | + CodeDeployRole: | ||
| 82 | + Type: "AWS::IAM::Role" | ||
| 83 | + Properties: | ||
| 84 | + AssumeRolePolicyDocument: | ||
| 85 | + Version: "2012-10-17" | ||
| 86 | + Statement: | ||
| 87 | + - | ||
| 88 | + Effect: "Allow" | ||
| 89 | + Principal: | ||
| 90 | + Service: | ||
| 91 | + - "codedeploy.amazonaws.com" | ||
| 92 | + Action: | ||
| 93 | + - "sts:AssumeRole" | ||
| 94 | + Policies: | ||
| 95 | + - | ||
| 96 | + PolicyName: allow-autoscaling | ||
| 97 | + PolicyDocument: | ||
| 98 | + Version: "2012-10-17" | ||
| 99 | + Statement: | ||
| 100 | + - | ||
| 101 | + Effect: Allow | ||
| 102 | + Action: | ||
| 103 | + - ec2:* | ||
| 104 | + - autoscaling:* | ||
| 105 | + Resource: "*" | ||
| 106 | + - | ||
| 107 | + PolicyName: allow-loadbalance | ||
| 108 | + PolicyDocument: | ||
| 109 | + Version: "2012-10-17" | ||
| 110 | + Statement: | ||
| 111 | + - | ||
| 112 | + Effect: Allow | ||
| 113 | + Action: | ||
| 114 | + - ec2:* | ||
| 115 | + - autoscaling:* | ||
| 116 | + Resource: "*" | ||
| 117 | + - | ||
| 118 | + Effect: Allow | ||
| 119 | + Action: | ||
| 120 | + - iam:CreateServiceLinkedRole | ||
| 121 | + Resource: "*" | ||
| 122 | + - | ||
| 123 | + Effect: Allow | ||
| 124 | + Action: | ||
| 125 | + - elasticloadbalancing:* | ||
| 126 | + Resource: "*" | ||
| 127 | + WebappRole: | ||
| 128 | + Type: "AWS::IAM::Role" | ||
| 129 | + Properties: | ||
| 130 | + AssumeRolePolicyDocument: | ||
| 131 | + Version: "2012-10-17" | ||
| 132 | + Statement: | ||
| 133 | + - | ||
| 134 | + Effect: "Allow" | ||
| 135 | + Principal: | ||
| 136 | + Service: | ||
| 137 | + - "ec2.amazonaws.com" | ||
| 138 | + - "codedeploy.amazonaws.com" | ||
| 139 | + Action: | ||
| 140 | + - "sts:AssumeRole" | ||
| 141 | + Policies: | ||
| 142 | + - | ||
| 143 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 144 | + PolicyDocument: | ||
| 145 | + Version: "2012-10-17" | ||
| 146 | + Statement: | ||
| 147 | + - | ||
| 148 | + Effect: "Allow" | ||
| 149 | + Action: "s3:getObject" | ||
| 150 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 151 | + WebappInstanceProfile: | ||
| 152 | + Type: "AWS::IAM::InstanceProfile" | ||
| 153 | + Properties: | ||
| 154 | + Roles: | ||
| 155 | + - Ref: WebappRole | ||
| 156 | + WebappLaunchConfig: | ||
| 157 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 158 | + Properties: | ||
| 159 | + AssociatePublicIpAddress: true | ||
| 160 | + ImageId: | ||
| 161 | + Ref: AMIID | ||
| 162 | + InstanceType: t2.micro | ||
| 163 | + KeyName: | ||
| 164 | + Ref: KeyName | ||
| 165 | + SecurityGroups: | ||
| 166 | + - Ref: WebappSecurityGroup | ||
| 167 | + IamInstanceProfile: | ||
| 168 | + Ref: WebappInstanceProfile | ||
| 169 | + UserData: | ||
| 170 | + Fn::Base64: !Sub | | ||
| 171 | + #! /bin/bash -xe | ||
| 172 | + # update yum just in case | ||
| 173 | + yum update -y | ||
| 174 | + # get node into yum | ||
| 175 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 176 | + # install node and npm in one line | ||
| 177 | + yum install -y nodejs | ||
| 178 | + install pm2 to restart node app | ||
| 179 | + npm i -g pm2@2.4.3 | ||
| 180 | + AutoScalingGroup: | ||
| 181 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 182 | + Properties: | ||
| 183 | + HealthCheckType: ELB | ||
| 184 | + HealthCheckGracePeriod: 300 | ||
| 185 | + MinSize: | ||
| 186 | + Ref: MinSize | ||
| 187 | + MaxSize: | ||
| 188 | + Ref: MaxSize | ||
| 189 | + LaunchConfigurationName: | ||
| 190 | + Ref: WebappLaunchConfig | ||
| 191 | + VPCZoneIdentifier: | ||
| 192 | + Ref: WebappSubnets | ||
| 193 | + TargetGroupARNs: | ||
| 194 | + - Ref: ALBTargetGroup | ||
| 195 | + Tags: | ||
| 196 | + - Key: Name | ||
| 197 | + Value: webapp-example | ||
| 198 | + PropagateAtLaunch: true | ||
| 199 | + ALBListener: | ||
| 200 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 201 | + Properties: | ||
| 202 | + DefaultActions: | ||
| 203 | + - | ||
| 204 | + Type: forward | ||
| 205 | + TargetGroupArn: | ||
| 206 | + Ref: ALBTargetGroup | ||
| 207 | + LoadBalancerArn: | ||
| 208 | + Ref: LoadBalancer | ||
| 209 | + Port: 80 | ||
| 210 | + Protocol: HTTP | ||
| 211 | + LoadBalancer: | ||
| 212 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 213 | + Properties: | ||
| 214 | + Scheme: internet-facing | ||
| 215 | + Subnets: | ||
| 216 | + Ref: ALBSubnets | ||
| 217 | + SecurityGroups: | ||
| 218 | + - Ref: ALBSecurityGroup | ||
| 219 | + Tags: | ||
| 220 | + - Key: Name | ||
| 221 | + Value: | ||
| 222 | + !Join ["", [ Ref: NamePrefix, "-elb"] ] | ||
| 223 | + ALBTargetGroup: | ||
| 224 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 225 | + Properties: | ||
| 226 | + HealthCheckIntervalSeconds: 30 | ||
| 227 | + UnhealthyThresholdCount: 2 | ||
| 228 | + HealthyThresholdCount: 2 | ||
| 229 | + HealthCheckPath: / | ||
| 230 | + Port: 3000 | ||
| 231 | + Protocol: HTTP | ||
| 232 | + VpcId: | ||
| 233 | + Ref: VPC | ||
| 234 | +Outputs: | ||
| 235 | + WebappUrl: | ||
| 236 | + Description: Webapp URL | ||
| 237 | + Value: !GetAtt LoadBalancer.DNSName | ||
| 238 | + DeploymentGroup: | ||
| 239 | + Description: Webapp Deployment Group | ||
| 240 | + Value: !Ref WebappDeploymentGroup | ||
| 241 | + DeploymentBucket: | ||
| 242 | + Description: Deployment bucket | ||
| 243 | + Value: !Ref WebappDeploymentBucket | ||
| 244 | + ApplicationName: | ||
| 245 | + Description: CodeDeploy Application name | ||
| 246 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +Parameters: | ||
| 2 | + KeyName: | ||
| 3 | + Type: String | ||
| 4 | + Default: dd | ||
| 5 | + WebappSubnets: | ||
| 6 | + Type: CommaDelimitedList | ||
| 7 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 8 | + ALBSubnets: | ||
| 9 | + Type: CommaDelimitedList | ||
| 10 | + Default: subnet-c44697bf, subnet-e8756180, subnet-e87f07a4 | ||
| 11 | + MinSize: | ||
| 12 | + Type: Number | ||
| 13 | + Default: 2 | ||
| 14 | + MaxSize: | ||
| 15 | + Type: Number | ||
| 16 | + Default: 2 | ||
| 17 | + VPC: | ||
| 18 | + Type: String | ||
| 19 | + Default: vpc-aab1aac2 | ||
| 20 | + AMIID: | ||
| 21 | + Type: String | ||
| 22 | + Default: ami-04fe91441f494c8f4 | ||
| 23 | + NamePrefix: | ||
| 24 | + AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*' | ||
| 25 | + Default: bluegreen | ||
| 26 | + Description: Prefix for resource tags made by this template (2-15 chars). | ||
| 27 | + MaxLength: 15 | ||
| 28 | + MinLength: 2 | ||
| 29 | + Type: String | ||
| 30 | +Resources: | ||
| 31 | + WebappApplication: | ||
| 32 | + Type: "AWS::CodeDeploy::Application" | ||
| 33 | + Properties: | ||
| 34 | + ApplicationName: testApp | ||
| 35 | + WebappDeploymentGroup: | ||
| 36 | + Type: "AWS::CodeDeploy::DeploymentGroup" | ||
| 37 | + Properties: | ||
| 38 | + DeploymentGroupName: test-group | ||
| 39 | + ApplicationName: !Ref WebappApplication | ||
| 40 | + ServiceRoleArn: !GetAtt CodeDeployRole.Arn | ||
| 41 | + DeploymentConfigName: CodeDeployDefault.OneAtATime | ||
| 42 | + DeploymentStyle: | ||
| 43 | + DeploymentType: IN_PLACE | ||
| 44 | + DeploymentOption: WITH_TRAFFIC_CONTROL | ||
| 45 | + LoadBalancerInfo: | ||
| 46 | + TargetGroupInfoList: | ||
| 47 | + - Name: !Ref LoadBalancer | ||
| 48 | + AutoScalingGroups: | ||
| 49 | + - Ref: AutoScalingGroup | ||
| 50 | + ALBSecurityGroup: | ||
| 51 | + Type: AWS::EC2::SecurityGroup | ||
| 52 | + Properties: | ||
| 53 | + GroupDescription: allow access to ALB from internet | ||
| 54 | + VpcId: | ||
| 55 | + Ref: VPC | ||
| 56 | + SecurityGroupIngress: | ||
| 57 | + - IpProtocol: tcp | ||
| 58 | + FromPort: '80' | ||
| 59 | + ToPort: '80' | ||
| 60 | + CidrIp: 0.0.0.0/0 | ||
| 61 | + WebappSecurityGroup: | ||
| 62 | + Type: AWS::EC2::SecurityGroup | ||
| 63 | + Properties: | ||
| 64 | + GroupDescription: allow access to Webapp from ALB | ||
| 65 | + VpcId: | ||
| 66 | + Ref: VPC | ||
| 67 | + SecurityGroupIngress: | ||
| 68 | + - IpProtocol: tcp | ||
| 69 | + FromPort: '3000' | ||
| 70 | + ToPort: '3000' | ||
| 71 | + SourceSecurityGroupId: | ||
| 72 | + Ref: ALBSecurityGroup | ||
| 73 | + - IpProtocol: tcp | ||
| 74 | + FromPort: '22' | ||
| 75 | + ToPort: '22' | ||
| 76 | + CidrIp: 0.0.0.0/0 | ||
| 77 | + WebappDeploymentBucket: | ||
| 78 | + Type: "AWS::S3::Bucket" | ||
| 79 | + Properties: | ||
| 80 | + BucketName: 'testtest11324' | ||
| 81 | + CodeDeployRole: | ||
| 82 | + Type: "AWS::IAM::Role" | ||
| 83 | + Properties: | ||
| 84 | + AssumeRolePolicyDocument: | ||
| 85 | + Version: "2012-10-17" | ||
| 86 | + Statement: | ||
| 87 | + - | ||
| 88 | + Effect: "Allow" | ||
| 89 | + Principal: | ||
| 90 | + Service: | ||
| 91 | + - "codedeploy.amazonaws.com" | ||
| 92 | + Action: | ||
| 93 | + - "sts:AssumeRole" | ||
| 94 | + Policies: | ||
| 95 | + - | ||
| 96 | + PolicyName: allow-autoscaling | ||
| 97 | + PolicyDocument: | ||
| 98 | + Version: "2012-10-17" | ||
| 99 | + Statement: | ||
| 100 | + - | ||
| 101 | + Effect: Allow | ||
| 102 | + Action: | ||
| 103 | + - ec2:* | ||
| 104 | + - autoscaling:* | ||
| 105 | + Resource: "*" | ||
| 106 | + - | ||
| 107 | + PolicyName: allow-loadbalance | ||
| 108 | + PolicyDocument: | ||
| 109 | + Version: "2012-10-17" | ||
| 110 | + Statement: | ||
| 111 | + - | ||
| 112 | + Effect: Allow | ||
| 113 | + Action: | ||
| 114 | + - ec2:* | ||
| 115 | + - autoscaling:* | ||
| 116 | + Resource: "*" | ||
| 117 | + - | ||
| 118 | + Effect: Allow | ||
| 119 | + Action: | ||
| 120 | + - iam:CreateServiceLinkedRole | ||
| 121 | + Resource: "*" | ||
| 122 | + - | ||
| 123 | + Effect: Allow | ||
| 124 | + Action: | ||
| 125 | + - elasticloadbalancing:* | ||
| 126 | + Resource: "*" | ||
| 127 | + WebappRole: | ||
| 128 | + Type: "AWS::IAM::Role" | ||
| 129 | + Properties: | ||
| 130 | + AssumeRolePolicyDocument: | ||
| 131 | + Version: "2012-10-17" | ||
| 132 | + Statement: | ||
| 133 | + - | ||
| 134 | + Effect: "Allow" | ||
| 135 | + Principal: | ||
| 136 | + Service: | ||
| 137 | + - "ec2.amazonaws.com" | ||
| 138 | + - "codedeploy.amazonaws.com" | ||
| 139 | + Action: | ||
| 140 | + - "sts:AssumeRole" | ||
| 141 | + Policies: | ||
| 142 | + - | ||
| 143 | + PolicyName: "allow-webapp-deployment-bucket-bucket" | ||
| 144 | + PolicyDocument: | ||
| 145 | + Version: "2012-10-17" | ||
| 146 | + Statement: | ||
| 147 | + - | ||
| 148 | + Effect: "Allow" | ||
| 149 | + Action: "s3:getObject" | ||
| 150 | + Resource: !Sub arn:aws:s3:::${WebappDeploymentBucket}/* | ||
| 151 | + WebappInstanceProfile: | ||
| 152 | + Type: "AWS::IAM::InstanceProfile" | ||
| 153 | + Properties: | ||
| 154 | + Roles: | ||
| 155 | + - Ref: WebappRole | ||
| 156 | + WebappLaunchConfig: | ||
| 157 | + Type: AWS::AutoScaling::LaunchConfiguration | ||
| 158 | + Properties: | ||
| 159 | + AssociatePublicIpAddress: true | ||
| 160 | + ImageId: | ||
| 161 | + Ref: AMIID | ||
| 162 | + InstanceType: t2.micro | ||
| 163 | + KeyName: | ||
| 164 | + Ref: KeyName | ||
| 165 | + SecurityGroups: | ||
| 166 | + - Ref: WebappSecurityGroup | ||
| 167 | + IamInstanceProfile: | ||
| 168 | + Ref: WebappInstanceProfile | ||
| 169 | + UserData: | ||
| 170 | + Fn::Base64: !Sub | | ||
| 171 | + #! /bin/bash -xe | ||
| 172 | + # update yum just in case | ||
| 173 | + yum update -y | ||
| 174 | + # get node into yum | ||
| 175 | + curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - | ||
| 176 | + # install node and npm in one line | ||
| 177 | + yum install -y nodejs | ||
| 178 | + install pm2 to restart node app | ||
| 179 | + npm i -g pm2@2.4.3 | ||
| 180 | + AutoScalingGroup: | ||
| 181 | + Type: AWS::AutoScaling::AutoScalingGroup | ||
| 182 | + Properties: | ||
| 183 | + HealthCheckType: ELB | ||
| 184 | + HealthCheckGracePeriod: 300 | ||
| 185 | + MinSize: | ||
| 186 | + Ref: MinSize | ||
| 187 | + MaxSize: | ||
| 188 | + Ref: MaxSize | ||
| 189 | + LaunchConfigurationName: | ||
| 190 | + Ref: WebappLaunchConfig | ||
| 191 | + VPCZoneIdentifier: | ||
| 192 | + Ref: WebappSubnets | ||
| 193 | + TargetGroupARNs: | ||
| 194 | + - Ref: ALBTargetGroup | ||
| 195 | + Tags: | ||
| 196 | + - Key: Name | ||
| 197 | + Value: webapp-example | ||
| 198 | + PropagateAtLaunch: true | ||
| 199 | + ALBListener: | ||
| 200 | + Type: AWS::ElasticLoadBalancingV2::Listener | ||
| 201 | + Properties: | ||
| 202 | + DefaultActions: | ||
| 203 | + - | ||
| 204 | + Type: forward | ||
| 205 | + TargetGroupArn: | ||
| 206 | + Ref: ALBTargetGroup | ||
| 207 | + LoadBalancerArn: | ||
| 208 | + Ref: LoadBalancer | ||
| 209 | + Port: 80 | ||
| 210 | + Protocol: HTTP | ||
| 211 | + LoadBalancer: | ||
| 212 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer | ||
| 213 | + Properties: | ||
| 214 | + Scheme: internet-facing | ||
| 215 | + Subnets: | ||
| 216 | + Ref: ALBSubnets | ||
| 217 | + SecurityGroups: | ||
| 218 | + - Ref: ALBSecurityGroup | ||
| 219 | + Tags: | ||
| 220 | + - Key: Name | ||
| 221 | + Value: | ||
| 222 | + !Join ["", [ Ref: NamePrefix, "-elb"] ] | ||
| 223 | + ALBTargetGroup: | ||
| 224 | + Type: AWS::ElasticLoadBalancingV2::TargetGroup | ||
| 225 | + Properties: | ||
| 226 | + HealthCheckIntervalSeconds: 30 | ||
| 227 | + UnhealthyThresholdCount: 2 | ||
| 228 | + HealthyThresholdCount: 2 | ||
| 229 | + HealthCheckPath: / | ||
| 230 | + Port: 3000 | ||
| 231 | + Protocol: HTTP | ||
| 232 | + VpcId: | ||
| 233 | + Ref: VPC | ||
| 234 | +Outputs: | ||
| 235 | + WebappUrl: | ||
| 236 | + Description: Webapp URL | ||
| 237 | + Value: !GetAtt LoadBalancer.DNSName | ||
| 238 | + DeploymentGroup: | ||
| 239 | + Description: Webapp Deployment Group | ||
| 240 | + Value: !Ref WebappDeploymentGroup | ||
| 241 | + DeploymentBucket: | ||
| 242 | + Description: Deployment bucket | ||
| 243 | + Value: !Ref WebappDeploymentBucket | ||
| 244 | + ApplicationName: | ||
| 245 | + Description: CodeDeploy Application name | ||
| 246 | + Value: !Ref WebappApplication | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
infra_code/README.md
0 → 100644
This diff is collapsed. Click to expand it.
infra_code/awscli.conf
0 → 100644
This diff is collapsed. Click to expand it.
infra_code/code_deploy.yaml
0 → 100644
This diff is collapsed. Click to expand it.
infra_code/codedeploy_logs.conf
0 → 100644
This diff is collapsed. Click to expand it.
infra_code/config.json
0 → 100644
This diff is collapsed. Click to expand it.
infra_code/img/cloudformation.png
0 → 100644
139 KB
webapp @ 32362320
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment