[Yandex Cloud documentation](../../../index.md) > [Yandex Compute Cloud](../../index.md) > [Concepts](../index.md) > VM instance metadata > Accessing metadata

# Access to VM instance metadata

The [metadata service](../vm-metadata.md) allows you to [read](../../operations/vm-metadata/get-vm-metadata.md) metadata from both [outside](#external-access) and [inside](#internal-access) VM instances.

## Accessing metadata from outside the VM instance {#external-access}

You can [access](../../operations/vm-metadata/get-vm-metadata.md#external-access) VM instance metadata from the outside using the following Yandex Cloud tools: the [management console](https://console.yandex.cloud), [CLI](../../../cli/cli-ref/compute/cli-ref/instance/get.md), [Terraform](../../../tutorials/infrastructure-management/terraform-quickstart.md), and [API](../../api-ref/Instance/get.md). 

This method provides access to all metadata [folders](directories.md) as well as some keys in them: 

* In the [computeMetadata folder](directories.md#dir-compute), only the keys in `/instance/attributes/*` are readable.
* The [user-data folder](directories.md#dir-user) is fully readable.

## Accessing metadata from inside the VM instance {#external-access}

You can directly access the VM metadata from within the VM. This method provides access to [all the metadata folders](directories.md) as well as all the keys inside them.

You can get direct access (without authentication) to metadata from inside the VM through a special metadata service. The metadata service inside the VM instance is available at `http://169.254.169.254`.

All authenticated VM users can access the metadata service without any restrictions. You cannot restrict an individual VM user's access to metadata.

You can test the metadata service using [cURL](https://curl.haxx.se) by first [connecting](../../operations/vm-connect/ssh.md) to the VM via the ssh protocol:

```bash
curl \
  --header Metadata-Flavor:Google \
  169.254.169.254
```

The metadata service will respond with a list of available metadata versions, for example:

```bash
1.0
2007-01-19
2007-03-01
...
2023-02-15
2023-05-10
latest
```

We recommend always using the `latest` metadata version.

To learn more, see [Examples of requests to the metadata service from inside the VM instance](../../operations/vm-metadata/get-vm-metadata.md#request-examples).

#### See also {#see-also}

* [Getting VM instance metadata](../../operations/vm-metadata/get-vm-metadata.md)
* [VM metadata](../vm-metadata.md)
* [Metadata folders](directories.md)
* [Keys processed in public images Yandex Cloud](public-image-keys.md)
* [Transferring metadata to VM instances](sending-metadata.md)
* [Identity document](identity-document.md)