Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Blog
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
Yandex project
© 2023 Intertech Services AG
Yandex Virtual Private Cloud
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Cloud network
    • Subnet
    • IP address
      • Reserving a static public IP address
      • Converting a dynamic public IP address to static
      • Converting a static public IP address to dynamic
      • Moving an address between folders
      • Deleting a static public IP address
    • Static routing
    • Security groups
    • Enable a software-accelerated network
    • DDoS protection
    • Chart of network connections
  • Practical guidelines
  • Concepts
  • DDoS Protection
  • Recommendations
  • Access management
  • Pricing policy
  • API reference
  • Questions and answers
  1. Step-by-step instructions
  2. IP address
  3. Reserving a static public IP address

Reserving a static public IP address

Written by
Yandex Cloud

    You can reserve a static public IP address to use later for accessing cloud resources.

    Note

    Pay attention to the pricing policy for inactive static public IPs.

    Management console
    CLI
    API
    Terraform

    To reserve a static public IP address:

    1. In the management console, go to the page of the folder where you want to reserve an IP address.
    2. In the list of services, select Virtual Private Cloud.
    3. On the left-hand panel, select IP addresses.
    4. Click Reserve address.
    5. In the window that opens, select the availability zone where you want to reserve the address.
    6. Click Reserve address.

    If you don't have the Yandex Cloud command line interface yet, install and initialize it.

    The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

    To reserve a static public IP address:

    1. See the description of the CLI reserve address command:

      yc vpc address create --help
      
    2. Reserve the address by specifying the availability zone:

      yc vpc address create --external-ipv4 zone=ru-central1-a
      

      Result:

      id: e9b6un9gkso6stdh6b3p
      folder_id: b1g7gvsi89m34pipa3ke
      created_at: "2021-01-19T17:52:42Z"
      external_ipv4_address:
        address: 178.154.253.52
        zone_id: ru-central1-a
        requirements: {}
      reserved: true
      

      The static public IP address is reserved.

    To reserve a static IP address, use the create REST API method for the Address resource or the AddressService/Create gRPC API call.

    With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it by configuration files. They store the infrastructure description in HashiCorp Configuration Language (HCL). Terraform and its providers are distributed under the Mozilla Public License.

    For more information about the provider resources, see the documentation on the Terraform site or mirror site.

    If you change the configuration files, Terraform automatically determines which part of your configuration is already deployed and what should be added or removed.

    If you do not have Terraform yet, install it and configure the Yandex Cloud provider.

    1. In the configuration file, describe the parameters of the resources you want to create:

      • name: Static public IP address name. Name format:

        • The length can be from 3 to 63 characters.
        • It may contain lowercase Latin letters, numbers, and hyphens.
        • The first character must be a letter. The last character can't be a hyphen.
      • external_ipv4_address: IPv4 address description:

        • zone_id: Availability zone.

      Example of the configuration file structure:

      resource "yandex_vpc_address" "addr" {
        name = "<static public IP address name>"
        external_ipv4_address {
          zone_id = "<availability zone>"
        }
      }
      

      For more information about the yandex_vpc_address resource parameters in Terraform, see the provider documentation.

    2. Make sure the configuration files are valid.

      1. In the command line, go to the directory where you created the configuration file.

      2. Run the check using this command:

        terraform plan
        

      If the configuration is described correctly, the terminal will display a list of created resources and their parameters. If the configuration contains any errors, Terraform will point them out.

    3. Deploy cloud resources.

      1. If the configuration does not contain any errors, run this command:

        terraform apply
        
      2. Confirm the resource creation: type yes in the terminal and press Enter.

        Once you are done, all the resources you need will be created in the specified folder. You can verify that the resources are there and properly configured in the management console or using the following CLI command:

        yc vpc address list
        

    Was the article helpful?

    Language / Region
    Yandex project
    © 2023 Intertech Services AG