Skip to content

Instantly share code, notes, and snippets.

@williamhub
williamhub / ec2-instance.yml
Created May 14, 2019 14:31
ec2 instance security group cloudformation example template
InstanceSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Allow traffic from the security group assigned to the load balancer
VpcId: !Ref Vpc
SecurityGroupIngress:
- SourceSecurityGroupId: !Ref PublicLoadBalancerSG
IpProtocol: -1
@williamhub
williamhub / load-balancer.yml
Last active May 16, 2019 12:35
load balancer cloudformation sample template
PrivateLoadBalancerSG:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Access to the private facing load balancer
VpcId: !Ref Vpc
SecurityGroupIngress:
- SourceSecurityGroupId: !Ref 'PublicEC2InstanceSecurityGroup' # only accept traffic from public accessible instances in the security group
IpProtocol: -1
SecurityGroupEgress:
- CidrIp: 0.0.0.0/0