

# Create a self-hosted SiteWise Edge gateway
<a name="create-gateway-ggv2"></a>

Use the Amazon IoT SiteWise console or Amazon CLI to create a self-hosted SiteWise Edge gateway. This procedure details how to create a self-hosted SiteWise Edge gateway that you'll install on your own hardware. For information about creating a SiteWise Edge gateway that runs on Siemens Industrial Edge, see [Host a SiteWise Edge gateway on Siemens Industrial Edge](sitewise-edge-on-siemens.md).

## Create a SiteWise Edge gateway
<a name="configure-gateway-console"></a>

------
#### [ Console ]

1. <a name="sitewise-open-console"></a>Navigate to the [Amazon IoT SiteWise console](https://console.amazonaws.cn/iotsitewise/).

1. In the navigation pane, choose **Edge gateways**.

1. Choose **Create gateway**.

1. For **Choose deployment target**, choose **self-hosted gateway**.

1. Select either **MQTT-enabled, V3 gateway** or **Classic streams, V2 gateway**. For more information on each option, see [Self-host an Amazon IoT SiteWise Edge gateway with Amazon IoT Greengrass V2](gw-self-host-gg2.md). The MQTT-enabled, V3 gateway is recommend for it's future-ready features.

1. In the **Gateway configuration** section, enter a name for your SiteWise Edge gateway or use the name generated by Amazon IoT SiteWise.

1. Under **Greengrass device OS**, select the operating system of the device where you'll install this SiteWise Edge gateway.
**Note**  
The data processing pack is only available on x86 platforms. It is only available on the Classic streams, V2 gateway

1. (Optional) To process and organize data at the edge, under **Edge capabilities**, select **Data Processing Pack**.

1. (Optional) Under **advanced configuration**, do the following:

   1. For **Greengrass core device**, choose one of the following options:
     + **Default setup** – Amazon automatically uses default settings to create a Greengrass core device in Amazon IoT Greengrass V2.

       1. Enter a name for the Greengrass core device or use the name generated by Amazon IoT SiteWise.
     + **Advanced setup** – Choose this option if you want to use an existing Greengrass core device or to create one manually.

       1. Choose a Greengrass core device or choose **Create Greengrass core device** to create one in the Amazon IoT Greengrass V2 console. For more information, see [Setting up Amazon IoT Greengrass V2 core devices](https://docs.amazonaws.cn/greengrass/v2/developerguide/setting-up.html) in the *Amazon IoT Greengrass Version 2 Developer Guide*.

1. Choose **Create gateway**.

1. In the **Generate SiteWise Edge gateway installer** dialog box, choose **Generate and download**. Amazon IoT SiteWise automatically generates an installer that you can use to configure your local device.
**Important**  
You can't regenerate this file. Make sure that you save the installer file in a secure location because you'll use the file later.

------
#### [ Amazon CLI ]

To create a self-hosted gateway by using the Amazon CLI, provide a name for the gateway, specify the platform, and the gateway version. There are many other options that you can specify when creating a gateway. For more information, see [create-gateway](https://docs.amazonaws.cn/cli/latest/reference/iotsitewise/create-gateway.html) in the *Amazon CLI Command Reference* for Amazon IoT SiteWise

To use this example, replace the user input placeholders with your own information.

```
aws iotsitewise create-gateway \
    --gateway-name {{your-gateway-name}} \
    --gateway-platform greengrassV2={coreDeviceThingName={{your-core-device-thing-name}}, coreDeviceOperatingSystem={{LINUX_AMD64}}} \                        
    --gateway-version {{3}} \
    [--cli-input-json {{your-configuration}}]
```
+ `gateway-name` – A unique name for the gateway.
+ `gateway-platform` – Specifies the gateway platform configuration. For self-hosted gateways, enter `greengrassV2`. For more information, see [Options](https://docs.amazonaws.cn/cli/latest/reference/iotsitewise/create-gateway.html#options) in the create-gateway section of *Amazon CLI Command Reference* for Amazon IoT SiteWise.
  + `coreDeviceThingName` – The name of the Amazon IoT thing for your Amazon IoT Greengrass V2 core device.
  + `coreDeviceOperatingSystem` – The operating system of the core device in Amazon IoT Greengrass V2. Specifying the operating system is required for `gateway-version 3` and not applicable for `gateway-version 2`. Options include: `LINUX_AARCH64`, `LINUX_AMD64`, and `WINDOWS_AMD64`
+ `gateway-version` – The version of the gateway.
  + To create an MQTT-enabled, V3 gateway, use `3` for the gateway version.
  + To create a Classic streams, V2 gateway, use `2` for the gateway version.
+ `cli-input-json` – A JSON file containing request parameters.

------