Skip to content

Instantly share code, notes, and snippets.

@monkey-codes
Last active June 17, 2020 01:07
Show Gist options
  • Select an option

  • Save monkey-codes/2ad23361ee84d90ea6ee58b6c3429885 to your computer and use it in GitHub Desktop.

Select an option

Save monkey-codes/2ad23361ee84d90ea6ee58b6c3429885 to your computer and use it in GitHub Desktop.
Fargate cluster security group
Resources:
...
FargateContainerSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Access to the Fargate containers
VpcId: {'Fn::ImportValue': !Sub '${NetworkStackName}:VpcId'}
FargateSecurityGroupIngressFromPublicALB:
Type: AWS::EC2::SecurityGroupIngress
Properties:
Description: Ingress from the public ALB
GroupId: !Ref 'FargateContainerSecurityGroup'
IpProtocol: -1
SourceSecurityGroupId: {'Fn::ImportValue': !Sub '${ALBStackName}:ALBSecurityGroup'}
FargateSecurityGroupIngressFromSelf:
Type: AWS::EC2::SecurityGroupIngress
Properties:
Description: Ingress from other containers in the same security group
GroupId: !Ref 'FargateContainerSecurityGroup'
IpProtocol: -1
SourceSecurityGroupId: !Ref 'FargateContainerSecurityGroup'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment