Skip to content

Instantly share code, notes, and snippets.

@eulersson
Created February 19, 2019 23:59
Show Gist options
  • Save eulersson/994d8a3da0602f0ae373e3260f00a535 to your computer and use it in GitHub Desktop.
Save eulersson/994d8a3da0602f0ae373e3260f00a535 to your computer and use it in GitHub Desktop.
FargateContainerSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Access to Fargate containers.
VpcId: !Ref VPC
IngressFromPublicALBSecurityGroup:
Type: AWS::EC2::SecurityGroupIngress
Properties:
Description: Ingress from the public Application Load Balancer.
GroupId: !Ref FargateContainerSecurityGroup
IpProtocol: -1 # Means all protocols (TCD, UDP or any ICMP/ICMPv6 number).
SourceSecurityGroupId: !Ref PublicLoadBalancerSecurityGroup
IngressFromSelfSecurityGroup:
Type: AWS::EC2::SecurityGroupIngress
Properties:
Description: Ingress from other containers in the same security group.
GroupId: !Ref FargateContainerSecurityGroup
IpProtocol: -1
SourceSecurityGroupId: !Ref FargateContainerSecurityGroup
PublicLoadBalancerSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Access to the public facing load balancer.
VpcId: !Ref VPC
SecurityGroupIngress:
- CidrIp: 0.0.0.0/0 # Allows all IPs. Traffic from anywhere.
IpProtocol: -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment