SCP::SecurityGroup::SecurityGroup

SCP::SecurityGroup::SecurityGroup

SCP::SecurityGroup::SecurityGroup

Description

A Security Group that controls the inbound and outbound traffic of servers. Traffic is allowed or denied according to the rules defined in the Security Group Rule resource.

Version

1.1.0

Syntax

To declare this entity in your Infrastructure Builder template, use the following syntax:

JSON

{
  "Type" : "SCP::SecurityGroup::SecurityGroup",
  "Properties" : {
    "Name" : "String",
    "Description" : "String",
    "Loggable" : "Boolean"
  }
}

YAML

Type: SCP::SecurityGroup::SecurityGroup
Properties:
  Name: String
  Description: String
  Loggable: Boolean

Properties

Name

The name of the Security Group. - minLength : 1 - maxLength : 255

AttributeValue
RequiredYes
TypeString
Length constraints1–255
Update requiresReplacement

Description

A brief explanation or note about this Security Group that identifies the purpose or usage of the resource. - maxLength : 255

AttributeValue
RequiredNo
TypeString
Length constraintsMax: 255
Update requiresNo interruption

Loggable

Enable flow log for the security group. When set to true, the traffic logs of the security group are collected.

AttributeValue
RequiredNo
TypeBoolean
Update requiresNo interruption

Return Values

Ref

When you pass the logical ID of this resource to the Ref function, Ref returns the value of the Id.

Fn::GetAtt

AttributeDescription
NameThe name of the Security Group. - minLength : 1 - maxLength : 255
DescriptionA brief explanation or note about this Security Group that identifies the purpose or usage of the resource. - maxLength : 255
LoggableEnable flow log for the security group. When set to true, the traffic logs of the security group are collected.
AccountIdThe account ID associated with the Security Group.
StateThe current state of the Security Group.
RuleCountThe number of rules defined in the Security Group.

Sample Template

Create a Security Group and inbound rules

Creates a Security Group and SSH/HTTP/HTTPS inbound rules

SCPTemplateFormatVersion: '2026-01-01'
Description: 'Security Group 및 인바운드 규칙 템플릿'

Parameters:
  SecurityGroupName:
    Type: String
    Default: 'sample-security-group'
    Description: 'Security Group 이름을 입력하세요. (1-255자)'
  IngressCidr:
    Type: String
    Default: '0.0.0.0/0'
    Description: 'SSH/HTTP/HTTPS 인바운드 트래픽을 허용할 IP 대역(CIDR)을 입력하세요.'

Resources:
  SecurityGroup:
    Type: SCP::SecurityGroup::SecurityGroup
    Properties:
      Name: !Ref SecurityGroupName

  SshIngressRule:
    Type: SCP::SecurityGroup::SecurityGroupRule
    Properties:
      SecurityGroupId: !Ref SecurityGroup
      Direction: ingress
      Ethertype: IPv4
      Protocol: tcp
      PortRangeMin: 22
      PortRangeMax: 22
      RemoteIpPrefix: !Ref IngressCidr

  WebIngressRule:
    Type: SCP::SecurityGroup::SecurityGroupRule
    Properties:
      SecurityGroupId: !Ref SecurityGroup
      Direction: ingress
      Ethertype: IPv4
      Protocol: tcp
      PortRangeMin: 80
      PortRangeMax: 80
      RemoteIpPrefix: !Ref IngressCidr

  HttpsIngressRule:
    Type: SCP::SecurityGroup::SecurityGroupRule
    Properties:
      SecurityGroupId: !Ref SecurityGroup
      Direction: ingress
      Ethertype: IPv4
      Protocol: tcp
      PortRangeMin: 443
      PortRangeMax: 443
      RemoteIpPrefix: !Ref IngressCidr

Outputs:
  SecurityGroupId:
    Description: "생성된 Security Group의 ID입니다."
    Value: !Ref SecurityGroup
  SshIngressRuleId:
    Description: "생성된 SSH 인바운드 규칙의 ID입니다."
    Value: !Ref SshIngressRule