Skip to content

Instantly share code, notes, and snippets.

@waltervargas
Created March 16, 2017 23:24
Show Gist options
  • Save waltervargas/0605b9cacac2e1892198f0c29742c018 to your computer and use it in GitHub Desktop.
Save waltervargas/0605b9cacac2e1892198f0c29742c018 to your computer and use it in GitHub Desktop.
CloudFormation SG Self-Referenced
---
Description: Create a VPC with a SG which references itself
AWSTemplateFormatVersion: '2010-09-09'
Resources:
vpc:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 172.16.0.0/16
EnableDnsSupport: false
EnableDnsHostnames: false
InstanceTenancy: default
Tags:
- Key: Name
Value: vpc-main
sgcluster:
Type: AWS::EC2::SecurityGroup
DependsOn: vpc
Properties:
GroupDescription: vpc tester sg
VpcId:
Ref: vpc
sgclusteringress:
Type: AWS::EC2::SecurityGroupIngress
DependsOn: sgcluster
Properties:
GroupId:
Ref: sgcluster
IpProtocol: tcp
FromPort: '0'
ToPort: '65535'
SourceSecurityGroupId:
Ref: sgcluster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment