Below is a simple CloudFormation script block to create a Security Group in AWS.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
Resources:
  SampleAppAppstreamSG:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: Inbound and outbound traffic for service
      GroupName: 'sampleappsg-123'
      VpcId: !Ref vpcid
      Tags:
        - Key: "Name"
          Value: "Sample App Security Group"
      SecurityGroupEgress:
      - IpProtocol: "-1"
        FromPort: 0
        ToPort: 0
        CidrIp: 10.0.0.0/8
      SecurityGroupIngress:
      - IpProtocol: "-1"
        FromPort: 0
        ToPort: 0
        CidrIp: 10.0.0.0/8

You can read up more about all the possible arguments in the AWS Security Group CloudFormation Reference.