# SCP::SecurityGroup::SecurityGroup

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

---

```
SCP::SecurityGroup::SecurityGroup
```





## 설명
서버의 인바운드 및 아웃바운드 트래픽을 제어하는 Security Group입니다. Security Group Rule 리소스에 정의된 규칙에 따라 트래픽이 허용되거나 거부됩니다.

## 버전
`1.1.0`

## 구문

Infrastructure Builder 템플릿에서 이 엔티티를 선언하려면 다음 구문을 사용하세요:

**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

```

## 속성


### Name

Security Group의 이름입니다. - minLength : 1 - maxLength : 255

| 항목 | 값 |
|-----------|-------|
| **필수 여부** | 예 |
| **타입** | String |
| **길이 제약** | 1–255 |
| **업데이트 조건** | 교체 필요 |






### Description

이 Security Group의 목적이나 용도를 나타내는 간단한 설명 또는 메모입니다. - maxLength : 255

| 항목 | 값 |
|-----------|-------|
| **필수 여부** | 아니요 |
| **타입** | String |
| **길이 제약** | 최대: 255 |
| **업데이트 조건** | 중단 없음 |






### Loggable

보안 그룹에 대한 flow log 활성화 여부입니다. true로 설정하면 보안 그룹의 트래픽 로그가 수집됩니다.

| 항목 | 값 |
|-----------|-------|
| **필수 여부** | 아니요 |
| **타입** | Boolean |
| **업데이트 조건** | 중단 없음 |







## 반환 값

### Ref

이 리소스의 논리적 ID를 `Ref` 함수에 전달하면, Ref는 **Id** 값을 반환합니다.


### Fn::GetAtt

| 속성 | 설명 |
|-----------|-------------|
| **Name** | Security Group의 이름입니다. - minLength : 1 - maxLength : 255 |
| **Description** | 이 Security Group의 목적이나 용도를 나타내는 간단한 설명 또는 메모입니다. - maxLength : 255 |
| **Loggable** | 보안 그룹에 대한 flow log 활성화 여부입니다. true로 설정하면 보안 그룹의 트래픽 로그가 수집됩니다. |
| **AccountId** | Security Group과 연결된 계정 ID입니다. |
| **State** | Security Group의 현재 상태입니다. |
| **RuleCount** | Security Group에 정의된 규칙 수입니다. |


## 샘플 템플릿

### Security Group과 인바운드 규칙 생성
Security Group과 SSH/HTTP/HTTPS 인바운드 규칙을 생성한다.

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

```
