Updated on 2023-12-22 GMT+08:00

Binding an EIP

Application Scenario

Purchase an EIP and bind it to the ECS.

Procedure

  1. Add the following information to the main.tf file:

    resource "huaweicloud_vpc_eip" "myeip" {
      publicip {
        type = "5_bgp"
      }
      bandwidth {
        name        = "mybandwidth"
        size        = 8
        share_type  = "PER"
        charge_mode = "traffic"
      }
    }
    
    resource "huaweicloud_compute_eip_associate" "associated" {
      public_ip   = huaweicloud_vpc_eip.myeip.address
      instance_id = huaweicloud_compute_instance.myinstance.id
    }

  2. Run terraform plan to view resources.
  3. After you confirm that the resource information is correct, run terraform apply to purchase the EIP and bind the EIP to the ECS.