How to Create an AWS Security Group in CloudFormation

0 min read 77 words

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.

Tags:
Andrew
Andrew

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags