1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. ens
  5. EipInstanceAttachment
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.ens.EipInstanceAttachment

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    Provides a Ens Eip Instance Attachment resource.

    Bind an EIP to an instance.

    For information about Ens Eip Instance Attachment and how to use it, see What is Eip Instance Attachment.

    NOTE: Available since v1.227.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const ensRegionId = config.get("ensRegionId") || "cn-chenzhou-telecom_unicom_cmcc";
    const defaultXKjq1W = new alicloud.ens.Instance("defaultXKjq1W", {
        systemDisk: {
            size: 20,
            category: "cloud_efficiency",
        },
        schedulingStrategy: "Concentrate",
        scheduleAreaLevel: "Region",
        imageId: "centos_6_08_64_20G_alibase_20171208",
        paymentType: "Subscription",
        instanceType: "ens.sn1.stiny",
        password: "12345678abcABC",
        status: "Running",
        amount: 1,
        internetChargeType: "95BandwidthByMonth",
        instanceName: name,
        autoUseCoupon: "true",
        instanceChargeStrategy: "PriceHighPriority",
        ensRegionId: ensRegionId,
        periodUnit: "Month",
    });
    const defaultsGsN4e = new alicloud.ens.Eip("defaultsGsN4e", {
        bandwidth: 5,
        eipName: name,
        ensRegionId: ensRegionId,
        internetChargeType: "95BandwidthByMonth",
        paymentType: "PayAsYouGo",
    });
    const _default = new alicloud.ens.EipInstanceAttachment("default", {
        instanceId: defaultXKjq1W.id,
        allocationId: defaultsGsN4e.id,
        instanceType: "EnsInstance",
        standby: false,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    ens_region_id = config.get("ensRegionId")
    if ens_region_id is None:
        ens_region_id = "cn-chenzhou-telecom_unicom_cmcc"
    default_x_kjq1_w = alicloud.ens.Instance("defaultXKjq1W",
        system_disk={
            "size": 20,
            "category": "cloud_efficiency",
        },
        scheduling_strategy="Concentrate",
        schedule_area_level="Region",
        image_id="centos_6_08_64_20G_alibase_20171208",
        payment_type="Subscription",
        instance_type="ens.sn1.stiny",
        password="12345678abcABC",
        status="Running",
        amount=1,
        internet_charge_type="95BandwidthByMonth",
        instance_name=name,
        auto_use_coupon="true",
        instance_charge_strategy="PriceHighPriority",
        ens_region_id=ens_region_id,
        period_unit="Month")
    defaults_gs_n4e = alicloud.ens.Eip("defaultsGsN4e",
        bandwidth=5,
        eip_name=name,
        ens_region_id=ens_region_id,
        internet_charge_type="95BandwidthByMonth",
        payment_type="PayAsYouGo")
    default = alicloud.ens.EipInstanceAttachment("default",
        instance_id=default_x_kjq1_w.id,
        allocation_id=defaults_gs_n4e.id,
        instance_type="EnsInstance",
        standby=False)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ens"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		ensRegionId := "cn-chenzhou-telecom_unicom_cmcc"
    		if param := cfg.Get("ensRegionId"); param != "" {
    			ensRegionId = param
    		}
    		defaultXKjq1W, err := ens.NewInstance(ctx, "defaultXKjq1W", &ens.InstanceArgs{
    			SystemDisk: &ens.InstanceSystemDiskArgs{
    				Size:     pulumi.Int(20),
    				Category: pulumi.String("cloud_efficiency"),
    			},
    			SchedulingStrategy:     pulumi.String("Concentrate"),
    			ScheduleAreaLevel:      pulumi.String("Region"),
    			ImageId:                pulumi.String("centos_6_08_64_20G_alibase_20171208"),
    			PaymentType:            pulumi.String("Subscription"),
    			InstanceType:           pulumi.String("ens.sn1.stiny"),
    			Password:               pulumi.String("12345678abcABC"),
    			Status:                 pulumi.String("Running"),
    			Amount:                 pulumi.Int(1),
    			InternetChargeType:     pulumi.String("95BandwidthByMonth"),
    			InstanceName:           pulumi.String(name),
    			AutoUseCoupon:          pulumi.String("true"),
    			InstanceChargeStrategy: pulumi.String("PriceHighPriority"),
    			EnsRegionId:            pulumi.String(ensRegionId),
    			PeriodUnit:             pulumi.String("Month"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultsGsN4e, err := ens.NewEip(ctx, "defaultsGsN4e", &ens.EipArgs{
    			Bandwidth:          pulumi.Int(5),
    			EipName:            pulumi.String(name),
    			EnsRegionId:        pulumi.String(ensRegionId),
    			InternetChargeType: pulumi.String("95BandwidthByMonth"),
    			PaymentType:        pulumi.String("PayAsYouGo"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ens.NewEipInstanceAttachment(ctx, "default", &ens.EipInstanceAttachmentArgs{
    			InstanceId:   defaultXKjq1W.ID(),
    			AllocationId: defaultsGsN4e.ID(),
    			InstanceType: pulumi.String("EnsInstance"),
    			Standby:      pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var ensRegionId = config.Get("ensRegionId") ?? "cn-chenzhou-telecom_unicom_cmcc";
        var defaultXKjq1W = new AliCloud.Ens.Instance("defaultXKjq1W", new()
        {
            SystemDisk = new AliCloud.Ens.Inputs.InstanceSystemDiskArgs
            {
                Size = 20,
                Category = "cloud_efficiency",
            },
            SchedulingStrategy = "Concentrate",
            ScheduleAreaLevel = "Region",
            ImageId = "centos_6_08_64_20G_alibase_20171208",
            PaymentType = "Subscription",
            InstanceType = "ens.sn1.stiny",
            Password = "12345678abcABC",
            Status = "Running",
            Amount = 1,
            InternetChargeType = "95BandwidthByMonth",
            InstanceName = name,
            AutoUseCoupon = "true",
            InstanceChargeStrategy = "PriceHighPriority",
            EnsRegionId = ensRegionId,
            PeriodUnit = "Month",
        });
    
        var defaultsGsN4e = new AliCloud.Ens.Eip("defaultsGsN4e", new()
        {
            Bandwidth = 5,
            EipName = name,
            EnsRegionId = ensRegionId,
            InternetChargeType = "95BandwidthByMonth",
            PaymentType = "PayAsYouGo",
        });
    
        var @default = new AliCloud.Ens.EipInstanceAttachment("default", new()
        {
            InstanceId = defaultXKjq1W.Id,
            AllocationId = defaultsGsN4e.Id,
            InstanceType = "EnsInstance",
            Standby = false,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ens.Instance;
    import com.pulumi.alicloud.ens.InstanceArgs;
    import com.pulumi.alicloud.ens.inputs.InstanceSystemDiskArgs;
    import com.pulumi.alicloud.ens.Eip;
    import com.pulumi.alicloud.ens.EipArgs;
    import com.pulumi.alicloud.ens.EipInstanceAttachment;
    import com.pulumi.alicloud.ens.EipInstanceAttachmentArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            final var ensRegionId = config.get("ensRegionId").orElse("cn-chenzhou-telecom_unicom_cmcc");
            var defaultXKjq1W = new Instance("defaultXKjq1W", InstanceArgs.builder()
                .systemDisk(InstanceSystemDiskArgs.builder()
                    .size("20")
                    .category("cloud_efficiency")
                    .build())
                .schedulingStrategy("Concentrate")
                .scheduleAreaLevel("Region")
                .imageId("centos_6_08_64_20G_alibase_20171208")
                .paymentType("Subscription")
                .instanceType("ens.sn1.stiny")
                .password("12345678abcABC")
                .status("Running")
                .amount("1")
                .internetChargeType("95BandwidthByMonth")
                .instanceName(name)
                .autoUseCoupon("true")
                .instanceChargeStrategy("PriceHighPriority")
                .ensRegionId(ensRegionId)
                .periodUnit("Month")
                .build());
    
            var defaultsGsN4e = new Eip("defaultsGsN4e", EipArgs.builder()
                .bandwidth("5")
                .eipName(name)
                .ensRegionId(ensRegionId)
                .internetChargeType("95BandwidthByMonth")
                .paymentType("PayAsYouGo")
                .build());
    
            var default_ = new EipInstanceAttachment("default", EipInstanceAttachmentArgs.builder()
                .instanceId(defaultXKjq1W.id())
                .allocationId(defaultsGsN4e.id())
                .instanceType("EnsInstance")
                .standby("false")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
      ensRegionId:
        type: string
        default: cn-chenzhou-telecom_unicom_cmcc
    resources:
      defaultXKjq1W:
        type: alicloud:ens:Instance
        properties:
          systemDisk:
            size: '20'
            category: cloud_efficiency
          schedulingStrategy: Concentrate
          scheduleAreaLevel: Region
          imageId: centos_6_08_64_20G_alibase_20171208
          paymentType: Subscription
          instanceType: ens.sn1.stiny
          password: 12345678abcABC
          status: Running
          amount: '1'
          internetChargeType: 95BandwidthByMonth
          instanceName: ${name}
          autoUseCoupon: 'true'
          instanceChargeStrategy: PriceHighPriority
          ensRegionId: ${ensRegionId}
          periodUnit: Month
      defaultsGsN4e:
        type: alicloud:ens:Eip
        properties:
          bandwidth: '5'
          eipName: ${name}
          ensRegionId: ${ensRegionId}
          internetChargeType: 95BandwidthByMonth
          paymentType: PayAsYouGo
      default:
        type: alicloud:ens:EipInstanceAttachment
        properties:
          instanceId: ${defaultXKjq1W.id}
          allocationId: ${defaultsGsN4e.id}
          instanceType: EnsInstance
          standby: 'false'
    

    Create EipInstanceAttachment Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new EipInstanceAttachment(name: string, args: EipInstanceAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def EipInstanceAttachment(resource_name: str,
                              args: EipInstanceAttachmentArgs,
                              opts: Optional[ResourceOptions] = None)
    
    @overload
    def EipInstanceAttachment(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              allocation_id: Optional[str] = None,
                              instance_id: Optional[str] = None,
                              instance_type: Optional[str] = None,
                              standby: Optional[bool] = None)
    func NewEipInstanceAttachment(ctx *Context, name string, args EipInstanceAttachmentArgs, opts ...ResourceOption) (*EipInstanceAttachment, error)
    public EipInstanceAttachment(string name, EipInstanceAttachmentArgs args, CustomResourceOptions? opts = null)
    public EipInstanceAttachment(String name, EipInstanceAttachmentArgs args)
    public EipInstanceAttachment(String name, EipInstanceAttachmentArgs args, CustomResourceOptions options)
    
    type: alicloud:ens:EipInstanceAttachment
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args EipInstanceAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args EipInstanceAttachmentArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args EipInstanceAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EipInstanceAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EipInstanceAttachmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var eipInstanceAttachmentResource = new AliCloud.Ens.EipInstanceAttachment("eipInstanceAttachmentResource", new()
    {
        AllocationId = "string",
        InstanceId = "string",
        InstanceType = "string",
        Standby = false,
    });
    
    example, err := ens.NewEipInstanceAttachment(ctx, "eipInstanceAttachmentResource", &ens.EipInstanceAttachmentArgs{
    	AllocationId: pulumi.String("string"),
    	InstanceId:   pulumi.String("string"),
    	InstanceType: pulumi.String("string"),
    	Standby:      pulumi.Bool(false),
    })
    
    var eipInstanceAttachmentResource = new EipInstanceAttachment("eipInstanceAttachmentResource", EipInstanceAttachmentArgs.builder()
        .allocationId("string")
        .instanceId("string")
        .instanceType("string")
        .standby(false)
        .build());
    
    eip_instance_attachment_resource = alicloud.ens.EipInstanceAttachment("eipInstanceAttachmentResource",
        allocation_id="string",
        instance_id="string",
        instance_type="string",
        standby=False)
    
    const eipInstanceAttachmentResource = new alicloud.ens.EipInstanceAttachment("eipInstanceAttachmentResource", {
        allocationId: "string",
        instanceId: "string",
        instanceType: "string",
        standby: false,
    });
    
    type: alicloud:ens:EipInstanceAttachment
    properties:
        allocationId: string
        instanceId: string
        instanceType: string
        standby: false
    

    EipInstanceAttachment Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The EipInstanceAttachment resource accepts the following input properties:

    AllocationId string
    The first ID of the resource
    InstanceId string
    Instance ID
    InstanceType string
    The type of the EIP instance. Value:

    • Nat:NAT gateway.
    • SlbInstance: Server Load Balancer (ELB).
    • NetworkInterface: Secondary ENI.
    • EnsInstance (default): The ENS instance.
    Standby bool
    Indicates whether the EIP is a backup EIP. Value:

    • true: Spare.
    • false: not standby.
    AllocationId string
    The first ID of the resource
    InstanceId string
    Instance ID
    InstanceType string
    The type of the EIP instance. Value:

    • Nat:NAT gateway.
    • SlbInstance: Server Load Balancer (ELB).
    • NetworkInterface: Secondary ENI.
    • EnsInstance (default): The ENS instance.
    Standby bool
    Indicates whether the EIP is a backup EIP. Value:

    • true: Spare.
    • false: not standby.
    allocationId String
    The first ID of the resource
    instanceId String
    Instance ID
    instanceType String
    The type of the EIP instance. Value:

    • Nat:NAT gateway.
    • SlbInstance: Server Load Balancer (ELB).
    • NetworkInterface: Secondary ENI.
    • EnsInstance (default): The ENS instance.
    standby Boolean
    Indicates whether the EIP is a backup EIP. Value:

    • true: Spare.
    • false: not standby.
    allocationId string
    The first ID of the resource
    instanceId string
    Instance ID
    instanceType string
    The type of the EIP instance. Value:

    • Nat:NAT gateway.
    • SlbInstance: Server Load Balancer (ELB).
    • NetworkInterface: Secondary ENI.
    • EnsInstance (default): The ENS instance.
    standby boolean
    Indicates whether the EIP is a backup EIP. Value:

    • true: Spare.
    • false: not standby.
    allocation_id str
    The first ID of the resource
    instance_id str
    Instance ID
    instance_type str
    The type of the EIP instance. Value:

    • Nat:NAT gateway.
    • SlbInstance: Server Load Balancer (ELB).
    • NetworkInterface: Secondary ENI.
    • EnsInstance (default): The ENS instance.
    standby bool
    Indicates whether the EIP is a backup EIP. Value:

    • true: Spare.
    • false: not standby.
    allocationId String
    The first ID of the resource
    instanceId String
    Instance ID
    instanceType String
    The type of the EIP instance. Value:

    • Nat:NAT gateway.
    • SlbInstance: Server Load Balancer (ELB).
    • NetworkInterface: Secondary ENI.
    • EnsInstance (default): The ENS instance.
    standby Boolean
    Indicates whether the EIP is a backup EIP. Value:

    • true: Spare.
    • false: not standby.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the EipInstanceAttachment resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the EIP.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the EIP.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the EIP.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The status of the EIP.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The status of the EIP.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the EIP.

    Look up Existing EipInstanceAttachment Resource

    Get an existing EipInstanceAttachment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: EipInstanceAttachmentState, opts?: CustomResourceOptions): EipInstanceAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            allocation_id: Optional[str] = None,
            instance_id: Optional[str] = None,
            instance_type: Optional[str] = None,
            standby: Optional[bool] = None,
            status: Optional[str] = None) -> EipInstanceAttachment
    func GetEipInstanceAttachment(ctx *Context, name string, id IDInput, state *EipInstanceAttachmentState, opts ...ResourceOption) (*EipInstanceAttachment, error)
    public static EipInstanceAttachment Get(string name, Input<string> id, EipInstanceAttachmentState? state, CustomResourceOptions? opts = null)
    public static EipInstanceAttachment get(String name, Output<String> id, EipInstanceAttachmentState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    AllocationId string
    The first ID of the resource
    InstanceId string
    Instance ID
    InstanceType string
    The type of the EIP instance. Value:

    • Nat:NAT gateway.
    • SlbInstance: Server Load Balancer (ELB).
    • NetworkInterface: Secondary ENI.
    • EnsInstance (default): The ENS instance.
    Standby bool
    Indicates whether the EIP is a backup EIP. Value:

    • true: Spare.
    • false: not standby.
    Status string
    The status of the EIP.
    AllocationId string
    The first ID of the resource
    InstanceId string
    Instance ID
    InstanceType string
    The type of the EIP instance. Value:

    • Nat:NAT gateway.
    • SlbInstance: Server Load Balancer (ELB).
    • NetworkInterface: Secondary ENI.
    • EnsInstance (default): The ENS instance.
    Standby bool
    Indicates whether the EIP is a backup EIP. Value:

    • true: Spare.
    • false: not standby.
    Status string
    The status of the EIP.
    allocationId String
    The first ID of the resource
    instanceId String
    Instance ID
    instanceType String
    The type of the EIP instance. Value:

    • Nat:NAT gateway.
    • SlbInstance: Server Load Balancer (ELB).
    • NetworkInterface: Secondary ENI.
    • EnsInstance (default): The ENS instance.
    standby Boolean
    Indicates whether the EIP is a backup EIP. Value:

    • true: Spare.
    • false: not standby.
    status String
    The status of the EIP.
    allocationId string
    The first ID of the resource
    instanceId string
    Instance ID
    instanceType string
    The type of the EIP instance. Value:

    • Nat:NAT gateway.
    • SlbInstance: Server Load Balancer (ELB).
    • NetworkInterface: Secondary ENI.
    • EnsInstance (default): The ENS instance.
    standby boolean
    Indicates whether the EIP is a backup EIP. Value:

    • true: Spare.
    • false: not standby.
    status string
    The status of the EIP.
    allocation_id str
    The first ID of the resource
    instance_id str
    Instance ID
    instance_type str
    The type of the EIP instance. Value:

    • Nat:NAT gateway.
    • SlbInstance: Server Load Balancer (ELB).
    • NetworkInterface: Secondary ENI.
    • EnsInstance (default): The ENS instance.
    standby bool
    Indicates whether the EIP is a backup EIP. Value:

    • true: Spare.
    • false: not standby.
    status str
    The status of the EIP.
    allocationId String
    The first ID of the resource
    instanceId String
    Instance ID
    instanceType String
    The type of the EIP instance. Value:

    • Nat:NAT gateway.
    • SlbInstance: Server Load Balancer (ELB).
    • NetworkInterface: Secondary ENI.
    • EnsInstance (default): The ENS instance.
    standby Boolean
    Indicates whether the EIP is a backup EIP. Value:

    • true: Spare.
    • false: not standby.
    status String
    The status of the EIP.

    Import

    Ens Eip Instance Attachment can be imported using the id, e.g.

    $ pulumi import alicloud:ens/eipInstanceAttachment:EipInstanceAttachment example <allocation_id>:<instance_id>:<instance_type>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi