# SCP::VPC::PublicIp

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

---

```
SCP::VPC::PublicIp
```





## Description
A public IP address resource in the VPC service.

## Version
`1.3.0`

## Syntax

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

**JSON**
```json
{
  "Type" : "SCP::VPC::PublicIp",
  "Properties" : {
    "Type" : "String",
    "Zone" : "String",
    "Description" : "String"
  }
}

```

**YAML**
```yaml
Type: SCP::VPC::PublicIp
Properties:
  Type: String
  Zone: String
  Description: String

```

## Properties


### Type

The type of the public IP.

| Attribute | Value |
|-----------|-------|
| **Required** | Yes |
| **Type** | String |
| **Allowed values** | IGW \| GGW \| SIGW |
| **Update requires** | Replacement |






### Zone

The zone where the public IP is located.

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






### Description

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

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







## 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 |
|-----------|-------------|
| **Type** | The type of the public IP. |
| **Zone** | The zone where the public IP is located. |
| **Description** | A brief explanation or note about this resource that identifies the purpose or usage of the resource, up to 50 characters. |
| **IpAddress** | The IP address assigned to the resource. |
| **AccountId** | The identifier of the account that owns the public IP. |
| **AttachedResourceType** | The type of the resource that this public IP is attached to. |
| **AttachedResourceName** | The name of the resource that this public IP is attached to. |
| **AttachedResourceId** | The identifier of the resource that this public IP is attached to. |
| **State** | The current lifecycle state of the public IP. |


## Sample Template

### Create a Public IP and attach it to a virtual server
Creates a Public IP and attaches it to a virtual server's network

```yaml
SCPTemplateFormatVersion: '2026-01-01'
Description: '공인 IP(PublicIp)를 생성하여 가상 서버에 연결하는 템플릿'
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 범위 내)'
  ServerName:
    Type: String
    Default: 'sample-server'
    MinLength: 1
    MaxLength: 63
    AllowedPattern: '^[a-zA-Z0-9-_ ]*$'
    Description: '가상 서버 이름을 입력하세요. (1~63자, 영문/숫자/하이픈/언더스코어/공백 허용)'
  ImageId:
    Type: String
    MinLength: 1
    Description: '가상 서버에 사용할 표준(공용) 이미지 ID를 입력하세요. (플랫폼의 표준 이미지 목록(가상 서버 서비스 콘솔의 이미지 화면)에서 ID 확인, 필수)'
  KeypairName:
    Type: String
    MinLength: 1
    Description: 'SSH 접속에 사용할 키페어 이름을 입력하세요. (필수)'
  ServerTypeId:
    Type: String
    Default: 's1v1m2'
    Description: '가상 서버 타입 ID를 입력하세요. (예: s1v1m2. ※ 예시 값 - 리전/이미지에 맞는 타입으로 수정)'
  Zone:
    Type: String
    Default: 'kr-west1-a'
    Description: '가상 서버와 공인 IP가 생성될 존을 입력하세요. (예: kr-west1-a. ※ 예시 값 - 리전에 맞는 존으로 수정)'
  PublicIpType:
    Type: String
    Default: 'IGW'
    AllowedValues:
      - IGW
      - GGW
      - SIGW
    Description: '공인 IP 타입을 선택하세요. (IGW/GGW/SIGW. GGW는 Samsung SCP, SIGW는 Enterprise SCP 전용)'

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: PUBLIC
      Category: PRIMARY
  MyPublicIp:
    Type: SCP::VPC::PublicIp
    DependsOn: MyInternetGateway
    Properties:
      Type: !Ref PublicIpType
      Zone: !Ref Zone
  MyInternetGateway:
    Type: SCP::VPC::InternetGateway
    Properties:
      Type: !Ref PublicIpType
      VpcId: !Ref MyVpc
  MyServer:
    Type: SCP::VirtualServer::VirtualServer
    Properties:
      Name: !Ref ServerName
      ImageId: !Ref ImageId
      KeypairName: !Ref KeypairName
      ServerTypeId: !Ref ServerTypeId
      Zone: !Ref Zone
      Networks:
        - SubnetId: !Ref MySubnet
          PublicIpId: !Ref MyPublicIp
      BootVolume:
        Size: 40
        Type: SSD

Outputs:
  ServerId:
    Description: "생성된 가상 서버의 ID입니다."
    Value: !Ref MyServer
  PublicIpId:
    Description: "생성된 공인 IP의 ID입니다."
    Value: !Ref MyPublicIp

```
