Skip to content

Instantly share code, notes, and snippets.

@AndrewBestbier
Created March 5, 2020 13:53
Show Gist options
  • Save AndrewBestbier/7d54db3c39901cb4f35f5d9053a11ec4 to your computer and use it in GitHub Desktop.
Save AndrewBestbier/7d54db3c39901cb4f35f5d9053a11ec4 to your computer and use it in GitHub Desktop.
ApplicationLoadBalancerSecurityGroup:
Type: AWS::EC2::SecurityGroup # (4)
Properties:
GroupDescription: SSH and HTTP
VpcId: !Ref VPC
SecurityGroupIngress: # (5)
- CidrIp: 0.0.0.0/0
FromPort: 80
IpProtocol: tcp
ToPort: 80
Listener:
Type: AWS::ElasticLoadBalancingV2::Listener # (6)
Properties:
DefaultActions:
- Type: forward
TargetGroupArn: !Ref TargetGroup # (7)
LoadBalancerArn: !Ref ApplicationLoadBalancer
Port: 80
Protocol: HTTP
TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup # (8)
Properties:
Port: 80
Protocol: HTTP
VpcId: !Ref VPC
AutoScalingGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
LaunchConfigurationName: !Ref AppLaunchConfig
VPCZoneIdentifier:
- !Ref PublicSubnetA
- !Ref PublicSubnetB
DesiredCapacity: 3
MinSize: 3
MaxSize: 3
TargetGroupARNs:
- !Ref TargetGroup # (9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment