alb+asg+policy

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "Reference Architecture to host WordPress on AWS - Creates Web (desired:0; min:0; max:1) Auto Scaling group",
    "Metadata": {
        "Authors": {
            "Description": "Darryl Osborne (darrylo@amazon.com)"
        },
        "License": {
            "Description": "Copyright 2018 Amazon.com, Inc. and its affiliates. All Rights Reserved. SPDX-License-Identifier: MIT-0"
        },
        "AWS::CloudFormation::Interface": {
            "ParameterGroups": [
                {
                    "Label": {
                        "default": "AWS Parameters"
                    },
                    "Parameters": [
                        "EC2KeyName",
                        "InstanceType",
                        "SecurityGroup",
						"AlbSecurityGroup",
                        "NumberOfSubnets",
                        "Subnet",
						"Vpc",
						"PolicyTargetValue"
                    ]
                }
            ],
            "ParameterLabels": {
                "SecurityGroup": {
                    "default": " Security Group"
                },
                "AlbSecurityGroup":{
					"default": "AlbSecurityGroup"
				},
				"InstanceType": {
                    "default": "Instance Type"
                },
                "EC2KeyName": {
                    "default": "Existing Key Pair"
                },
                "NumberOfSubnets": {
                    "default": "Number of subnets"
                },
                "Subnet": {
                    "default": "Subnets"
                },
				"Vpc": {
                    "default": "Vpc"
                },
				"PolicyTargetValue":{
					"default": "PolicyTargetValue"
				}
            }
        }
    },
    "Parameters": {
		"PolicyTargetValue":{
			"Type":"String"
		},
        "AlbSecurityGroup": {
            "Description": "Select the Public security group.",
            "Type": "AWS::EC2::SecurityGroup::Id"
        },
		 "SecurityGroup": {
            "Description": "Select the security group.",
            "Type": "AWS::EC2::SecurityGroup::Id"
        },
        "InstanceType": {
            "AllowedValues": [
                "t2.nano",
                "t2.micro",
                "t2.small",
                "t2.medium",
                "t2.large",
                "t2.xlarge",
                "t2.2xlarge",
                "m3.medium",
                "m3.large",
                "m3.xlarge",
                "m3.2xlarge",
                "m4.large",
                "m4.xlarge",
                "m4.2xlarge",
                "m4.4xlarge",
                "m4.10xlarge",
                "m4.16xlarge",
                "m5.large",
                "m5.xlarge",
                "m5.2xlarge",
                "m5.4xlarge",
                "m5.12xlarge",
                "m5.24xlarge",
                "c3.large",
                "c3.xlarge",
                "c3.2xlarge",
                "c3.4xlarge",
                "c3.8xlarge",
                "c4.large",
                "c4.xlarge",
                "c4.2xlarge",
                "c4.4xlarge",
                "c4.8xlarge",
                "c5.large",
                "c5.xlarge",
                "c5.2xlarge",
                "c5.4xlarge",
                "c5.9xlarge",
                "c5.18xlarge",
                "r3.large",
                "r3.xlarge",
                "r3.2xlarge",
                "r3.4xlarge",
                "r3.8xlarge",
                "r4.large",
                "r4.xlarge",
                "r4.2xlarge",
                "r4.4xlarge",
                "r4.8xlarge",
                "r4.16xlarge",
                "x1.16xlarge",
                "x1.32xlarge",
                "x1e.xlarge",
                "x1e.2xlarge",
                "x1e.4xlarge",
                "x1e.8xlarge",
                "x1e.16xlarge",
                "x1e.32xlarge",
                "d2.xlarge",
                "d2.2xlarge",
                "d2.4xlarge",
                "d2.8xlarge",
                "h1.2xlarge",
                "h1.4xlarge",
                "h1.8xlarge",
                "h1.16xlarge",
                "i2.xlarge",
                "i2.2xlarge",
                "i2.4xlarge",
                "i2.8xlarge",
                "i3.large",
                "i3.xlarge",
                "i3.2xlarge",
                "i3.4xlarge",
                "i3.8xlarge",
                "i3.16xlarge",
                "f1.2xlarge",
                "f1.16xlarge",
                "g2.2xlarge",
                "g2.8xlarge",
                "g3.4xlarge",
                "g3.8xlarge",
                "g3.16xlarge",
                "p2.xlarge",
                "p2.8xlarge",
                "p2.16xlarge",
                "p3.2xlarge",
                "p3.8xlarge",
                "p3.16xlarge"
            ],
            "ConstraintDescription": "Must be a valid Amazon EC2 instance type.",
            "Default": "t2.nano",
            "Description": " EC2 instance type.",
            "Type": "String"
        },
        "EC2KeyName": {
            "Description": "Name of an EC2 KeyPair. Your  instances will launch with this KeyPair.",
            "Type": "AWS::EC2::KeyPair::KeyName"
        },
        "NumberOfSubnets": {
            "AllowedValues": [
                2,
                3,
                4,
                5,
                6
            ],
            "Default": 3,
            "Description": "Number of subnets. This must match your selections in the list of subnets below.",
            "Type": "String"
        },
        "Subnet": {
            "Description": "Select existing subnets. The number selected must match the number of subnets above. Subnets selected must be in separate AZs.",
            "Type": "List<AWS::EC2::Subnet::Id>"
        },
		"Vpc": {
            "Type": "AWS::EC2::VPC::Id",
            "Description": "Select the VPC where the RDS database will be created",
            "ConstraintDescription": "must be an existing VPC"
        }
    },
    "Conditions": {
        "NumberOfSubnets1": {
            "Fn::Equals": [
                1,
                {
                    "Ref": "NumberOfSubnets"
                }
            ]
        },
        "NumberOfSubnets2": {
            "Fn::Equals": [
                2,
                {
                    "Ref": "NumberOfSubnets"
                }
            ]
        },
        "NumberOfSubnets3": {
            "Fn::Equals": [
                3,
                {
                    "Ref": "NumberOfSubnets"
                }
            ]
        },
        "NumberOfSubnets4": {
            "Fn::Equals": [
                4,
                {
                    "Ref": "NumberOfSubnets"
                }
            ]
        },
        "NumberOfSubnets5": {
            "Fn::Equals": [
                5,
                {
                    "Ref": "NumberOfSubnets"
                }
            ]
        },
        "NumberOfSubnets6": {
            "Fn::Equals": [
                6,
                {
                    "Ref": "NumberOfSubnets"
                }
            ]
        },
        "Subnet0": {
            "Fn::Or": [
                {
                    "Condition": "NumberOfSubnets1"
                },
                {
                    "Condition": "NumberOfSubnets2"
                },
                {
                    "Condition": "NumberOfSubnets3"
                },
                {
                    "Condition": "NumberOfSubnets4"
                },
                {
                    "Condition": "NumberOfSubnets5"
                },
                {
                    "Condition": "NumberOfSubnets6"
                }
            ]
        },
        "Subnet1": {
            "Fn::Or": [
                {
                    "Condition": "NumberOfSubnets2"
                },
                {
                    "Condition": "NumberOfSubnets3"
                },
                {
                    "Condition": "NumberOfSubnets4"
                },
                {
                    "Condition": "NumberOfSubnets5"
                },
                {
                    "Condition": "NumberOfSubnets6"
                }
            ]
        },
        "Subnet2": {
            "Fn::Or": [
                {
                    "Condition": "NumberOfSubnets3"
                },
                {
                    "Condition": "NumberOfSubnets4"
                },
                {
                    "Condition": "NumberOfSubnets5"
                },
                {
                    "Condition": "NumberOfSubnets6"
                }
            ]
        },
        "Subnet3": {
            "Fn::Or": [
                {
                    "Condition": "NumberOfSubnets4"
                },
                {
                    "Condition": "NumberOfSubnets5"
                },
                {
                    "Condition": "NumberOfSubnets6"
                }
            ]
        },
        "Subnet4": {
            "Fn::Or": [
                {
                    "Condition": "NumberOfSubnets5"
                },
                {
                    "Condition": "NumberOfSubnets6"
                }
            ]
        },
        "Subnet5": {
            "Condition": "NumberOfSubnets6"
        }
    },
    "Mappings": {
        "RegionMap": {
            "ap-northeast-1": {
                "AMI": "ami-da9e2cbc"
            },
            "ap-northeast-2": {
                "AMI": "ami-1196317f"
            },
            "ap-south-1": {
                "AMI": "ami-d5c18eba"
            },
            "ap-southeast-1": {
                "AMI": "ami-c63d6aa5"
            },
            "ap-southeast-2": {
                "AMI": "ami-ff4ea59d"
            },
            "ca-central-1": {
                "AMI": "ami-d29e25b6"
            },
            "eu-central-1": {
                "AMI": "ami-bf2ba8d0"
            },
            "eu-west-1": {
                "AMI": "ami-1a962263"
            },
            "eu-west-2": {
                "AMI": "ami-e7d6c983"
            },
            "sa-east-1": {
                "AMI": "ami-286f2a44"
            },
            "us-east-1": {
                "AMI": "ami-55ef662f"
            },
            "us-east-2": {
                "AMI": "ami-15e9c770"
            },
            "us-west-1": {
                "AMI": "ami-a51f27c5"
            },
            "us-west-2": {
                "AMI": "ami-bf4193c7"
            }
        }
    },
    "Resources": {
        "AutoScalingGroup": {
            "Type": "AWS::AutoScaling::AutoScalingGroup",
            "Properties": {
                "Cooldown": 60,
                "HealthCheckGracePeriod": 120,
                "HealthCheckType": "EC2",
                "LaunchConfigurationName": {
                    "Ref": "LaunchConfiguration"
                },
                "MaxSize": 4,
                "MinSize": 2,
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": {
                            "Fn::Join": [
                                "",
                                [
                                    " / ",
                                    {
                                        "Ref": "AWS::StackName"
                                    }
                                ]
                            ]
                        },
                        "PropagateAtLaunch": true
                    }
                ],
                "VPCZoneIdentifier": {
                    "Fn::If": [
                        "NumberOfSubnets1",
                        [
                            {
                                "Fn::Select": [
                                    0,
                                    {
                                        "Ref": "Subnet"
                                    }
                                ]
                            }
                        ],
                        {
                            "Fn::If": [
                                "NumberOfSubnets2",
                                [
                                    {
                                        "Fn::Select": [
                                            0,
                                            {
                                                "Ref": "Subnet"
                                            }
                                        ]
                                    },
                                    {
                                        "Fn::Select": [
                                            1,
                                            {
                                                "Ref": "Subnet"
                                            }
                                        ]
                                    }
                                ],
                                {
                                    "Fn::If": [
                                        "NumberOfSubnets3",
                                        [
                                            {
                                                "Fn::Select": [
                                                    0,
                                                    {
                                                        "Ref": "Subnet"
                                                    }
                                                ]
                                            },
                                            {
                                                "Fn::Select": [
                                                    1,
                                                    {
                                                        "Ref": "Subnet"
                                                    }
                                                ]
                                            },
                                            {
                                                "Fn::Select": [
                                                    2,
                                                    {
                                                        "Ref": "Subnet"
                                                    }
                                                ]
                                            }
                                        ],
                                        {
                                            "Fn::If": [
                                                "NumberOfSubnets4",
                                                [
                                                    {
                                                        "Fn::Select": [
                                                            0,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "Fn::Select": [
                                                            1,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "Fn::Select": [
                                                            2,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "Fn::Select": [
                                                            3,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    }
                                                ],
                                                {
                                                    "Fn::If": [
                                                        "NumberOfSubnets5",
                                                        [
                                                            {
                                                                "Fn::Select": [
                                                                    0,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    1,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    2,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    3,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    4,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            }
                                                        ],
                                                        [
                                                            {
                                                                "Fn::Select": [
                                                                    0,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    1,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    2,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    3,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    4,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    5,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            }
                                                        ]
                                                    ]
                                                }
                                            ]
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                },
				"TargetGroupARNs":[
					{
						"Ref":"AlbTargetGroup"
					}
				]
			}
        },
        "LaunchConfiguration": {
            "Type": "AWS::AutoScaling::LaunchConfiguration",
            "Properties": {
                "IamInstanceProfile": {
                    "Ref": "InstanceProfile"
                },
                "ImageId": {
                    "Fn::FindInMap": [
                        "RegionMap",
                        {
                            "Ref": "AWS::Region"
                        },
                        "AMI"
                    ]
                },
                "InstanceMonitoring": true,
                "InstanceType": {
                    "Ref": "InstanceType"
                },
                "KeyName": {
                    "Ref": "EC2KeyName"
                },
                "SecurityGroups": [
                    {
                        "Ref": "SecurityGroup"
                    }
                ],
				"UserData": {
                    "Fn::Base64": {
                        "Fn::Sub": "#!/bin/bash\nyum update -y aws-cfn-bootstrap\n/opt/aws/bin/cfn-init -s ${AWS::StackName} -r ServerConfig --region ${AWS::Region}\n\n/opt/aws/bin/cfn-hup || error_exit 'Failed to start cfn-hup'\n\n/opt/aws/bin/cfn-signal --exit-code $? --stack ${AWS::StackName} --resource ServerConfig --region ${AWS::Region}\necho 'abc@123' | passwd --stdin root\nsed -i 's|[#]*PasswordAuthentication no|PasswordAuthentication yes|g' /etc/ssh/sshd_config\nsed -i 's|PermitRootLogin forced-commands-only|PermitRootLogin yes|g' /etc/ssh/sshd_config\nservice sshd restart\nsystemctl restart sshd"
                    }
                }
			}
        },       
		"ASGScaleOutPolicy":{
			"Type":"AWS::AutoScaling::ScalingPolicy",
			"Properties":{
			  "AdjustmentType":"ChangeInCapacity",
			  "AutoScalingGroupName":{
				"Ref":"AutoScalingGroup"
			  },
			  "PolicyType":"StepScaling",
			  "MetricAggregationType":"Average",
			  "EstimatedInstanceWarmup":"60",
			  "StepAdjustments":[
				{
				"MetricIntervalUpperBound":"50",
				  "MetricIntervalLowerBound":"10",
				  "ScalingAdjustment":"-1"
				},
				{
				   "MetricIntervalLowerBound":"50",
				  "ScalingAdjustment":"1"
				}
			  ]
			}
		  },
		"CPUAlarmHigh": {
		   "Type": "AWS::CloudWatch::Alarm",
		   "Properties": {
			  "AlarmName":"cpu",
			  "EvaluationPeriods": "1",
			  "Statistic": "Average",
			  "Threshold": "10",
			  "AlarmDescription": "Alarm if CPU too high or metric disappears indicating instance is down",
			  "Period": "60",
			  "AlarmActions": [ { "Ref": "ASGScaleOutPolicy" } ],
			  "Namespace": "AWS/EC2",
			  "Dimensions": [ {
				 "Name": "AutoScalingGroupName",
				 "Value": { "Ref": "AutoScalingGroup" }
			  } ],
			  "ComparisonOperator": "GreaterThanThreshold",
			  "MetricName": "CPUUtilization"
		   }
		},
		"InstanceProfile": {
            "Type": "AWS::IAM::InstanceProfile",
            "Properties": {
                "Path": "/",
                "Roles": [
                    {
                        "Ref": "InstanceRole"
                    }
                ]
            }
        },
        "InstanceRole": {
            "Type": "AWS::IAM::Role",
            "Properties": {
                "AssumeRolePolicyDocument": {
                    "Version": "2012-10-17",
                    "Statement": [
                        {
                            "Effect": "Allow",
                            "Principal": {
                                "Service": [
                                    "ec2.amazonaws.com"
                                ]
                            },
                            "Action": [
                                "sts:AssumeRole"
                            ]
                        }
                    ]
                },
                "Path": "/",
                "Policies": [
                    {
                        "PolicyName": "logs",
                        "PolicyDocument": {
                            "Version": "2012-10-17",
                            "Statement": [
                                {
                                    "Effect": "Allow",
                                    "Action": [
                                        "logs:CreateLogGroup",
                                        "logs:CreateLogStream",
                                        "logs:PutLogEvents",
                                        "logs:DescribeLogStreams"
                                    ],
                                    "Resource": [
                                        "arn:aws:logs:*:*:*"
                                    ]
                                }
                            ]
                        }
                    }
                ]
            }
        },
		"licationLoadBalancer": {
            "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer",
            "Properties": {
                "Scheme": "internet-facing",
                "Subnets": {
                    "Fn::If": [
                        "NumberOfSubnets1",
                        [
                            {
                                "Fn::Select": [
                                    0,
                                    {
                                        "Ref": "Subnet"
                                    }
                                ]
                            }
                        ],
                        {
                            "Fn::If": [
                                "NumberOfSubnets2",
                                [
                                    {
                                        "Fn::Select": [
                                            0,
                                            {
                                                "Ref": "Subnet"
                                            }
                                        ]
                                    },
                                    {
                                        "Fn::Select": [
                                            1,
                                            {
                                                "Ref": "Subnet"
                                            }
                                        ]
                                    }
                                ],
                                {
                                    "Fn::If": [
                                        "NumberOfSubnets3",
                                        [
                                            {
                                                "Fn::Select": [
                                                    0,
                                                    {
                                                        "Ref": "Subnet"
                                                    }
                                                ]
                                            },
                                            {
                                                "Fn::Select": [
                                                    1,
                                                    {
                                                        "Ref": "Subnet"
                                                    }
                                                ]
                                            },
                                            {
                                                "Fn::Select": [
                                                    2,
                                                    {
                                                        "Ref": "Subnet"
                                                    }
                                                ]
                                            }
                                        ],
                                        {
                                            "Fn::If": [
                                                "NumberOfSubnets4",
                                                [
                                                    {
                                                        "Fn::Select": [
                                                            0,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "Fn::Select": [
                                                            1,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "Fn::Select": [
                                                            2,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "Fn::Select": [
                                                            3,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    }
                                                ],
                                                {
                                                    "Fn::If": [
                                                        "NumberOfSubnets5",
                                                        [
                                                            {
                                                                "Fn::Select": [
                                                                    0,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    1,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    2,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    3,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    4,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            }
                                                        ],
                                                        [
                                                            {
                                                                "Fn::Select": [
                                                                    0,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    1,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    2,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    3,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    4,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    5,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            }
                                                        ]
                                                    ]
                                                }
                                            ]
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                },
                "LoadBalancerAttributes": [
                    {
                        "Key": "idle_timeout.timeout_seconds",
                        "Value": 60
                    }
                ],
                "SecurityGroups": [
                    {
                        "Ref": "AlbSecurityGroup"
                    }
                ],
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": {
                            "Fn::Join": [
                                "",
                                [
                                    "Public ALB / ",
                                    {
                                        "Ref": "AWS::StackName"
                                    }
                                ]
                            ]
                        }
                    }
                ]
            }
        },
        "AlbTargetGroup": {
            "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
            "Properties": {
                "HealthCheckIntervalSeconds": 30,
			
                "HealthCheckTimeoutSeconds": 5,
				"HealthyThresholdCount":"2",
                "Port": 80,
                "Protocol": "HTTP",
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": {
                            "Fn::Join": [
                                "",
                                [
                                    "Public ALB / ",
                                    {
                                        "Ref": "AWS::StackName"
                                    }
                                ]
                            ]
                        }
                    }
                ],
                "UnhealthyThresholdCount": 5,
                "VpcId": {
                    "Ref": "Vpc"
                }
            }
        },
		"LoadBalancerListener": {
            "Type": "AWS::ElasticLoadBalancingV2::Listener",
            "Properties": {
                "LoadBalancerArn": {
                    "Ref": "licationLoadBalancer"
                },
                "Port": 80,
                "Protocol": "HTTP",
                "DefaultActions": [
                    {
                        "Type": "forward",
                        "TargetGroupArn": {
                            "Ref": "AlbTargetGroup"
                        }
                    }
                ]
            }
        }
    
	}
}

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "Reference Architecture to host WordPress on AWS - Creates Web (desired:0; min:0; max:1) Auto Scaling group",
    "Metadata": {
        "Authors": {
            "Description": "Darryl Osborne (darrylo@amazon.com)"
        },
        "License": {
            "Description": "Copyright 2018 Amazon.com, Inc. and its affiliates. All Rights Reserved. SPDX-License-Identifier: MIT-0"
        },
        "AWS::CloudFormation::Interface": {
            "ParameterGroups": [
                {
                    "Label": {
                        "default": "AWS Parameters"
                    },
                    "Parameters": [
                        "EC2KeyName",
                        "InstanceType",
                        "SecurityGroup",
						"AlbSecurityGroup",
                        "NumberOfSubnets",
                        "Subnet",
						"Vpc",
						"PolicyTargetValue"
                    ]
                }
            ],
            "ParameterLabels": {
                "SecurityGroup": {
                    "default": " Security Group"
                },
                "AlbSecurityGroup":{
					"default": "AlbSecurityGroup"
				},
				"InstanceType": {
                    "default": "Instance Type"
                },
                "EC2KeyName": {
                    "default": "Existing Key Pair"
                },
                "NumberOfSubnets": {
                    "default": "Number of subnets"
                },
                "Subnet": {
                    "default": "Subnets"
                },
				"Vpc": {
                    "default": "Vpc"
                },
				"PolicyTargetValue":{
					"default": "PolicyTargetValue"
				}
            }
        }
    },
    "Parameters": {
		"PolicyTargetValue":{
			"Type":"String"
		},
        "AlbSecurityGroup": {
            "Description": "Select the Public security group.",
            "Type": "AWS::EC2::SecurityGroup::Id"
        },
		 "SecurityGroup": {
            "Description": "Select the security group.",
            "Type": "AWS::EC2::SecurityGroup::Id"
        },
        "InstanceType": {
            "AllowedValues": [
                "t2.nano",
                "t2.micro",
                "t2.small",
                "t2.medium",
                "t2.large",
                "t2.xlarge",
                "t2.2xlarge",
                "m3.medium",
                "m3.large",
                "m3.xlarge",
                "m3.2xlarge",
                "m4.large",
                "m4.xlarge",
                "m4.2xlarge",
                "m4.4xlarge",
                "m4.10xlarge",
                "m4.16xlarge",
                "m5.large",
                "m5.xlarge",
                "m5.2xlarge",
                "m5.4xlarge",
                "m5.12xlarge",
                "m5.24xlarge",
                "c3.large",
                "c3.xlarge",
                "c3.2xlarge",
                "c3.4xlarge",
                "c3.8xlarge",
                "c4.large",
                "c4.xlarge",
                "c4.2xlarge",
                "c4.4xlarge",
                "c4.8xlarge",
                "c5.large",
                "c5.xlarge",
                "c5.2xlarge",
                "c5.4xlarge",
                "c5.9xlarge",
                "c5.18xlarge",
                "r3.large",
                "r3.xlarge",
                "r3.2xlarge",
                "r3.4xlarge",
                "r3.8xlarge",
                "r4.large",
                "r4.xlarge",
                "r4.2xlarge",
                "r4.4xlarge",
                "r4.8xlarge",
                "r4.16xlarge",
                "x1.16xlarge",
                "x1.32xlarge",
                "x1e.xlarge",
                "x1e.2xlarge",
                "x1e.4xlarge",
                "x1e.8xlarge",
                "x1e.16xlarge",
                "x1e.32xlarge",
                "d2.xlarge",
                "d2.2xlarge",
                "d2.4xlarge",
                "d2.8xlarge",
                "h1.2xlarge",
                "h1.4xlarge",
                "h1.8xlarge",
                "h1.16xlarge",
                "i2.xlarge",
                "i2.2xlarge",
                "i2.4xlarge",
                "i2.8xlarge",
                "i3.large",
                "i3.xlarge",
                "i3.2xlarge",
                "i3.4xlarge",
                "i3.8xlarge",
                "i3.16xlarge",
                "f1.2xlarge",
                "f1.16xlarge",
                "g2.2xlarge",
                "g2.8xlarge",
                "g3.4xlarge",
                "g3.8xlarge",
                "g3.16xlarge",
                "p2.xlarge",
                "p2.8xlarge",
                "p2.16xlarge",
                "p3.2xlarge",
                "p3.8xlarge",
                "p3.16xlarge"
            ],
            "ConstraintDescription": "Must be a valid Amazon EC2 instance type.",
            "Default": "t2.nano",
            "Description": " EC2 instance type.",
            "Type": "String"
        },
        "EC2KeyName": {
            "Description": "Name of an EC2 KeyPair. Your  instances will launch with this KeyPair.",
            "Type": "AWS::EC2::KeyPair::KeyName"
        },
        "NumberOfSubnets": {
            "AllowedValues": [
                2,
                3,
                4,
                5,
                6
            ],
            "Default": 3,
            "Description": "Number of subnets. This must match your selections in the list of subnets below.",
            "Type": "String"
        },
        "Subnet": {
            "Description": "Select existing subnets. The number selected must match the number of subnets above. Subnets selected must be in separate AZs.",
            "Type": "List<AWS::EC2::Subnet::Id>"
        },
		"Vpc": {
            "Description": "Select existing subnets. The number selected must match the number of subnets above. Subnets selected must be in separate AZs.",
            "Type": "String"
        }
    },
    "Conditions": {
        "NumberOfSubnets1": {
            "Fn::Equals": [
                1,
                {
                    "Ref": "NumberOfSubnets"
                }
            ]
        },
        "NumberOfSubnets2": {
            "Fn::Equals": [
                2,
                {
                    "Ref": "NumberOfSubnets"
                }
            ]
        },
        "NumberOfSubnets3": {
            "Fn::Equals": [
                3,
                {
                    "Ref": "NumberOfSubnets"
                }
            ]
        },
        "NumberOfSubnets4": {
            "Fn::Equals": [
                4,
                {
                    "Ref": "NumberOfSubnets"
                }
            ]
        },
        "NumberOfSubnets5": {
            "Fn::Equals": [
                5,
                {
                    "Ref": "NumberOfSubnets"
                }
            ]
        },
        "NumberOfSubnets6": {
            "Fn::Equals": [
                6,
                {
                    "Ref": "NumberOfSubnets"
                }
            ]
        },
        "Subnet0": {
            "Fn::Or": [
                {
                    "Condition": "NumberOfSubnets1"
                },
                {
                    "Condition": "NumberOfSubnets2"
                },
                {
                    "Condition": "NumberOfSubnets3"
                },
                {
                    "Condition": "NumberOfSubnets4"
                },
                {
                    "Condition": "NumberOfSubnets5"
                },
                {
                    "Condition": "NumberOfSubnets6"
                }
            ]
        },
        "Subnet1": {
            "Fn::Or": [
                {
                    "Condition": "NumberOfSubnets2"
                },
                {
                    "Condition": "NumberOfSubnets3"
                },
                {
                    "Condition": "NumberOfSubnets4"
                },
                {
                    "Condition": "NumberOfSubnets5"
                },
                {
                    "Condition": "NumberOfSubnets6"
                }
            ]
        },
        "Subnet2": {
            "Fn::Or": [
                {
                    "Condition": "NumberOfSubnets3"
                },
                {
                    "Condition": "NumberOfSubnets4"
                },
                {
                    "Condition": "NumberOfSubnets5"
                },
                {
                    "Condition": "NumberOfSubnets6"
                }
            ]
        },
        "Subnet3": {
            "Fn::Or": [
                {
                    "Condition": "NumberOfSubnets4"
                },
                {
                    "Condition": "NumberOfSubnets5"
                },
                {
                    "Condition": "NumberOfSubnets6"
                }
            ]
        },
        "Subnet4": {
            "Fn::Or": [
                {
                    "Condition": "NumberOfSubnets5"
                },
                {
                    "Condition": "NumberOfSubnets6"
                }
            ]
        },
        "Subnet5": {
            "Condition": "NumberOfSubnets6"
        }
    },
    "Mappings": {
        "RegionMap": {
            "ap-northeast-1": {
                "AMI": "ami-da9e2cbc"
            },
            "ap-northeast-2": {
                "AMI": "ami-1196317f"
            },
            "ap-south-1": {
                "AMI": "ami-d5c18eba"
            },
            "ap-southeast-1": {
                "AMI": "ami-c63d6aa5"
            },
            "ap-southeast-2": {
                "AMI": "ami-ff4ea59d"
            },
            "ca-central-1": {
                "AMI": "ami-d29e25b6"
            },
            "eu-central-1": {
                "AMI": "ami-bf2ba8d0"
            },
            "eu-west-1": {
                "AMI": "ami-1a962263"
            },
            "eu-west-2": {
                "AMI": "ami-e7d6c983"
            },
            "sa-east-1": {
                "AMI": "ami-286f2a44"
            },
            "us-east-1": {
                "AMI": "ami-55ef662f"
            },
            "us-east-2": {
                "AMI": "ami-15e9c770"
            },
            "us-west-1": {
                "AMI": "ami-a51f27c5"
            },
            "us-west-2": {
                "AMI": "ami-bf4193c7"
            }
        }
    },
    "Resources": {
        "AutoScalingGroup": {
            "Type": "AWS::AutoScaling::AutoScalingGroup",
            "Properties": {
                "Cooldown": 60,
                "HealthCheckGracePeriod": 120,
                "HealthCheckType": "EC2",
                "LaunchConfigurationName": {
                    "Ref": "LaunchConfiguration"
                },
				"TargetGroupARNs": [
                    {
                        "Ref": "AlbTargetGroup"
                    }
                ],
                "MaxSize": 4,
                "MinSize": 2,
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": {
                            "Fn::Join": [
                                "",
                                [
                                    " / ",
                                    {
                                        "Ref": "AWS::StackName"
                                    }
                                ]
                            ]
                        },
                        "PropagateAtLaunch": true
                    }
                ],
                "VPCZoneIdentifier": {
                    "Fn::If": [
                        "NumberOfSubnets1",
                        [
                            {
                                "Fn::Select": [
                                    0,
                                    {
                                        "Ref": "Subnet"
                                    }
                                ]
                            }
                        ],
                        {
                            "Fn::If": [
                                "NumberOfSubnets2",
                                [
                                    {
                                        "Fn::Select": [
                                            0,
                                            {
                                                "Ref": "Subnet"
                                            }
                                        ]
                                    },
                                    {
                                        "Fn::Select": [
                                            1,
                                            {
                                                "Ref": "Subnet"
                                            }
                                        ]
                                    }
                                ],
                                {
                                    "Fn::If": [
                                        "NumberOfSubnets3",
                                        [
                                            {
                                                "Fn::Select": [
                                                    0,
                                                    {
                                                        "Ref": "Subnet"
                                                    }
                                                ]
                                            },
                                            {
                                                "Fn::Select": [
                                                    1,
                                                    {
                                                        "Ref": "Subnet"
                                                    }
                                                ]
                                            },
                                            {
                                                "Fn::Select": [
                                                    2,
                                                    {
                                                        "Ref": "Subnet"
                                                    }
                                                ]
                                            }
                                        ],
                                        {
                                            "Fn::If": [
                                                "NumberOfSubnets4",
                                                [
                                                    {
                                                        "Fn::Select": [
                                                            0,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "Fn::Select": [
                                                            1,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "Fn::Select": [
                                                            2,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "Fn::Select": [
                                                            3,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    }
                                                ],
                                                {
                                                    "Fn::If": [
                                                        "NumberOfSubnets5",
                                                        [
                                                            {
                                                                "Fn::Select": [
                                                                    0,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    1,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    2,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    3,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    4,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            }
                                                        ],
                                                        [
                                                            {
                                                                "Fn::Select": [
                                                                    0,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    1,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    2,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    3,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    4,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    5,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            }
                                                        ]
                                                    ]
                                                }
                                            ]
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            }
        },
        "LaunchConfiguration": {
            "Type": "AWS::AutoScaling::LaunchConfiguration",
            "Properties": {
                "IamInstanceProfile": {
                    "Ref": "InstanceProfile"
                },
                "ImageId": {
                    "Fn::FindInMap": [
                        "RegionMap",
                        {
                            "Ref": "AWS::Region"
                        },
                        "AMI"
                    ]
                },
                "InstanceMonitoring": true,
                "InstanceType": {
                    "Ref": "InstanceType"
                },
                "KeyName": {
                    "Ref": "EC2KeyName"
                },
                "SecurityGroups": [
                    {
                        "Ref": "SecurityGroup"
                    }
                ],
				"UserData": {
                    "Fn::Base64": {
                        "Fn::Sub": "#!/bin/bash\nyum update -y aws-cfn-bootstrap\n/opt/aws/bin/cfn-init -s ${AWS::StackName} -r ServerConfig --region ${AWS::Region}\n\n/opt/aws/bin/cfn-hup || error_exit 'Failed to start cfn-hup'\n\n/opt/aws/bin/cfn-signal --exit-code $? --stack ${AWS::StackName} --resource ServerConfig --region ${AWS::Region}\necho 'abc@123' | passwd --stdin root\nsed -i 's|[#]*PasswordAuthentication no|PasswordAuthentication yes|g' /etc/ssh/sshd_config\nsed -i 's|PermitRootLogin forced-commands-only|PermitRootLogin yes|g' /etc/ssh/sshd_config\nservice sshd restart\nsystemctl restart sshd"
                    }
                }
			}
        },       
		"ASGScaleOutPolicy":{
			"Type":"AWS::AutoScaling::ScalingPolicy",
			"Properties":{
			  "AdjustmentType":"ChangeInCapacity",
			  "AutoScalingGroupName":{
				"Ref":"AutoScalingGroup"
			  },
			  "PolicyType":"StepScaling",
			  "MetricAggregationType":"Average",
			  "EstimatedInstanceWarmup":"60",
			  "StepAdjustments":[
				{
				  "MetricIntervalLowerBound":"10",
				  "MetricIntervalUpperBound":"50",
				  "ScalingAdjustment":"-1"
				},
				{
				   "MetricIntervalLowerBound":"50",
				  "ScalingAdjustment":"1"
				}
			  ]
			}
		  },
		"ASGScalePutPolicy":{
			"Type":"AWS::AutoScaling::ScalingPolicy",
			"Properties":{
			  "AdjustmentType":"ChangeInCapacity",
			  "AutoScalingGroupName":{
				"Ref":"AutoScalingGroup"
			  },
			  "PolicyType":"StepScaling",
			  "MetricAggregationType":"Average",
			  "EstimatedInstanceWarmup":"60",
			  "StepAdjustments":[
				{
				  "MetricIntervalUpperBound":"10",
				  "ScalingAdjustment":"-1"
				},
				{
				  "MetricIntervalLowerBound":"10",
				  "ScalingAdjustment":"-1"
				}
			  ]
			}
		  },
		"CPUAlarmHigh": {
		   "Type": "AWS::CloudWatch::Alarm",
		   "Properties": {
			  "AlarmName":"cpuhigh",
			  "EvaluationPeriods": "1",
			  "Statistic": "Average",
			  "Threshold": "10",
			  "AlarmDescription": "Alarm if CPU too high or metric disappears indicating instance is down",
			  "Period": "60",
			  "AlarmActions": [ { "Ref": "ASGScaleOutPolicy" } ],
			  "Namespace": "AWS/EC2",
			  "Dimensions": [ {
				 "Name": "AutoScalingGroupName",
				 "Value": { "Ref": "AutoScalingGroup" }
			  } ],
			  "ComparisonOperator": "GreaterThanThreshold",
			  "MetricName": "CPUUtilization"
		   }
		},
		"CPUAlarmLow": {
		   "Type": "AWS::CloudWatch::Alarm",
		   "Properties": {
			  "AlarmName":"cpulow",
			  "EvaluationPeriods": "1",
			  "Statistic": "Average",
			  "Threshold": "10",
			  "AlarmDescription": "Alarm if CPU too high or metric disappears indicating instance is down",
			  "Period": "60",
			  "AlarmActions": [ { "Ref": "ASGScalePutPolicy" } ],
			  "Namespace": "AWS/EC2",
			  "Dimensions": [ {
				 "Name": "AutoScalingGroupName",
				 "Value": { "Ref": "AutoScalingGroup" }
			  } ],
			  "ComparisonOperator": "LessThanOrEqualToThreshold",
			  "MetricName": "CPUUtilization"
		   }
		},
		
		"InstanceProfile": {
            "Type": "AWS::IAM::InstanceProfile",
            "Properties": {
                "Path": "/",
                "Roles": [
                    {
                        "Ref": "InstanceRole"
                    }
                ]
            }
        },
        "InstanceRole": {
            "Type": "AWS::IAM::Role",
            "Properties": {
                "AssumeRolePolicyDocument": {
                    "Version": "2012-10-17",
                    "Statement": [
                        {
                            "Effect": "Allow",
                            "Principal": {
                                "Service": [
                                    "ec2.amazonaws.com"
                                ]
                            },
                            "Action": [
                                "sts:AssumeRole"
                            ]
                        }
                    ]
                },
                "Path": "/",
                "Policies": [
                    {
                        "PolicyName": "logs",
                        "PolicyDocument": {
                            "Version": "2012-10-17",
                            "Statement": [
                                {
                                    "Effect": "Allow",
                                    "Action": [
                                        "logs:CreateLogGroup",
                                        "logs:CreateLogStream",
                                        "logs:PutLogEvents",
                                        "logs:DescribeLogStreams"
                                    ],
                                    "Resource": [
                                        "arn:aws:logs:*:*:*"
                                    ]
                                }
                            ]
                        }
                    }
                ]
            }
        },
		"licationLoadBalancer": {
            "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer",
            "Properties": {
                "Scheme": "internet-facing",
                "Subnets": {
                    "Fn::If": [
                        "NumberOfSubnets1",
                        [
                            {
                                "Fn::Select": [
                                    0,
                                    {
                                        "Ref": "Subnet"
                                    }
                                ]
                            }
                        ],
                        {
                            "Fn::If": [
                                "NumberOfSubnets2",
                                [
                                    {
                                        "Fn::Select": [
                                            0,
                                            {
                                                "Ref": "Subnet"
                                            }
                                        ]
                                    },
                                    {
                                        "Fn::Select": [
                                            1,
                                            {
                                                "Ref": "Subnet"
                                            }
                                        ]
                                    }
                                ],
                                {
                                    "Fn::If": [
                                        "NumberOfSubnets3",
                                        [
                                            {
                                                "Fn::Select": [
                                                    0,
                                                    {
                                                        "Ref": "Subnet"
                                                    }
                                                ]
                                            },
                                            {
                                                "Fn::Select": [
                                                    1,
                                                    {
                                                        "Ref": "Subnet"
                                                    }
                                                ]
                                            },
                                            {
                                                "Fn::Select": [
                                                    2,
                                                    {
                                                        "Ref": "Subnet"
                                                    }
                                                ]
                                            }
                                        ],
                                        {
                                            "Fn::If": [
                                                "NumberOfSubnets4",
                                                [
                                                    {
                                                        "Fn::Select": [
                                                            0,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "Fn::Select": [
                                                            1,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "Fn::Select": [
                                                            2,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "Fn::Select": [
                                                            3,
                                                            {
                                                                "Ref": "Subnet"
                                                            }
                                                        ]
                                                    }
                                                ],
                                                {
                                                    "Fn::If": [
                                                        "NumberOfSubnets5",
                                                        [
                                                            {
                                                                "Fn::Select": [
                                                                    0,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    1,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    2,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    3,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    4,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            }
                                                        ],
                                                        [
                                                            {
                                                                "Fn::Select": [
                                                                    0,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    1,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    2,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    3,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    4,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            },
                                                            {
                                                                "Fn::Select": [
                                                                    5,
                                                                    {
                                                                        "Ref": "Subnet"
                                                                    }
                                                                ]
                                                            }
                                                        ]
                                                    ]
                                                }
                                            ]
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                },
                "LoadBalancerAttributes": [
                    {
                        "Key": "idle_timeout.timeout_seconds",
                        "Value": 60
                    }
                ],
                "SecurityGroups": [
                    {
                        "Ref": "AlbSecurityGroup"
                    }
                ],
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": {
                            "Fn::Join": [
                                "",
                                [
                                    "Public ALB / ",
                                    {
                                        "Ref": "AWS::StackName"
                                    }
                                ]
                            ]
                        }
                    }
                ]
            }
        },
        "AlbTargetGroup": {
            "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
            "Properties": {
                "HealthCheckIntervalSeconds": 10,
			
                "HealthCheckTimeoutSeconds": 5,
				"HealthyThresholdCount":"2",
                "Port": 80,
                "Protocol": "HTTP",
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": {
                            "Fn::Join": [
                                "",
                                [
                                    "Public ALB / ",
                                    {
                                        "Ref": "AWS::StackName"
                                    }
                                ]
                            ]
                        }
                    }
                ],
                "UnhealthyThresholdCount": 5,
                "VpcId": {
                    "Ref": "Vpc"
                }
            }
        },
		"LoadBalancerListener": {
            "Type": "AWS::ElasticLoadBalancingV2::Listener",
            "Properties": {
                "LoadBalancerArn": {
                    "Ref": "licationLoadBalancer"
                },
                "Port": 80,
                "Protocol": "HTTP",
                "DefaultActions": [
                    {
                        "Type": "forward",
                        "TargetGroupArn": {
                            "Ref": "AlbTargetGroup"
                        }
                    }
                ]
            }
        }
    
	}
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值