Manage Templates
Users can create and save a template that defines the infrastructure for use in stack creation. Refer to the concept and storage location of templates in 템플릿.
Create a template
Templates are written in JSON or YAML format, defining the resources to be created, input values, and output values by section.
Template format
Templates are written in JSON or YAML format. Since both formats represent the same structure, you can choose the format that is more convenient to write.
| Category | JSON | YAML |
|---|---|---|
| Structure representation | Represent structure with curly braces ({}) and square brackets ([]). | Represent structure with indentation
|
| Comment | Not supported | Comments can be written after # |
| Built-in function notation | Write in full format
| Both full syntax and short syntax can be used
|
Template structure
The template consists of multiple sections. Only the Resources section is mandatory, and the other sections can be optionally included as needed.
| section | Required or not | Explanation |
|---|---|---|
| SCPTemplateFormatVersion | Select | Version of the format that the template follows |
| Description | Select | Description of the template |
| Metadata | Select | Additional information about the template |
| Parameters | Select | Input values when creating or updating a stack |
| Rules | Select | Rules for validating parameter values entered when creating or updating a stack |
| Mappings | Select | Table of values that can be retrieved by key |
| Conditions | Select | Conditions that determine whether a resource is created or its attribute values |
| Resources | Required | Resources to be created and their attributes |
| Outputs | Select | Value to verify after creating the stack or to pass to another stack |
The following is the basic structure of the template that includes all sections. It is recommended to write the section in the order below.
SCPTemplateFormatVersion: '2026-01-01'
Description: Description of the template
Metadata:
Metadata definition
Parameters:
Parameter definition
Rules:
Rule definition
Mappings:
Mapping definition
Conditions:
Condition definition
Resources:
Resource definition
Outputs:
Result output definitionSCPTemplateFormatVersion: '2026-01-01'
Description: Description of the template
Metadata:
Metadata definition
Parameters:
Parameter definition
Rules:
Rule definition
Mappings:
Mapping definition
Conditions:
Condition definition
Resources:
Resource definition
Outputs:
Result output definition{
"SCPTemplateFormatVersion": "2026-01-01",
"Description": "Description of the template",
"Metadata": {
Metadata definition
},
"Parameters": {
Parameter definition
},
"Rules": {
Rule definition
},
"Mappings": {
Mapping definition
},
"Conditions": {
Condition definition
},
"Resources": {
Resource definition
},
"Outputs": {
Result output definition
}
}{
"SCPTemplateFormatVersion": "2026-01-01",
"Description": "Description of the template",
"Metadata": {
Metadata definition
},
"Parameters": {
Parameter definition
},
"Rules": {
Rule definition
},
"Mappings": {
Mapping definition
},
"Conditions": {
Condition definition
},
"Resources": {
Resource definition
},
"Outputs": {
Result output definition
}
}Format version (SCPTemplateFormatVersion)
Specifies the version of the format that the template follows. The only supported value is '2026-01-01', and it can be omitted.
- In YAML, wrap values in single quotes (
') to prevent date-formatted values from being interpreted as dates.
SCPTemplateFormatVersion: '2026-01-01'SCPTemplateFormatVersion: '2026-01-01'Description(Description)
Write a string that describes the purpose or composition of the template. The description can be up to 1,024 bytes.
Description: 'Template that creates VPC and Subnet'Description: 'Template that creates VPC and Subnet'Metadata(Metadata)
Defines additional information about the template. You can record information needed to manage the template, such as the template’s owner or purpose.
Metadata:
Owner: 'network-team'
Purpose: 'Development environment network configuration'Metadata:
Owner: 'network-team'
Purpose: 'Development environment network configuration'Define Parameter Group
If you define the SCP::InfrastructureBuilder::Interface key in the metadata, the Console’s stack creation screen will group parameters together and let you specify a label to display instead of the parameter name.
| Category | Explanation |
|---|---|
| ParameterGroups | List of parameter groups
|
| ParameterLabels | Label to display for each parameter
|
Metadata:
SCP::InfrastructureBuilder::Interface:
ParameterGroups:
- Label:
default: 'Network Settings'
Parameters:
- VpcCidr
- SubnetCidr
- Label:
default: 'Server Settings'
Parameters:
- ServerTypeId
- KeypairName
ParameterLabels:
VpcCidr:
default: 'VPC IP range'
SubnetCidr:
default: 'Subnet IP range'Metadata:
SCP::InfrastructureBuilder::Interface:
ParameterGroups:
- Label:
default: 'Network Settings'
Parameters:
- VpcCidr
- SubnetCidr
- Label:
default: 'Server Settings'
Parameters:
- ServerTypeId
- KeypairName
ParameterLabels:
VpcCidr:
default: 'VPC IP range'
SubnetCidr:
default: 'Subnet IP range'- Parameter groups are applied only on the stack creation screen in the Console and do not affect the creation or operation of the stack.
- Parameters that are not included in any group are displayed separately outside the group.
- If a parameter not defined in the template is assigned to a group, that parameter is ignored, and groups with no included parameters are not displayed.
Parameter(Parameters)
Defines the values to be received as input when creating or updating a stack. By using parameters, you can input different values for each environment in a single template and reuse it.
Each parameter specifies the following attributes under its parameter name.
| attribute | Required or not | Explanation |
|---|---|---|
| Type | Required | Parameter data type
|
| Default | Select | Default value to use when no value is entered
|
| Description | Selection | Description of the parameter
|
| AllowedValues | Select | List of values that can be entered
|
| AllowedPattern | Select | Regular expression pattern that the input value must match
|
| MinLength, MaxLength | Select | minimum and maximum length of the input value
|
| MinValue, MaxValue | Select | Minimum and maximum values of the input
|
| NoEcho | Select | If set to true, the input value and the retrieved result are masked and displayed
|
| ConstraintDescription | Select | Description to display instead of the default error message when the input violates a constraint
|
Parameters:
EnvName:
Type: String
Default: dev
AllowedValues:
- dev
- prod
Description: 'Select the deployment environment.'
VpcCidr:
Type: String
Default: '10.0.0.0/16'
AllowedPattern: '^(\d{1,3}\.){3}\d{1,3}/\d{1,2}$'
Description: 'Enter the VPC's IP range (CIDR).'
ConstraintDescription: 'Must be entered in CIDR format (e.g., 10.0.0.0/16).'
BootVolumeSize:
Type: Number
Default: 40
MinValue: 40
MaxValue: 200
Description: 'Enter the boot volume size (GB).'
UserPassword:
Type: String
NoEcho: true
MinLength: 8
Description: 'Enter the user password.'
AllowedCidrs:
Type: CommaDelimitedList
Default: '10.0.0.0/16,192.168.0.0/24'
Description: 'Enter the IP ranges to allow access, separated by commas.'Parameters:
EnvName:
Type: String
Default: dev
AllowedValues:
- dev
- prod
Description: 'Select the deployment environment.'
VpcCidr:
Type: String
Default: '10.0.0.0/16'
AllowedPattern: '^(\d{1,3}\.){3}\d{1,3}/\d{1,2}$'
Description: 'Enter the VPC's IP range (CIDR).'
ConstraintDescription: 'Must be entered in CIDR format (e.g., 10.0.0.0/16).'
BootVolumeSize:
Type: Number
Default: 40
MinValue: 40
MaxValue: 200
Description: 'Enter the boot volume size (GB).'
UserPassword:
Type: String
NoEcho: true
MinLength: 8
Description: 'Enter the user password.'
AllowedCidrs:
Type: CommaDelimitedList
Default: '10.0.0.0/16,192.168.0.0/24'
Description: 'Enter the IP ranges to allow access, separated by commas.'The defined parameters are referenced in the Resources and Outputs sections using !Ref parameter name. Parameters of list types (List<Number>, CommaDelimitedList) can be used by extracting a value at a specific position with !Select or concatenating them into a single string with !Join.
- A template can define up to 200 parameters, and each parameter value can be up to 4,096 bytes.
- Do not write sensitive information such as passwords directly in the template; instead, receive it as a parameter with
NoEchospecified. - Refer to Create a stack for how parameters are displayed in the Console when creating a stack.
Rules(Rules)
Validates whether the parameter values entered when creating or updating a stack meet the conditions. The value of a single parameter is validated using parameter attributes (AllowedValues, AllowedPattern, etc.), and combinations of multiple parameter values are validated by rules.
Each rule consists of the following elements.
| Category | Required or not | Explanation |
|---|---|---|
| RuleCondition | Select | the condition to apply the rule
|
| Assertions | Required | List of validation items that the parameter value must satisfy |
| Assert | Required | The condition that must be true for each item of Assertions
|
| AssertDescription | Select | The message displayed when validation fails for each item of Assertions |
The rules allow the use of the following function.
| Category | function |
|---|---|
| Condition function | Fn::Equals, Fn::Not, Fn::And, Fn::Or |
| Reference function | Ref |
| Rule-specific function | Fn::Contains, Fn::EachMemberEquals, Fn::EachMemberIn |
The rule-specific function is as follows.
| function | format | Explanation |
|---|---|---|
| Fn::Contains | Fn::Contains: [list of strings, string] | Returns true if the specified string is contained in the list of strings. |
| Fn::EachMemberEquals | Fn::EachMemberEquals: [list of strings, string] | Returns true if all values in the string list are equal to the specified string. |
| Fn::EachMemberIn | Fn::EachMemberIn: [list of strings, list of allowed values] | Returns true if all values in the string list are included in the allowed values list. |
Rules:
ProdServerType:
RuleCondition: !Equals [!Ref EnvName, prod]
Assertions:
- Assert: !Not [!Equals [!Ref ServerTypeId, s1v1m2]]
AssertDescription: 'The s1v1m2 server type cannot be used in a production environment.'Rules:
ProdServerType:
RuleCondition: !Equals [!Ref EnvName, prod]
Assertions:
- Assert: !Not [!Equals [!Ref ServerTypeId, s1v1m2]]
AssertDescription: 'The s1v1m2 server type cannot be used in a production environment.'The above example validates that when the value of the EnvName parameter is prod, the ServerTypeId parameter cannot be set to s1v1m2. Rules are evaluated when creating or updating a stack, and if validation fails, the stack cannot be created or updated.
Mapping(Mappings)
Define a table that can look up values by key. When you need to use different values depending on the environment or region, define the values as a mapping and retrieve them using a key.
A mapping consists of three steps: the mapping name, the top-level key, and the second key and value.
Mappings:
EnvironmentMap:
dev:
ServerTypeId: s1v1m2
prod:
ServerTypeId: s1v2m4Mappings:
EnvironmentMap:
dev:
ServerTypeId: s1v1m2
prod:
ServerTypeId: s1v2m4The value of a mapping is retrieved in the !FindInMap [mapping name, top-level key, second key] format. For example, !FindInMap [EnvironmentMap, !Ref EnvName, ServerTypeId] returns the server type ID based on the value of the EnvName parameter.
Conditions(Conditions)
Defines a condition that evaluates to true or false based on parameter values, etc. Using conditions, you can specify whether resources are created or assign different property values in a single template based on the environment.
Conditions are defined using the !Equals, !Not, !And, !Or functions, and within a function you can use value reference functions such as !Ref. The defined condition is used as follows.
- If you specify a condition name in the resource’s
Conditionproperty, the resource is created only when the condition is true. - If you use the
!Iffunction, you can assign property values differently based on conditions.
Conditions:
IsProd: !Equals [!Ref EnvName, prod]
Resources:
Vpc:
Type: SCP::VPC::Vpc
Properties:
Name: !If [IsProd, 'prod-vpc', 'dev-vpc']
Cidrs: ['10.0.0.0/16']
ProdPublicIp:
Type: SCP::VPC::PublicIp
Condition: IsProd
Properties:
Type: IGW
Zone: 'kr-west1-a'Conditions:
IsProd: !Equals [!Ref EnvName, prod]
Resources:
Vpc:
Type: SCP::VPC::Vpc
Properties:
Name: !If [IsProd, 'prod-vpc', 'dev-vpc']
Cidrs: ['10.0.0.0/16']
ProdPublicIp:
Type: SCP::VPC::PublicIp
Condition: IsProd
Properties:
Type: IGW
Zone: 'kr-west1-a'In the above example, the Vpc resource’s name is set to prod-vpc if the EnvName parameter value is prod; otherwise, it is set to dev-vpc. The ProdPublicIp resource is created only when the value of the EnvName parameter is prod.
Resources(Resources)
Define the resources to be created and their properties. It is the only required section in the template, and you must define at least one resource.
Each resource consists of the following elements.
| Category | Required or not | Explanation |
|---|---|---|
| Logical ID | Required | Name that identifies a resource within the template
|
| Type | Required | The type of resource to create
|
| Properties | Required | Resource attributes
|
Resources:
Vpc:
Type: SCP::VPC::Vpc
Properties:
Name: !Ref VpcName
Cidrs: [!Ref VpcCidr]
Subnet:
Type: SCP::VPC::Subnet
Properties:
Name: !Ref SubnetName
VpcId: !Ref Vpc
Cidr: !Ref SubnetCidr
Type: PRIVATE
Category: PRIMARYResources:
Vpc:
Type: SCP::VPC::Vpc
Properties:
Name: !Ref VpcName
Cidrs: [!Ref VpcCidr]
Subnet:
Type: SCP::VPC::Subnet
Properties:
Name: !Ref SubnetName
VpcId: !Ref Vpc
Cidr: !Ref SubnetCidr
Type: PRIVATE
Category: PRIMARYIn the above example, the Subnet resource references the Vpc resource’s ID with !Ref Vpc.
In addition to Type and Properties, you can specify the following attributes for a resource to control its creation conditions, order, and behavior upon deletion.
| attribute | Explanation |
|---|---|
| DependsOn | Create this resource after the specified resource has been created
|
| Condition | Create the resource only when the specified condition is true
|
| DeletionPolicy | Specify how the actual resource is handled when a resource is deleted from the stack
|
| UpdateReplacePolicy | Specify how to handle existing resources when a resource is replaced during a stack update
|
Resources:
InternetGateway:
Type: SCP::VPC::InternetGateway
Properties:
Type: IGW
VpcId: !Ref Vpc
PublicIp:
Type: SCP::VPC::PublicIp
DependsOn: InternetGateway
DeletionPolicy: Retain
Properties:
Type: IGW
Zone: 'kr-west1-a'Resources:
InternetGateway:
Type: SCP::VPC::InternetGateway
Properties:
Type: IGW
VpcId: !Ref Vpc
PublicIp:
Type: SCP::VPC::PublicIp
DependsOn: InternetGateway
DeletionPolicy: Retain
Properties:
Type: IGW
Zone: 'kr-west1-a'In the above example, the PublicIp resource does not reference the InternetGateway resource, but because DependsOn is specified, it is created after the InternetGateway resource is created. Also, since the DeletionPolicy is set to Retain, the actual Public IP is not deleted and is retained even if the stack is deleted.
- Refer to the Template Reference for available resource types and their attributes.
- A template can define up to 500 resources.
- Keypairs cannot be created from a template. Provide the name of the pre‑created Keypair as a parameter and reference it.
- To create a stack with a template that includes IAM resources, you must approve the creation of IAM resources. In the Console, select the Approve to allow Infrastructure Builder to create IAM resources. option, and specify
CAPABILITY_IAMin OpenAPI or CLI. - Resources retained with
Retainare no longer managed by the stack. Delete unused resources directly in the respective service.
Result Output (Outputs)
Define the values to verify after creating the stack or to pass to another stack. The defined value can be viewed in the Result Information tab of the stack details.
Each result output specifies the following attributes under the output name.
| attribute | Required or not | Explanation |
|---|---|---|
| Value | Required | value to be returned as output
|
| Description | Select | Explanation of the result output |
| Export | Select | When exporting a value so that it can be referenced from another stack, specify
|
Outputs:
VpcId:
Description: 'The ID of the created VPC.'
Value: !Ref Vpc
Export:
Name: !Sub '${EnvName}-VpcId'Outputs:
VpcId:
Description: 'The ID of the created VPC.'
Value: !Ref Vpc
Export:
Name: !Sub '${EnvName}-VpcId'The exported value is referenced in another stack using !ImportValue ExportName.
Resources:
Subnet:
Type: SCP::VPC::Subnet
Properties:
Name: 'app-subnet'
VpcId: !ImportValue dev-VpcId
Cidr: '10.0.2.0/24'
Type: PRIVATE
Category: PRIMARYResources:
Subnet:
Type: SCP::VPC::Subnet
Properties:
Name: 'app-subnet'
VpcId: !ImportValue dev-VpcId
Cidr: '10.0.2.0/24'
Type: PRIVATE
Category: PRIMARY- A template can define up to 200 result outputs.
- Export names can be up to 255 characters using letters, numbers, colons (:), and hyphens (-), and must be unique within the same Account and region.
- The exported value can be up to 1,024 characters.
- Exports can only be referenced from other stacks in the same account and region. For more details, refer to 내보내기.
- Exports referenced in another stack cannot be deleted or modified.
built-in function
Built-in functions are used within templates to reference the values of parameters or other resources, combine values, and evaluate conditions. In YAML, you can write using the short form with ! instead of Fn::.
Built-in functions are classified as follows based on where they are used.
| Category | Usage location |
|---|---|
| value function | Location where you specify values such as resource attributes and result output |
| Condition function | Conditions section |
| Rule-specific function | Rules section
|
value function
The following are functions used when referencing or combining values.
| function | YAML shorthand syntax | Explanation |
|---|---|---|
| Ref | !Ref name | Reference a parameter, resource, or pseudo‑parameter
|
| Fn::GetAtt | !GetAtt LogicalID.Attribute | Returns the attribute value of a resource
|
| Fn::Sub | !Sub 'string'!Sub ['string', {variable: value}] | Replace ${name} in the string with the value of a parameter, resource, or pseudo‑parameter
|
| Fn::Join | !Join [delimiter, [value1, value2, ...]] | Returns a string that joins a list of values with a delimiter
|
| Fn::Split | !Split [delimiter, string] | Returns a list split by the delimiter
|
| Fn::Select | !Select [index, list] | Returns the value at the index position in the list
|
| Fn::If | !If [condition name, value when true, value when false] | Returns one of two values based on the condition result
|
| Fn::FindInMap | !FindInMap [mapping name, top-level key, second key] | Retrieve values from the mapping defined in the Mappings section |
| Fn::Base64 | !Base64 string | Returns the value of the string encoded in Base64
|
| Fn::ImportValue | !ImportValue export name | Return the value exported from another stack
|
| Fn::Cidr | !Cidr [IP range, count, host bit size] | Returns a list of CIDR blocks that split the specified IP range into the given number
|
| Fn::Length | !Length list | Return the number of items in the list |
| Fn::ToJsonString | !ToJsonString object | Convert an object or list to a JSON string and return it. |
!Ref and the attributes you can retrieve with !GetAtt.Conditional function
The following is a function used to define conditions in the Conditions section. Within condition functions, you can use value functions such as !Ref.
| function | YAML short form | Explanation |
|---|---|---|
| Fn::Equals | !Equals [value1, value2] | Returns true if the two values are equal |
| Fn::Not | !Not [condition] | Returns false when the condition is true, and true when it is false. |
| Fn::And | !And [condition1, condition2, ...] | Returns true if all conditions are true |
| Fn::Or | !Or [condition1, condition2, ...] | Returns true if at least one condition is true. |
Doctor parameter
A pseudo-parameter is a parameter predefined by Infrastructure Builder that can be used without being separately defined in the template. Reference using !Ref or !Sub.
| Doctor parameter | return value |
|---|---|
| SCP::Region | Region where the stack is created |
| SCP::AccountId | Account ID where the stack is created |
| SCP::StackId | Stack ID |
| SCP::StackName | Stack name |
| SCP::Partition | partition
|
| SCP::URLSuffix | URL suffix
|
| SCP::NoValue | No value
|
Conditions:
IsProd: !Equals [!Ref EnvName, prod]
Resources:
Vpc:
Type: SCP::VPC::Vpc
Properties:
Name: !Sub '${SCP::StackName}-vpc'
Cidrs: ['10.0.0.0/16']
PublicIp:
Type: SCP::VPC::PublicIp
Properties:
Type: IGW
Zone: 'kr-west1-a'
Description: !If [IsProd, 'Production environment Public IP', !Ref SCP::NoValue]Conditions:
IsProd: !Equals [!Ref EnvName, prod]
Resources:
Vpc:
Type: SCP::VPC::Vpc
Properties:
Name: !Sub '${SCP::StackName}-vpc'
Cidrs: ['10.0.0.0/16']
PublicIp:
Type: SCP::VPC::PublicIp
Properties:
Type: IGW
Zone: 'kr-west1-a'
Description: !If [IsProd, 'Production environment Public IP', !Ref SCP::NoValue]In the above example, the Vpc resource name is specified by appending -vpc to the stack name. The Description of the PublicIp resource is set only when the IsProd condition is true.
Template creation example
The following is an example template that includes parameters, resources, and result output. Accepts an environment name, creates a VPC and subnet, and exports the ID of the created VPC.
SCPTemplateFormatVersion: '2026-01-01'
Description: 'Template that creates VPC and Subnet'
Parameters:
EnvName:
Type: String
Default: dev
AllowedValues:
- dev
- prod
Description: 'Select the deployment environment.'
VpcCidr:
Type: String
Default: '10.0.0.0/16'
Description: 'Enter the VPC IP range (CIDR).'
SubnetCidr:
Type: String
Default: '10.0.1.0/24'
Description: 'Enter the IP range (CIDR) of the Subnet.' (within VPC CIDR range)
Resources:
Vpc:
Type: SCP::VPC::Vpc
Properties:
Name: !Sub '${EnvName}-vpc'
Cidrs: [!Ref VpcCidr]
Subnet:
Type: SCP::VPC::Subnet
Properties:
Name: !Sub '${EnvName}-subnet'
VpcId: !Ref Vpc
Cidr: !Ref SubnetCidr
Type: PRIVATE
Category: PRIMARY
Outputs:
VpcId:
Description: 'The ID of the created VPC.'
Value: !Ref Vpc
Export:
Name: !Sub '${EnvName}-VpcId'
SubnetId:
Description: 'The ID of the created Subnet.'
Value: !Ref SubnetSCPTemplateFormatVersion: '2026-01-01'
Description: 'Template that creates VPC and Subnet'
Parameters:
EnvName:
Type: String
Default: dev
AllowedValues:
- dev
- prod
Description: 'Select the deployment environment.'
VpcCidr:
Type: String
Default: '10.0.0.0/16'
Description: 'Enter the VPC IP range (CIDR).'
SubnetCidr:
Type: String
Default: '10.0.1.0/24'
Description: 'Enter the IP range (CIDR) of the Subnet.' (within VPC CIDR range)
Resources:
Vpc:
Type: SCP::VPC::Vpc
Properties:
Name: !Sub '${EnvName}-vpc'
Cidrs: [!Ref VpcCidr]
Subnet:
Type: SCP::VPC::Subnet
Properties:
Name: !Sub '${EnvName}-subnet'
VpcId: !Ref Vpc
Cidr: !Ref SubnetCidr
Type: PRIVATE
Category: PRIMARY
Outputs:
VpcId:
Description: 'The ID of the created VPC.'
Value: !Ref Vpc
Export:
Name: !Sub '${EnvName}-VpcId'
SubnetId:
Description: 'The ID of the created Subnet.'
Value: !Ref Subnet{
"SCPTemplateFormatVersion": "2026-01-01",
"Description": "Template for creating VPC and Subnet",
"Parameters": {
"EnvName": {
"Type": "String",
"Default": "dev"
"AllowedValues": ["dev", "prod"],
"Description": "Select the deployment environment."
},
"VpcCidr": {
"Type": "String",
"Default": "10.0.0.0/16",
"Description": "Enter the VPC's IP range (CIDR)."
},
"SubnetCidr": {
"Type": "String",
"Default": "10.0.1.0/24",
"Description": "Enter the IP range (CIDR) of the Subnet." (within the VPC CIDR range)
}
},
"Resources": {
"Vpc": {
"Type": "SCP::VPC::Vpc"
"Properties": {
"Name": { "Fn::Sub": "${EnvName}-vpc" },
"Cidrs": [{ "Ref": "VpcCidr" }]
}
},
"Subnet": {
"Type": "SCP::VPC::Subnet",
"Properties": {
"Name": { "Fn::Sub": "${EnvName}-subnet" },
"VpcId": { "Ref": "Vpc" },
"Cidr": { "Ref": "SubnetCidr" },
"Type": "PRIVATE"
"Category": "PRIMARY"
}
}
},
"Outputs": {
"VpcId": {
"Description": "The ID of the created VPC.",
"Value": { "Ref": "Vpc" },
"Export": {
"Name": { "Fn::Sub": "${EnvName}-VpcId" }
}
},
"SubnetId": {
"Description": "The ID of the created Subnet."
"Value": { "Ref": "Subnet" }
}
}
}{
"SCPTemplateFormatVersion": "2026-01-01",
"Description": "Template for creating VPC and Subnet",
"Parameters": {
"EnvName": {
"Type": "String",
"Default": "dev"
"AllowedValues": ["dev", "prod"],
"Description": "Select the deployment environment."
},
"VpcCidr": {
"Type": "String",
"Default": "10.0.0.0/16",
"Description": "Enter the VPC's IP range (CIDR)."
},
"SubnetCidr": {
"Type": "String",
"Default": "10.0.1.0/24",
"Description": "Enter the IP range (CIDR) of the Subnet." (within the VPC CIDR range)
}
},
"Resources": {
"Vpc": {
"Type": "SCP::VPC::Vpc"
"Properties": {
"Name": { "Fn::Sub": "${EnvName}-vpc" },
"Cidrs": [{ "Ref": "VpcCidr" }]
}
},
"Subnet": {
"Type": "SCP::VPC::Subnet",
"Properties": {
"Name": { "Fn::Sub": "${EnvName}-subnet" },
"VpcId": { "Ref": "Vpc" },
"Cidr": { "Ref": "SubnetCidr" },
"Type": "PRIVATE"
"Category": "PRIMARY"
}
}
},
"Outputs": {
"VpcId": {
"Description": "The ID of the created VPC.",
"Value": { "Ref": "Vpc" },
"Export": {
"Name": { "Fn::Sub": "${EnvName}-VpcId" }
}
},
"SubnetId": {
"Description": "The ID of the created Subnet."
"Value": { "Ref": "Subnet" }
}
}
}Template limit
Check the following limits when creating a template.
| Category | Limit |
|---|---|
| Description(Description) size | 1,024 bytes or less |
| Number of resources | Up to 500 per template |
| Logical ID length | Maximum 255 characters |
| Number of parameters | Up to 200 per template |
| Parameter value size | 4,096 bytes or less |
| Result count | Up to 200 per template |
| Export | Export name up to 255 characters, value up to 1,024 characters |
| Number of mappings | Up to 200 per template
|
| Template size | 51,200 bytes or less
|
| Nested stack depth | Maximum 5 steps |
Please refer to the Constraints for all constraints.
Create Template
You can create it after directly writing and reviewing the template in the console. The created template is stored in the Object Storage bucket ib-templates-{random 12-character string}-{region}. For more details, please refer to 템플릿 저장 위치.
To create a template, follow these steps.
- All Services > Management > Infrastructure Builder Click the menu. Navigate to the Service Home page.
- Service Home page, click the Stack > Stack List menu. Navigate to the Stack List page.
- Click the Create Template button on the Stack List page. Go to the Create Template page.
- Template Creation page, select the code type and then write the template code.
- You can choose YAML (default) or JSON.
- Click the code type button to check for errors in the written code. If there are no errors, convert the existing code to the selected type; if there are errors, display the error message.
- Click the Review button to verify the template’s syntax and structure.
- The Review button is enabled only when code has been entered.
- If there is an error, check the error message and modify the template.
- If there are no errors, a message indicating that the template is valid is displayed and the Create button is enabled.
- Click the Create button. A confirmation popup is displayed.
- In the popup, click the Confirm button. The template is created, and the template’s Object Storage URL is displayed in the top flash bar.
- If creation fails, the current screen remains and an error message is displayed.
- If you do not click the Create button, the template will not be saved.
- The template size can be up to 51,200 bytes.
- If you do not have permission to create the Object Storage bucket to store the template, template creation will fail. For more details, please refer to 템플릿 저장 위치.
- Refer to Template Writing for guidance and examples on writing each section of the template. Refer to the Template Reference for available resource types and properties.
Configure a Nested Stack Template
If the template becomes large and difficult to manage, you can separate it by functional units and configure it as a nested stack.
To configure a nested stack, follow these steps.
- Create sub-templates separated by functional units.
- Define the value to be passed to the upper stack as the result output.
- Define the value received from the upper stack as a parameter.
- Save each created sub-template to Object Storage.
- Create a root template that calls a subtemplate.
- Define the substack as a
SCP::InfrastructureBuilder::Stackresource. - Specify the URL of the subtemplate and pass the required values as parameters.
- Referencing the output of a child stack automatically determines the creation order between stacks.
- Define the substack as a
- After storing the root template in Object Storage, create a stack using that template.
The SCP::InfrastructureBuilder::Stack resource can specify the following properties.
| attribute | Explanation |
|---|---|
| TemplateURL | Object Storage URL where the sub‑template is stored |
| Parameters | Value to pass to the subtemplate’s parameter |
| TimeoutInMinutes | Substack task timeout (minutes) |
Resources:
NetworkStack:
Type: SCP::InfrastructureBuilder::Stack
Properties:
TemplateURL: '<네트워크 템플릿의 Object Storage URL>'
Parameters:
VpcCidr: '10.0.0.0/16'
TimeoutInMinutes: 30
AppStack:
Type: SCP::InfrastructureBuilder::Stack
Properties:
TemplateURL: '<애플리케이션 템플릿의 Object Storage URL>'
Parameters:
VpcId: !GetAtt NetworkStack.Outputs.VpcIdResources:
NetworkStack:
Type: SCP::InfrastructureBuilder::Stack
Properties:
TemplateURL: '<네트워크 템플릿의 Object Storage URL>'
Parameters:
VpcCidr: '10.0.0.0/16'
TimeoutInMinutes: 30
AppStack:
Type: SCP::InfrastructureBuilder::Stack
Properties:
TemplateURL: '<애플리케이션 템플릿의 Object Storage URL>'
Parameters:
VpcId: !GetAtt NetworkStack.Outputs.VpcIdThe result outputs of a nested stack are referenced in the !GetAtt LogicalID.Outputs.OutputName format. You can also write it in list format, like !GetAtt [LogicalID, 'Outputs.OutputName'].
In the above example, AppStack receives NetworkStack’s output (VpcId) as a parameter, so it is created after NetworkStack is created. The result outputs of a child stack can also be referenced in the root template’s result outputs (Outputs).
- The name of a child stack is automatically generated in the
{parent stack name}-{logical ID}-{8-character random identifier}format. - Subtemplates are also validated in the same way as the parent template when creating a stack.
- You can define up to 2,500 resources across the entire nested stack hierarchy, and up to 500 per template.
For detailed information about nested stack configuration, please refer to Nested Stack. For an example of creating multiple Virtual Servers with a nested stack, refer to the Create Multiple Virtual Servers at Once (Nested Stack) sample.