Skip to content

Instantly share code, notes, and snippets.

@sk-t3ch
Created May 5, 2020 18:58
Show Gist options
  • Save sk-t3ch/f04f2d610aa198f6caf41363d29b24eb to your computer and use it in GitHub Desktop.
Save sk-t3ch/f04f2d610aa198f6caf41363d29b24eb to your computer and use it in GitHub Desktop.
Hello World API CloudFormation - Application Load Balancer
LoadBalancerSecGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Load balance allow port 80 traffic
VpcId: !ImportValue VPCID
SecurityGroupIngress:
CidrIp: 0.0.0.0/0
FromPort: 80
IpProtocol: TCP
ToPort: 80
LoadBalancer:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Properties:
SecurityGroups:
- !Ref LoadBalancerSecGroup
Subnets:
- !ImportValue PublicSubnetA
- !ImportValue PublicSubnetB
LoadBalancerListener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
Protocol: HTTP
LoadBalancerArn: !Ref LoadBalancer
DefaultActions:
- Type: forward
TargetGroupArn: !Ref LoadBalancerTargetGroup
Port: 80
LoadBalancerTargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
TargetType: lambda
Targets:
- AvailabilityZone: all
Id: !GetAtt Lambda.Arn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment