# SCP::SecurityGroup::SecurityGroup

LLMS index: [llms.txt](https://docs.e.samsungsdscloud.com/en/templatereference/networking/security-group/llms.txt)

---

```
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**
```json
{
  "Type" : "SCP::SecurityGroup::SecurityGroup",
  "Properties" : {
    "Name" : "String",
    "Description" : "String",
    "Loggable" : "Boolean"
  }
}

```

**YAML**
```yaml
Type: SCP::SecurityGroup::SecurityGroup
Properties:
  Name: String
  Description: String
  Loggable: Boolean

```

## Properties


### Name

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

| Attribute | Value |
|-----------|-------|
| **Required** | Yes |
| **Type** | String |
| **Length constraints** | 1–255 |
| **Update requires** | Replacement |






### Description

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

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Length constraints** | Max: 255 |
| **Update requires** | No interruption |






### Loggable

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

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | Boolean |
| **Update requires** | No 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

| Attribute | Description |
|-----------|-------------|
| **Name** | The name of the Security Group. - minLength : 1 - maxLength : 255 |
| **Description** | A brief explanation or note about this Security Group that identifies the purpose or usage of the resource. - maxLength : 255 |
| **Loggable** | Enable flow log for the security group. When set to true, the traffic logs of the security group are collected. |
| **AccountId** | The account ID associated with the Security Group. |
| **State** | The current state of the Security Group. |
| **RuleCount** | The 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

```yaml
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

```
