[Yandex Cloud documentation](../../../index.md) > [Yandex Cloud Functions](../../index.md) > [Step-by-step guides](../index.md) > Getting information about a function > Configuring metadata service parameters

# Configuring metadata service parameters for a function

You can configure metadata service parameters when [creating a function version](version-manage.md).

The following options are available:

* `awsV1HttpEndpoint`: Provides access to metadata using the AWS format (IMDSv1). It can be either `enabled` or `disabled`. If set to `disabled`, the metadata request will fail with the `404 Not Found` error. The default value is `disabled`.

    {% note info %}

    By default, the `awsV1HttpEndpoint` parameter is `disabled`, and we do not recommend enabling it. The IMDSv1 format comes with a number of security vulnerabilities. Its most severe flaw is the high risk of attacks, such as [SSRF](https://portswigger.net/web-security/ssrf). For more information, see the [AWS official blog](https://aws.amazon.com/blogs/security/defense-in-depth-open-firewalls-reverse-proxies-ssrf-vulnerabilities-ec2-instance-metadata-service/).

    {% endnote %}

* `gceHttpEndpoint`: Provides access to metadata using the Google Compute Engine format. It can be either `enabled` or `disabled`. If set to `disabled`, the metadata request will fail with the `404 Not Found` error. The default value is `enabled`.

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), navigate to the [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder) containing the [function](../../concepts/function.md).
  1. Navigate to **Cloud Functions**.
  1. Select the function.
  1. Navigate to the **Editor** tab.
  1. Expand **Additional settings**.
  1. Under **Metadata service parameters**, configure the parameters of the function metadata service: `Access metadata using the Google Compute Engine format` and `Access metadata using the AWS format (IMDSv1)`.
  1. Click **Save changes**.

- CLI {#cli}

  To configure metadata service parameters for a function, run this command:

  ```bash
  yc serverless function version create \
    --function-id=<function_ID> \
    --runtime <runtime> \
    --entrypoint <entry_point> \
    --source-version-id <version_ID> \
    --metadata-options <option>=<enabled_or_disabled>
  ```

  Where:

  * `--function-id`: ID of the function whose new version you want to create. To find out the function ID, [get the list of functions](function-list.md) in the folder.
  * `--runtime`: Runtime.
  * `--entrypoint`: Entry point in `<function_file_name>.<handler_name>` format.
  * `--source-version-id`: ID of the function version from which you want to copy the code. To find out the ID, [get the list of function versions](version-list.md).
  * `--metadata-options`: Settings for the metadata service parameters, e.g., `aws-v1-http-endpoint=disabled`.

- Terraform {#tf}

    With [Terraform](https://www.terraform.io/), you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
    
    Terraform is distributed under the [Business Source License](https://github.com/hashicorp/terraform/blob/main/LICENSE). The [Yandex Cloud provider for Terraform](https://github.com/yandex-cloud/terraform-provider-yandex) is distributed under the [MPL-2.0](https://www.mozilla.org/en-US/MPL/2.0/) license.
    
    For more information about the provider resources, see the guides on the [Terraform](https://www.terraform.io/docs/providers/yandex/index.html) website or [its mirror](../../../terraform/index.md).

    If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
    
    
    To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../../terraform/authentication.md) using the appropriate method.

    To configure metadata service parameters for a function:

    1. Open the Terraform configuration file and add the `metadata_options` section to the function description:
      
        ```hcl
        resource "yandex_function" "metadata_function" {
          name               = "<function_name>"
          user_hash          = "<function_hash>"
          runtime            = "<runtime>"
          entrypoint         = "<entry_point>"
          memory             = "<RAM_size>"
          execution_timeout  = "<execution_timeout>"
          service_account_id = "<service_account_ID>"
          content {
            zip_filename = "<path_to_ZIP_archive>"
          }

          metadata_options {
            metadata_options.0.gce_http_endpoint = "0_or_1_or_2"
            metadata_options.0.aws_v1_http_endpoint = "0_or_1_or_2"
          }
        }
        ```

        Where:

        * `metadata_options`: Settings for the metadata service parameters, e.g., `metadata_options.0.gce_http_endpoint = "1"`. Specify the following:
            * `0` if you want to keep the default value.
            * `1` to enable the parameter.
            * `2` to disable the parameter.

        For more on the properties of the `yandex_function` resource, see [this provider guide](../../../terraform/resources/function.md).

   1. Apply the changes:

      1. In the terminal, navigate to the configuration file directory.
      1. Make sure the configuration is correct using this command:
      
         ```bash
         terraform validate
         ```
      
         If the configuration is valid, you will get this message:
      
         ```bash
         Success! The configuration is valid.
         ```
      
      1. Run this command:
      
         ```bash
         terraform plan
         ```
      
         You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
      1. Apply the configuration changes:
      
         ```bash
         terraform apply
         ```
      
      1. Type `yes` and press **Enter** to confirm the changes.

   You can check the function update and its new configuration using the [management console](https://console.yandex.cloud) or this [CLI](../../../cli/quickstart.md) command:

   ```bash
   yc serverless function version get <function_version_ID>
   ```

- API {#api}

  To create a function version, use the [createVersion](../../functions/api-ref/Function/createVersion.md) REST API method for the [Function](../../functions/api-ref/Function/index.md) resource or the [FunctionService/CreateVersion](../../functions/api-ref/grpc/Function/createVersion.md) gRPC API call.

{% endlist %}