# Adopt existing AWS instances

Studio discovers EC2 instances in the AWS Region configured for the self-hosted environment. Use AWS tags to set the name shown in Studio and the connection method available to operators.

## Apply Tags

<!-- SCREENSHOT-TODO: Capture the AWS EC2 Tags view for a controlled test instance showing the Name and access tags. -->

Tag keys and values are case-sensitive.

### `Name` tag

Use the `Name` tag to set the instance name shown in Instance Manager.

<table>
  <colgroup>
    <col style="width: 9rem; min-width: 9rem;" />
    <col style="width: 12rem; min-width: 12rem;" />
    <col />
  </colgroup>
  <thead>
    <tr>
      <th style="white-space: nowrap;">Tag key</th>
      <th style="white-space: nowrap;">Value</th>
      <th>What it means</th>
    </tr>
  </thead>
  <tbody>
    <tr><td><code>Name</code></td><td>Any descriptive name</td><td>Sets the instance name shown in Instance Manager. If this tag is absent, Studio shows the instance without a name.</td></tr>
  </tbody>
</table>

### `access` tag

:::caution[Choose exactly one access value]
Create one `access` tag and set it to exactly one of the values below. Do not add multiple `access` tags or combine choices in one value.

For example, use `access=sessionManager` or `access=none`—not `access=sessionManager,dcv`.
:::

The selected value controls the connection option Studio presents to operators. It does not install remote-access software or open security-group ports.

<table>
  <colgroup>
    <col style="width: 9rem; min-width: 9rem;" />
    <col style="width: 12rem; min-width: 12rem;" />
    <col />
  </colgroup>
  <thead>
    <tr>
      <th style="white-space: nowrap;">Tag key</th>
      <th style="white-space: nowrap;">Choose one value</th>
      <th>What it means</th>
    </tr>
  </thead>
  <tbody>
    <tr><td><code>access</code></td><td><code>sessionManager</code></td><td>Connects through the CLOUDflex session broker. Use this for a Windows instance configured with the CLOUDflex onboarding script. This is the default when the <code>access</code> tag is absent.</td></tr>
    <tr><td><code>access</code></td><td><code>dcv</code></td><td>Opens a direct NICE DCV connection to the instance on port <code>8443</code>. The instance must already have NICE DCV and the required network access configured.</td></tr>
    <tr><td><code>access</code></td><td><code>http:&lt;port&gt;</code></td><td>Opens the service on the instance's private IP address over HTTP at the specified port, for example <code>http:8080</code>. The operator must have network access to the private address.</td></tr>
    <tr><td><code>access</code></td><td><code>https:&lt;port&gt;</code></td><td>Opens the service through the instance's CLOUDflex connection hostname over HTTPS at the specified port, for example <code>https:443</code>. The service, certificate, DNS path, and network access must already be configured.</td></tr>
    <tr><td><code>access</code></td><td><code>none</code></td><td>Does not show a connection control. Studio can still display, start, stop, restart, resize, and otherwise manage the instance when the environment's AWS permissions allow those actions.</td></tr>
  </tbody>
</table>

:::caution[Check the default before adoption]
If `access` is missing, Studio treats the instance as `sessionManager`. Add `access=none` when an instance should not offer an operator connection.
:::

## Tags Created by Studio

Instances and EBS volumes created through Studio can have additional tags. You do not need to add these tags when adopting an existing instance:

| Tag key | Applied to | What it means |
| --- | --- | --- |
| `deployment-id` | EC2 instance | Links a Studio-created instance to the deployment record that created it. |
| `instance-id` | EBS volume | Records which EC2 instance a Studio-created data volume was created for. |

The `Type` tag values `FlowManager` and `Discovery` are not used by the current AWS instance discovery path. Do not add them to adopted instances.

## Configure Windows Remote Access

Run the [CLOUDflex onboarding script](https://scripts.cloudflex.studio/onboardToSessionManager.ps1) on the Windows instance to configure its Studio connection. Review scripts according to your organization's security process before running them, and test with a non-critical instance first.
