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

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.