Packer
    • PDF

    Packer

    • PDF

    Article Summary

    Available in Classic and VPC

    Packer is a server image creation automation tool provided in Hashicorp. You can use Packer to conveniently create server images by entering commands, unlike the previous process of manually creating server images.
    Packer is developing a customized builder in plugin format, and has a plugin exclusively for NAVER Cloud Platform. NAVER Cloud Platform users can use the exclusive plugin to easily make server images.

    Note

    Download the Packer execution files from the Packer website.

    JSON template

    To use Packer, you need a JSON file that defines the properties needed for running commands. An example of a JSON file used in NAVER Cloud Platform is as follows:

    {
      "variables": {
        "ncloud_access_key": "FRxhOQRNjKVMqIz0sRLY",
        "ncloud_secret_key": "xd6kTO5iNcLookBx0D8TDKmpLj8ikxqEhc06MQD2"
      },
      "builders": [
        {
          "type": "ncloud",
          "access_key": "{{user `ncloud_access_key`}}",
          "secret_key": "{{user `ncloud_secret_key`}}",
    
          "server_image_product_code": "SPSW0LINUX000046",
          "server_product_code": "SPSVRSSD00000002",
          "server_image_name": "packertest",
          "server_image_description": "server image description",
          "region": "Korea"
        }
      ]
    }
    

    For descriptions for each item, see the builder webpage for NAVER Cloud Platform.

    Windows server image requirements

    The code that must be included when you create a Windows server image is as follows:

      "builders": [
        {
          "type": "ncloud",
          ...
          "user_data":
            "CreateObject(\"WScript.Shell\").run(\"cmd.exe /c powershell Set-ExecutionPolicy RemoteSigned & winrm set winrm/config/service/auth @{Basic=\"\"true\"\"} & winrm set winrm/config/service @{AllowUnencrypted=\"\"true\"\"} & winrm quickconfig -q & sc config WinRM start= auto & winrm get winrm/config/service\")",
          "communicator": "winrm",
          "winrm_username": "Administrator"
        }
      ],
      "provisioners": [
        {
          "type": "powershell",
          "inline": [
            "$Env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /shutdown /quiet /mode:vm \"/unattend:C:\\Program Files (x86)\\NBP\\nserver64.xml\" "
          ]
        }
      ]
    
    Caution
    • You can create public IP addresses up to the number of server instances you possess. Take precautions so that the number of possessed public IP addresses does not exceed the number of server instances (including those to be used for creating server images) before running Packer.
    • If you cannot proceed with the Packer process any longer due to force stopping of the Packer process or ending of the terminal program, the resources may not be organized. In this case, the user must manually organize the resources themselves.

    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.