SCP::Loadbalancer::Loadbalancer

SCP::Loadbalancer::Loadbalancer

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

{
  "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

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.

AttributeValue
RequiredYes
TypeString
Pattern^[a-zA-Z0-9-_]*$
Length constraints3–63
Update requiresReplacement

Description

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

AttributeValue
RequiredNo
TypeString
Length constraintsMax: 255
Update requiresNo interruption

LayerType

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

AttributeValue
RequiredYes
TypeString
Pattern`^(L4
Update requiresReplacement

VpcId

The identifier of the VPC where the resource is located.

AttributeValue
RequiredYes
TypeString
Update requiresReplacement

SubnetId

The identifier of the subnet where the resource is located.

AttributeValue
RequiredYes
TypeString
Update requiresReplacement

ServiceIp

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

AttributeValue
RequiredNo
TypeString
Update requiresReplacement

FirewallEnabled

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

AttributeValue
RequiredNo
TypeBoolean
Update requiresReplacement

FirewallLoggingEnabled

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

AttributeValue
RequiredNo
TypeBoolean
Update requiresReplacement

PublicipId

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

AttributeValue
RequiredNo
TypeString
Update requiresReplacement

SourceNatIp

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

AttributeValue
RequiredNo
TypeString
Update requiresReplacement

HealthCheckIps

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

AttributeValue
RequiredNo
TypeArray of String
Update requiresReplacement

Zones

The list of availability zones where the Loadbalancer is located.

AttributeValue
RequiredNo
TypeArray of String
Update requiresReplacement

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 Loadbalancer. Used to identify the Loadbalancer within the account. After creation, the name cannot be changed.
DescriptionA brief explanation or note about this resource that identifies the purpose or usage of the resource, up to 255 characters.
LayerTypeThe layer type of the Loadbalancer. L4 supports TCP/UDP protocols and L7 supports HTTP/HTTPS-based routing.
VpcIdThe identifier of the VPC where the resource is located.
SubnetIdThe identifier of the subnet where the resource is located.
ServiceIpThe service IP address through which clients access the Loadbalancer. When omitted, an IP is automatically assigned.
FirewallEnabledWhether firewall is enabled. When set to true, traffic through the Loadbalancer is filtered by the firewall.
FirewallLoggingEnabledWhether firewall logging is enabled. Only applies when FirewallEnabled is true.
PublicipIdThe Public IP ID associated with the Loadbalancer. Used for internet access when public NAT is enabled.
SourceNatIpThe source NAT IP address. Used as the source address for outbound traffic through the Loadbalancer.
HealthCheckIpsThe list of IP addresses used to check the health of the Loadbalancer servers.
ZonesThe list of availability zones where the Loadbalancer is located.
AccountIdThe account ID associated with the Loadbalancer.
FirewallIdThe firewall ID associated with the Loadbalancer.
PublicNatEnabledWhether public NAT is enabled.
StateThe 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

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