The page has been translated by Gen AI.
Load Balancer
L4 Load Balancer that distributes traffic using Virtual Server (Health Check, Server Group, Member, Listener)
Create a Load Balancer, Health Check, Server Group, Member, and Listener. Create the VPC, Subnet, and the Virtual Server that will be the load balancing target together, and register the Virtual Server as a member of the Server Group.
- ImageId and KeypairName must be provided. The image ID can be retrieved via the Virtual Server API’s ListImages, and the key pair must be created manually in advance.
- MemberIp is designated as the fixed IP of the Virtual Server and registered as the Member’s IP. Enter the IP address within the SubnetCidr range.
- Load Balancer is created as an L4 type. The Listener forwards incoming requests on TCP port 80 to the Server Group using a round-robin method, and the Health Check checks the status on TCP port 22 every 30 seconds.
- This sample does not specify a Security Group for the target Virtual Server, so Health Checks or traffic forwarding may not function properly. If needed, refer to the Security Group sample, add a Security Group that allows the Health Check port (TCP 22) and the service port (TCP 80), and assign it to the Virtual Server.
- The default values for ServerTypeId and Zone are example values. Modify the values to match the region and image you are using.
Color mode
SCPTemplateFormatVersion: '2026-01-01'
Description: 'a template that creates a Load Balancer, Health Check, Server Group, Member, and Listener'
Parameters:
VpcName:
Type: String
Default: 'sample-vpc'
MinLength: 3
MaxLength: 20
AllowedPattern: '^[a-zA-Z0-9-]*$'
Description: 'Enter the VPC name.' (3~20 characters, only English letters, numbers, and hyphens allowed)
VpcCidr:
Type: CommaDelimitedList
Default: '10.0.0.0/16'
Description: 'Enter the VPC IP range (CIDR).' Separate multiple entries with commas. (prefix length /16 ~ /24)
SubnetName:
Type: String
Default: 'sample-subnet'
MinLength: 3
MaxLength: 20
AllowedPattern: '^[a-zA-Z0-9-]*$'
Description: 'Enter the Subnet name.' (3~20 characters, only English letters, numbers, and hyphens allowed)
SubnetCidr:
Type: String
Default: '10.0.1.0/24'
Description: 'Enter the IP range (CIDR) of the Subnet.' (within VPC CIDR range)
ImageId:
Type: String
MinLength: 1
Description: 'Enter the standard (public) image ID to use for the LB destination server.' (required)
KeypairName:
Type: String
MinLength: 1
Enter the key pair name. (required)
ServerTypeId:
Type: String
Default: 's1v1m2'
Description: 'Enter the Virtual Server type ID.' (e.g., s1v1m2. ※ Example value - modify to match the region/image)
Zone:
Type: String
Default: 'kr-west1-a'
Description: 'Enter the zone where the Virtual Server will be created. (e.g., kr-west1-a. ※ Example value - modify to match the region)
MemberIp:
Type: String
Default: '10.0.1.10'
Description: 'Enter the IP address of the load balancing target server.'
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: 'Example 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: 'The ID of the created Load Balancer.'
Value: !Ref MyLoadBalancer
ServerGroupId:
Description: 'The ID of the created Server Group.'
Value: !Ref MyServerGroup
ListenerId:
Description: 'The ID of the generated Listener.'
Value: !Ref MyListenerSCPTemplateFormatVersion: '2026-01-01'
Description: 'a template that creates a Load Balancer, Health Check, Server Group, Member, and Listener'
Parameters:
VpcName:
Type: String
Default: 'sample-vpc'
MinLength: 3
MaxLength: 20
AllowedPattern: '^[a-zA-Z0-9-]*$'
Description: 'Enter the VPC name.' (3~20 characters, only English letters, numbers, and hyphens allowed)
VpcCidr:
Type: CommaDelimitedList
Default: '10.0.0.0/16'
Description: 'Enter the VPC IP range (CIDR).' Separate multiple entries with commas. (prefix length /16 ~ /24)
SubnetName:
Type: String
Default: 'sample-subnet'
MinLength: 3
MaxLength: 20
AllowedPattern: '^[a-zA-Z0-9-]*$'
Description: 'Enter the Subnet name.' (3~20 characters, only English letters, numbers, and hyphens allowed)
SubnetCidr:
Type: String
Default: '10.0.1.0/24'
Description: 'Enter the IP range (CIDR) of the Subnet.' (within VPC CIDR range)
ImageId:
Type: String
MinLength: 1
Description: 'Enter the standard (public) image ID to use for the LB destination server.' (required)
KeypairName:
Type: String
MinLength: 1
Enter the key pair name. (required)
ServerTypeId:
Type: String
Default: 's1v1m2'
Description: 'Enter the Virtual Server type ID.' (e.g., s1v1m2. ※ Example value - modify to match the region/image)
Zone:
Type: String
Default: 'kr-west1-a'
Description: 'Enter the zone where the Virtual Server will be created. (e.g., kr-west1-a. ※ Example value - modify to match the region)
MemberIp:
Type: String
Default: '10.0.1.10'
Description: 'Enter the IP address of the load balancing target server.'
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: 'Example 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: 'The ID of the created Load Balancer.'
Value: !Ref MyLoadBalancer
ServerGroupId:
Description: 'The ID of the created Server Group.'
Value: !Ref MyServerGroup
ListenerId:
Description: 'The ID of the generated Listener.'
Value: !Ref MyListener