How to Create an AWS Security Group in CloudFormation

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
Code language: YAML (yaml)

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

Tags:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments