# SCP::Loadbalancer::Loadbalancer

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

---

```
SCP::Loadbalancer::Loadbalancer
```





## Description
A Loadbalancer that distributes incoming traffic to servers in the subnets according to listener rules. Supports L4/L7 load balancing together with firewall, NAT, and health check features.

## Version
`1.4.0`

## Syntax

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

**JSON**
```json
{
  "Type" : "SCP::Loadbalancer::Loadbalancer",
  "Properties" : {
    "Name" : "String",
    "Description" : "String",
    "LayerType" : "String",
    "VpcId" : "String",
    "SubnetId" : "String",
    "ServiceIp" : "String",
    "FirewallEnabled" : "Boolean",
    "FirewallLoggingEnabled" : "Boolean",
    "PublicipId" : "String",
    "SourceNatIp" : "String",
    "HealthCheckIps" : [String],
    "Zones" : [String]
  }
}

```

**YAML**
```yaml
Type: SCP::Loadbalancer::Loadbalancer
Properties:
  Name: String
  Description: String
  LayerType: String
  VpcId: String
  SubnetId: String
  ServiceIp: String
  FirewallEnabled: Boolean
  FirewallLoggingEnabled: Boolean
  PublicipId: String
  SourceNatIp: String
  HealthCheckIps: [String]
  Zones: [String]

```

## Properties


### Name

The name of the Loadbalancer. Used to identify the Loadbalancer within the account. After creation, the name cannot be changed.

| Attribute | Value |
|-----------|-------|
| **Required** | Yes |
| **Type** | String |
| **Pattern** | `^[a-zA-Z0-9-_]*$` |
| **Length constraints** | 3–63 |
| **Update requires** | Replacement |






### Description

A brief explanation or note about this resource that identifies the purpose or usage of the resource, up to 255 characters.

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






### LayerType

The layer type of the Loadbalancer. L4 supports TCP/UDP protocols and L7 supports HTTP/HTTPS-based routing.

| Attribute | Value |
|-----------|-------|
| **Required** | Yes |
| **Type** | String |
| **Pattern** | `^(L4|L7)$` |
| **Update requires** | Replacement |






### VpcId

The identifier of the VPC where the resource is located.

| Attribute | Value |
|-----------|-------|
| **Required** | Yes |
| **Type** | String |
| **Update requires** | Replacement |






### SubnetId

The identifier of the subnet where the resource is located.

| Attribute | Value |
|-----------|-------|
| **Required** | Yes |
| **Type** | String |
| **Update requires** | Replacement |






### ServiceIp

The service IP address through which clients access the Loadbalancer. When omitted, an IP is automatically assigned.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | Replacement |






### FirewallEnabled

Whether firewall is enabled. When set to true, traffic through the Loadbalancer is filtered by the firewall.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | Boolean |
| **Update requires** | Replacement |






### FirewallLoggingEnabled

Whether firewall logging is enabled. Only applies when FirewallEnabled is true.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | Boolean |
| **Update requires** | Replacement |






### PublicipId

The Public IP ID associated with the Loadbalancer. Used for internet access when public NAT is enabled.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | Replacement |






### SourceNatIp

The source NAT IP address. Used as the source address for outbound traffic through the Loadbalancer.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | Replacement |






### HealthCheckIps

The list of IP addresses used to check the health of the Loadbalancer servers.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | Array of String |
| **Update requires** | Replacement |






### Zones

The list of availability zones where the Loadbalancer is located.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | Array of String |
| **Update requires** | Replacement |







## 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 Loadbalancer. Used to identify the Loadbalancer within the account. After creation, the name cannot be changed. |
| **Description** | A brief explanation or note about this resource that identifies the purpose or usage of the resource, up to 255 characters. |
| **LayerType** | The layer type of the Loadbalancer. L4 supports TCP/UDP protocols and L7 supports HTTP/HTTPS-based routing. |
| **VpcId** | The identifier of the VPC where the resource is located. |
| **SubnetId** | The identifier of the subnet where the resource is located. |
| **ServiceIp** | The service IP address through which clients access the Loadbalancer. When omitted, an IP is automatically assigned. |
| **FirewallEnabled** | Whether firewall is enabled. When set to true, traffic through the Loadbalancer is filtered by the firewall. |
| **FirewallLoggingEnabled** | Whether firewall logging is enabled. Only applies when FirewallEnabled is true. |
| **PublicipId** | The Public IP ID associated with the Loadbalancer. Used for internet access when public NAT is enabled. |
| **SourceNatIp** | The source NAT IP address. Used as the source address for outbound traffic through the Loadbalancer. |
| **HealthCheckIps** | The list of IP addresses used to check the health of the Loadbalancer servers. |
| **Zones** | The list of availability zones where the Loadbalancer is located. |
| **AccountId** | The account ID associated with the Loadbalancer. |
| **FirewallId** | The firewall ID associated with the Loadbalancer. |
| **PublicNatEnabled** | Whether public NAT is enabled. |
| **State** | The current state of the Loadbalancer. |


## Sample Template

### Create a Load Balancer with a health check, server group, member, and listener
Creates a Load Balancer with a health check, server group, member, and listener

```yaml
SCPTemplateFormatVersion: '2026-01-01'
Description: 'Load Balancer와 Health Check, Server Group, Member, Listener를 생성하는 템플릿'
Parameters:
  VpcName:
    Type: String
    Default: 'sample-vpc'
    MinLength: 3
    MaxLength: 20
    AllowedPattern: '^[a-zA-Z0-9-]*$'
    Description: 'VPC 이름을 입력하세요. (3~20자, 영문/숫자/하이픈만 허용)'
  VpcCidr:
    Type: CommaDelimitedList
    Default: '10.0.0.0/16'
    Description: 'VPC의 CIDR 블록을 입력하세요. (/16 ~ /24)'
  SubnetName:
    Type: String
    Default: 'sample-subnet'
    MinLength: 3
    MaxLength: 20
    AllowedPattern: '^[a-zA-Z0-9-]*$'
    Description: 'Subnet 이름을 입력하세요. (3~20자, 영문/숫자/하이픈만 허용)'
  SubnetCidr:
    Type: String
    Default: '10.0.1.0/24'
    Description: 'Subnet의 CIDR 블록을 입력하세요. (VPC CIDR 범위 내)'
  ImageId:
    Type: String
    MinLength: 1
    Description: 'LB 목적지 서버에 사용할 표준(공용) 이미지 ID를 입력하세요. (필수)'
  KeypairName:
    Type: String
    MinLength: 1
    Description: '키페어 이름을 입력하세요. (필수)'
  ServerTypeId:
    Type: String
    Default: 's1v1m2'
    Description: '가상 서버 타입 ID (예: s1v1m2. ※ 예시 값 - 리전/이미지에 맞게 수정)'
  Zone:
    Type: String
    Default: 'kr-west1-a'
    Description: '가용존 (예: kr-west1-a. ※ 예시 값 - 리전에 맞게 수정)'
  MemberIp:
    Type: String
    Default: '10.0.1.10'
    Description: '로드밸런싱 대상 서버의 IP 주소'

Resources:
  MyVpc:
    Type: SCP::VPC::Vpc
    Properties:
      Name: !Ref VpcName
      Cidrs: !Ref VpcCidr
  MySubnet:
    Type: SCP::VPC::Subnet
    Properties:
      Name: !Ref SubnetName
      VpcId: !Ref MyVpc
      Cidr: !Ref SubnetCidr
      Type: PRIVATE
      Category: PRIMARY
  MyServer:
    Type: SCP::VirtualServer::VirtualServer
    Properties:
      Name: 'sample-server'
      ImageId: !Ref ImageId
      KeypairName: !Ref KeypairName
      ServerTypeId: !Ref ServerTypeId
      Zone: !Ref Zone
      Networks:
        - SubnetId: !Ref MySubnet
          FixedIp: !Ref MemberIp
      BootVolume:
        Size: 40
        Type: SSD
  MyLoadBalancer:
    Type: SCP::Loadbalancer::Loadbalancer
    Properties:
      Name: 'sample-lb'
      LayerType: L4
      Description: '예제용 Load Balancer'
      FirewallEnabled: false
      FirewallLoggingEnabled: false
      VpcId: !Ref MyVpc
      SubnetId: !Ref MySubnet
      Zones: [!Ref Zone]
  MyHealthCheck:
    Type: SCP::Loadbalancer::LBHealthCheck
    DependsOn: MyLoadBalancer
    Properties:
      Name: 'sample-health-check'
      Protocol: TCP
      HealthCheckPort: 22
      HealthCheckInterval: 30
      HealthCheckTimeout: 5
      HealthCheckCount: 3
      VpcId: !Ref MyVpc
      SubnetId: !Ref MySubnet
  MyServerGroup:
    Type: SCP::Loadbalancer::LbServerGroup
    Properties:
      Name: 'sample-server-group'
      Protocol: TCP
      LbMethod: ROUND_ROBIN
      LbHealthCheckId: !Ref MyHealthCheck
      VpcId: !Ref MyVpc
      SubnetId: !Ref MySubnet
  MyMember:
    Type: SCP::Loadbalancer::Member
    Properties:
      LbServerGroupId: !Ref MyServerGroup
      Name: 'sample-member'
      MemberIp: !Ref MemberIp
      MemberPort: 80
      ObjectType: MANUAL
      MemberWeight: 1
  MyListener:
    Type: SCP::Loadbalancer::LBListener
    Properties:
      LoadbalancerId: !Ref MyLoadBalancer
      Name: 'sample-listener'
      Protocol: TCP
      RoutingAction: LB_SERVER_GROUP
      ServicePort: 80
      SessionDurationTime: 600
      ServerGroupId: !Ref MyServerGroup

Outputs:
  LoadBalancerId:
    Description: "생성된 Load Balancer의 ID입니다."
    Value: !Ref MyLoadBalancer
  ServerGroupId:
    Description: "생성된 Server Group의 ID입니다."
    Value: !Ref MyServerGroup
  ListenerId:
    Description: "생성된 Listener의 ID입니다."
    Value: !Ref MyListener

```
