alicloud.ecs.EipAssociation
Explore with Pulumi AI
Provides a EIP Association resource.
NOTE:
alicloud.ecs.EipAssociation
is useful in scenarios where EIPs are either pre-existing or distributed to customers or users and therefore cannot be changed.
NOTE: From version 1.7.1, the resource support to associate EIP to SLB Instance or Nat Gateway.
NOTE: One EIP can only be associated with ECS or SLB instance which in the VPC.
For information about EIP Association and how to use it, see What is Association.
NOTE: Available since v1.117.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") || "tf-example";
const example = alicloud.getZones({
availableResourceCreation: "Instance",
});
const exampleGetInstanceTypes = example.then(example => alicloud.ecs.getInstanceTypes({
availabilityZone: example.zones?.[0]?.id,
cpuCoreCount: 1,
memorySize: 2,
}));
const exampleGetImages = exampleGetInstanceTypes.then(exampleGetInstanceTypes => alicloud.ecs.getImages({
nameRegex: "^ubuntu_[0-9]+_[0-9]+_x64*",
owners: "system",
instanceType: exampleGetInstanceTypes.instanceTypes?.[0]?.id,
}));
const exampleNetwork = new alicloud.vpc.Network("example", {
vpcName: name,
cidrBlock: "10.4.0.0/16",
});
const exampleSwitch = new alicloud.vpc.Switch("example", {
vswitchName: name,
cidrBlock: "10.4.0.0/24",
vpcId: exampleNetwork.id,
zoneId: example.then(example => example.zones?.[0]?.id),
});
const exampleSecurityGroup = new alicloud.ecs.SecurityGroup("example", {
name: name,
vpcId: exampleNetwork.id,
});
const exampleInstance = new alicloud.ecs.Instance("example", {
availabilityZone: example.then(example => example.zones?.[0]?.id),
instanceName: name,
imageId: exampleGetImages.then(exampleGetImages => exampleGetImages.images?.[0]?.id),
instanceType: exampleGetInstanceTypes.then(exampleGetInstanceTypes => exampleGetInstanceTypes.instanceTypes?.[0]?.id),
securityGroups: [exampleSecurityGroup.id],
vswitchId: exampleSwitch.id,
tags: {
Created: "TF",
For: "example",
},
});
const exampleEipAddress = new alicloud.ecs.EipAddress("example", {addressName: name});
const exampleEipAssociation = new alicloud.ecs.EipAssociation("example", {
allocationId: exampleEipAddress.id,
instanceId: exampleInstance.id,
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-example"
example = alicloud.get_zones(available_resource_creation="Instance")
example_get_instance_types = alicloud.ecs.get_instance_types(availability_zone=example.zones[0].id,
cpu_core_count=1,
memory_size=2)
example_get_images = alicloud.ecs.get_images(name_regex="^ubuntu_[0-9]+_[0-9]+_x64*",
owners="system",
instance_type=example_get_instance_types.instance_types[0].id)
example_network = alicloud.vpc.Network("example",
vpc_name=name,
cidr_block="10.4.0.0/16")
example_switch = alicloud.vpc.Switch("example",
vswitch_name=name,
cidr_block="10.4.0.0/24",
vpc_id=example_network.id,
zone_id=example.zones[0].id)
example_security_group = alicloud.ecs.SecurityGroup("example",
name=name,
vpc_id=example_network.id)
example_instance = alicloud.ecs.Instance("example",
availability_zone=example.zones[0].id,
instance_name=name,
image_id=example_get_images.images[0].id,
instance_type=example_get_instance_types.instance_types[0].id,
security_groups=[example_security_group.id],
vswitch_id=example_switch.id,
tags={
"Created": "TF",
"For": "example",
})
example_eip_address = alicloud.ecs.EipAddress("example", address_name=name)
example_eip_association = alicloud.ecs.EipAssociation("example",
allocation_id=example_eip_address.id,
instance_id=example_instance.id)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"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 := "tf-example"
if param := cfg.Get("name"); param != "" {
name = param
}
example, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
AvailableResourceCreation: pulumi.StringRef("Instance"),
}, nil)
if err != nil {
return err
}
exampleGetInstanceTypes, err := ecs.GetInstanceTypes(ctx, &ecs.GetInstanceTypesArgs{
AvailabilityZone: pulumi.StringRef(example.Zones[0].Id),
CpuCoreCount: pulumi.IntRef(1),
MemorySize: pulumi.Float64Ref(2),
}, nil)
if err != nil {
return err
}
exampleGetImages, err := ecs.GetImages(ctx, &ecs.GetImagesArgs{
NameRegex: pulumi.StringRef("^ubuntu_[0-9]+_[0-9]+_x64*"),
Owners: pulumi.StringRef("system"),
InstanceType: pulumi.StringRef(exampleGetInstanceTypes.InstanceTypes[0].Id),
}, nil)
if err != nil {
return err
}
exampleNetwork, err := vpc.NewNetwork(ctx, "example", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("10.4.0.0/16"),
})
if err != nil {
return err
}
exampleSwitch, err := vpc.NewSwitch(ctx, "example", &vpc.SwitchArgs{
VswitchName: pulumi.String(name),
CidrBlock: pulumi.String("10.4.0.0/24"),
VpcId: exampleNetwork.ID(),
ZoneId: pulumi.String(example.Zones[0].Id),
})
if err != nil {
return err
}
exampleSecurityGroup, err := ecs.NewSecurityGroup(ctx, "example", &ecs.SecurityGroupArgs{
Name: pulumi.String(name),
VpcId: exampleNetwork.ID(),
})
if err != nil {
return err
}
exampleInstance, err := ecs.NewInstance(ctx, "example", &ecs.InstanceArgs{
AvailabilityZone: pulumi.String(example.Zones[0].Id),
InstanceName: pulumi.String(name),
ImageId: pulumi.String(exampleGetImages.Images[0].Id),
InstanceType: pulumi.String(exampleGetInstanceTypes.InstanceTypes[0].Id),
SecurityGroups: pulumi.StringArray{
exampleSecurityGroup.ID(),
},
VswitchId: exampleSwitch.ID(),
Tags: pulumi.StringMap{
"Created": pulumi.String("TF"),
"For": pulumi.String("example"),
},
})
if err != nil {
return err
}
exampleEipAddress, err := ecs.NewEipAddress(ctx, "example", &ecs.EipAddressArgs{
AddressName: pulumi.String(name),
})
if err != nil {
return err
}
_, err = ecs.NewEipAssociation(ctx, "example", &ecs.EipAssociationArgs{
AllocationId: exampleEipAddress.ID(),
InstanceId: exampleInstance.ID(),
})
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") ?? "tf-example";
var example = AliCloud.GetZones.Invoke(new()
{
AvailableResourceCreation = "Instance",
});
var exampleGetInstanceTypes = AliCloud.Ecs.GetInstanceTypes.Invoke(new()
{
AvailabilityZone = example.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
CpuCoreCount = 1,
MemorySize = 2,
});
var exampleGetImages = AliCloud.Ecs.GetImages.Invoke(new()
{
NameRegex = "^ubuntu_[0-9]+_[0-9]+_x64*",
Owners = "system",
InstanceType = exampleGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes[0]?.Id),
});
var exampleNetwork = new AliCloud.Vpc.Network("example", new()
{
VpcName = name,
CidrBlock = "10.4.0.0/16",
});
var exampleSwitch = new AliCloud.Vpc.Switch("example", new()
{
VswitchName = name,
CidrBlock = "10.4.0.0/24",
VpcId = exampleNetwork.Id,
ZoneId = example.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
});
var exampleSecurityGroup = new AliCloud.Ecs.SecurityGroup("example", new()
{
Name = name,
VpcId = exampleNetwork.Id,
});
var exampleInstance = new AliCloud.Ecs.Instance("example", new()
{
AvailabilityZone = example.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
InstanceName = name,
ImageId = exampleGetImages.Apply(getImagesResult => getImagesResult.Images[0]?.Id),
InstanceType = exampleGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes[0]?.Id),
SecurityGroups = new[]
{
exampleSecurityGroup.Id,
},
VswitchId = exampleSwitch.Id,
Tags =
{
{ "Created", "TF" },
{ "For", "example" },
},
});
var exampleEipAddress = new AliCloud.Ecs.EipAddress("example", new()
{
AddressName = name,
});
var exampleEipAssociation = new AliCloud.Ecs.EipAssociation("example", new()
{
AllocationId = exampleEipAddress.Id,
InstanceId = exampleInstance.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
import com.pulumi.alicloud.ecs.inputs.GetImagesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.ecs.Instance;
import com.pulumi.alicloud.ecs.InstanceArgs;
import com.pulumi.alicloud.ecs.EipAddress;
import com.pulumi.alicloud.ecs.EipAddressArgs;
import com.pulumi.alicloud.ecs.EipAssociation;
import com.pulumi.alicloud.ecs.EipAssociationArgs;
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("tf-example");
final var example = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableResourceCreation("Instance")
.build());
final var exampleGetInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
.availabilityZone(example.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.cpuCoreCount(1)
.memorySize(2)
.build());
final var exampleGetImages = EcsFunctions.getImages(GetImagesArgs.builder()
.nameRegex("^ubuntu_[0-9]+_[0-9]+_x64*")
.owners("system")
.instanceType(exampleGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].id()))
.build());
var exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("10.4.0.0/16")
.build());
var exampleSwitch = new Switch("exampleSwitch", SwitchArgs.builder()
.vswitchName(name)
.cidrBlock("10.4.0.0/24")
.vpcId(exampleNetwork.id())
.zoneId(example.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.build());
var exampleSecurityGroup = new SecurityGroup("exampleSecurityGroup", SecurityGroupArgs.builder()
.name(name)
.vpcId(exampleNetwork.id())
.build());
var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
.availabilityZone(example.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.instanceName(name)
.imageId(exampleGetImages.applyValue(getImagesResult -> getImagesResult.images()[0].id()))
.instanceType(exampleGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].id()))
.securityGroups(exampleSecurityGroup.id())
.vswitchId(exampleSwitch.id())
.tags(Map.ofEntries(
Map.entry("Created", "TF"),
Map.entry("For", "example")
))
.build());
var exampleEipAddress = new EipAddress("exampleEipAddress", EipAddressArgs.builder()
.addressName(name)
.build());
var exampleEipAssociation = new EipAssociation("exampleEipAssociation", EipAssociationArgs.builder()
.allocationId(exampleEipAddress.id())
.instanceId(exampleInstance.id())
.build());
}
}
configuration:
name:
type: string
default: tf-example
resources:
exampleNetwork:
type: alicloud:vpc:Network
name: example
properties:
vpcName: ${name}
cidrBlock: 10.4.0.0/16
exampleSwitch:
type: alicloud:vpc:Switch
name: example
properties:
vswitchName: ${name}
cidrBlock: 10.4.0.0/24
vpcId: ${exampleNetwork.id}
zoneId: ${example.zones[0].id}
exampleSecurityGroup:
type: alicloud:ecs:SecurityGroup
name: example
properties:
name: ${name}
vpcId: ${exampleNetwork.id}
exampleInstance:
type: alicloud:ecs:Instance
name: example
properties:
availabilityZone: ${example.zones[0].id}
instanceName: ${name}
imageId: ${exampleGetImages.images[0].id}
instanceType: ${exampleGetInstanceTypes.instanceTypes[0].id}
securityGroups:
- ${exampleSecurityGroup.id}
vswitchId: ${exampleSwitch.id}
tags:
Created: TF
For: example
exampleEipAddress:
type: alicloud:ecs:EipAddress
name: example
properties:
addressName: ${name}
exampleEipAssociation:
type: alicloud:ecs:EipAssociation
name: example
properties:
allocationId: ${exampleEipAddress.id}
instanceId: ${exampleInstance.id}
variables:
example:
fn::invoke:
Function: alicloud:getZones
Arguments:
availableResourceCreation: Instance
exampleGetInstanceTypes:
fn::invoke:
Function: alicloud:ecs:getInstanceTypes
Arguments:
availabilityZone: ${example.zones[0].id}
cpuCoreCount: 1
memorySize: 2
exampleGetImages:
fn::invoke:
Function: alicloud:ecs:getImages
Arguments:
nameRegex: ^ubuntu_[0-9]+_[0-9]+_x64*
owners: system
instanceType: ${exampleGetInstanceTypes.instanceTypes[0].id}
Create EipAssociation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new EipAssociation(name: string, args: EipAssociationArgs, opts?: CustomResourceOptions);
@overload
def EipAssociation(resource_name: str,
args: EipAssociationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def EipAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
allocation_id: Optional[str] = None,
instance_id: Optional[str] = None,
force: Optional[bool] = None,
instance_type: Optional[str] = None,
mode: Optional[str] = None,
private_ip_address: Optional[str] = None,
vpc_id: Optional[str] = None)
func NewEipAssociation(ctx *Context, name string, args EipAssociationArgs, opts ...ResourceOption) (*EipAssociation, error)
public EipAssociation(string name, EipAssociationArgs args, CustomResourceOptions? opts = null)
public EipAssociation(String name, EipAssociationArgs args)
public EipAssociation(String name, EipAssociationArgs args, CustomResourceOptions options)
type: alicloud:ecs:EipAssociation
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 EipAssociationArgs
- 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 EipAssociationArgs
- 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 EipAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args EipAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args EipAssociationArgs
- 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 eipAssociationResource = new AliCloud.Ecs.EipAssociation("eipAssociationResource", new()
{
AllocationId = "string",
InstanceId = "string",
Force = false,
InstanceType = "string",
Mode = "string",
PrivateIpAddress = "string",
VpcId = "string",
});
example, err := ecs.NewEipAssociation(ctx, "eipAssociationResource", &ecs.EipAssociationArgs{
AllocationId: pulumi.String("string"),
InstanceId: pulumi.String("string"),
Force: pulumi.Bool(false),
InstanceType: pulumi.String("string"),
Mode: pulumi.String("string"),
PrivateIpAddress: pulumi.String("string"),
VpcId: pulumi.String("string"),
})
var eipAssociationResource = new EipAssociation("eipAssociationResource", EipAssociationArgs.builder()
.allocationId("string")
.instanceId("string")
.force(false)
.instanceType("string")
.mode("string")
.privateIpAddress("string")
.vpcId("string")
.build());
eip_association_resource = alicloud.ecs.EipAssociation("eipAssociationResource",
allocation_id="string",
instance_id="string",
force=False,
instance_type="string",
mode="string",
private_ip_address="string",
vpc_id="string")
const eipAssociationResource = new alicloud.ecs.EipAssociation("eipAssociationResource", {
allocationId: "string",
instanceId: "string",
force: false,
instanceType: "string",
mode: "string",
privateIpAddress: "string",
vpcId: "string",
});
type: alicloud:ecs:EipAssociation
properties:
allocationId: string
force: false
instanceId: string
instanceType: string
mode: string
privateIpAddress: string
vpcId: string
EipAssociation Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The EipAssociation resource accepts the following input properties:
- Allocation
Id string - The ID of the EIP instance.
- Instance
Id string - The ID of the instance with which you want to associate the EIP. You can enter the ID of a NAT gateway, CLB instance, ECS instance, secondary ENI, HAVIP, or IP address.
- Force bool
- Specifies whether to disassociate the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway. Valid values:
- Instance
Type string The type of the instance with which you want to associate the EIP. Valid values:
Nat
: NAT gatewaySlbInstance
: CLB instanceEcsInstance
(default): ECS instanceNetworkInterface
: secondary ENIHaVip
: HAVIPIpAddress
: IP address
NOTE: The default value is
EcsInstance
. If the instance with which you want to associate the EIP is not an ECS instance, this parameter is required.- Mode string
The association mode. Valid values:
NAT
(default): NAT modeMULTI_BINDED
: multi-EIP-to-ENI modeBINDED
: cut-network interface controller mode
NOTE: This parameter is required only when
instance_type
is set toNetworkInterface
.- Private
Ip stringAddress The IP address in the CIDR block of the vSwitch.
If you leave this parameter empty, the system allocates a private IP address based on the VPC ID and vSwitch ID.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.- Vpc
Id string The ID of the VPC in which an IPv4 gateway is created. The VPC and the EIP must be in the same region.
When you associate an EIP with an IP address, the system can enable the IP address to access the Internet based on VPC route configurations.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.
- Allocation
Id string - The ID of the EIP instance.
- Instance
Id string - The ID of the instance with which you want to associate the EIP. You can enter the ID of a NAT gateway, CLB instance, ECS instance, secondary ENI, HAVIP, or IP address.
- Force bool
- Specifies whether to disassociate the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway. Valid values:
- Instance
Type string The type of the instance with which you want to associate the EIP. Valid values:
Nat
: NAT gatewaySlbInstance
: CLB instanceEcsInstance
(default): ECS instanceNetworkInterface
: secondary ENIHaVip
: HAVIPIpAddress
: IP address
NOTE: The default value is
EcsInstance
. If the instance with which you want to associate the EIP is not an ECS instance, this parameter is required.- Mode string
The association mode. Valid values:
NAT
(default): NAT modeMULTI_BINDED
: multi-EIP-to-ENI modeBINDED
: cut-network interface controller mode
NOTE: This parameter is required only when
instance_type
is set toNetworkInterface
.- Private
Ip stringAddress The IP address in the CIDR block of the vSwitch.
If you leave this parameter empty, the system allocates a private IP address based on the VPC ID and vSwitch ID.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.- Vpc
Id string The ID of the VPC in which an IPv4 gateway is created. The VPC and the EIP must be in the same region.
When you associate an EIP with an IP address, the system can enable the IP address to access the Internet based on VPC route configurations.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.
- allocation
Id String - The ID of the EIP instance.
- instance
Id String - The ID of the instance with which you want to associate the EIP. You can enter the ID of a NAT gateway, CLB instance, ECS instance, secondary ENI, HAVIP, or IP address.
- force Boolean
- Specifies whether to disassociate the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway. Valid values:
- instance
Type String The type of the instance with which you want to associate the EIP. Valid values:
Nat
: NAT gatewaySlbInstance
: CLB instanceEcsInstance
(default): ECS instanceNetworkInterface
: secondary ENIHaVip
: HAVIPIpAddress
: IP address
NOTE: The default value is
EcsInstance
. If the instance with which you want to associate the EIP is not an ECS instance, this parameter is required.- mode String
The association mode. Valid values:
NAT
(default): NAT modeMULTI_BINDED
: multi-EIP-to-ENI modeBINDED
: cut-network interface controller mode
NOTE: This parameter is required only when
instance_type
is set toNetworkInterface
.- private
Ip StringAddress The IP address in the CIDR block of the vSwitch.
If you leave this parameter empty, the system allocates a private IP address based on the VPC ID and vSwitch ID.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.- vpc
Id String The ID of the VPC in which an IPv4 gateway is created. The VPC and the EIP must be in the same region.
When you associate an EIP with an IP address, the system can enable the IP address to access the Internet based on VPC route configurations.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.
- allocation
Id string - The ID of the EIP instance.
- instance
Id string - The ID of the instance with which you want to associate the EIP. You can enter the ID of a NAT gateway, CLB instance, ECS instance, secondary ENI, HAVIP, or IP address.
- force boolean
- Specifies whether to disassociate the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway. Valid values:
- instance
Type string The type of the instance with which you want to associate the EIP. Valid values:
Nat
: NAT gatewaySlbInstance
: CLB instanceEcsInstance
(default): ECS instanceNetworkInterface
: secondary ENIHaVip
: HAVIPIpAddress
: IP address
NOTE: The default value is
EcsInstance
. If the instance with which you want to associate the EIP is not an ECS instance, this parameter is required.- mode string
The association mode. Valid values:
NAT
(default): NAT modeMULTI_BINDED
: multi-EIP-to-ENI modeBINDED
: cut-network interface controller mode
NOTE: This parameter is required only when
instance_type
is set toNetworkInterface
.- private
Ip stringAddress The IP address in the CIDR block of the vSwitch.
If you leave this parameter empty, the system allocates a private IP address based on the VPC ID and vSwitch ID.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.- vpc
Id string The ID of the VPC in which an IPv4 gateway is created. The VPC and the EIP must be in the same region.
When you associate an EIP with an IP address, the system can enable the IP address to access the Internet based on VPC route configurations.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.
- allocation_
id str - The ID of the EIP instance.
- instance_
id str - The ID of the instance with which you want to associate the EIP. You can enter the ID of a NAT gateway, CLB instance, ECS instance, secondary ENI, HAVIP, or IP address.
- force bool
- Specifies whether to disassociate the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway. Valid values:
- instance_
type str The type of the instance with which you want to associate the EIP. Valid values:
Nat
: NAT gatewaySlbInstance
: CLB instanceEcsInstance
(default): ECS instanceNetworkInterface
: secondary ENIHaVip
: HAVIPIpAddress
: IP address
NOTE: The default value is
EcsInstance
. If the instance with which you want to associate the EIP is not an ECS instance, this parameter is required.- mode str
The association mode. Valid values:
NAT
(default): NAT modeMULTI_BINDED
: multi-EIP-to-ENI modeBINDED
: cut-network interface controller mode
NOTE: This parameter is required only when
instance_type
is set toNetworkInterface
.- private_
ip_ straddress The IP address in the CIDR block of the vSwitch.
If you leave this parameter empty, the system allocates a private IP address based on the VPC ID and vSwitch ID.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.- vpc_
id str The ID of the VPC in which an IPv4 gateway is created. The VPC and the EIP must be in the same region.
When you associate an EIP with an IP address, the system can enable the IP address to access the Internet based on VPC route configurations.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.
- allocation
Id String - The ID of the EIP instance.
- instance
Id String - The ID of the instance with which you want to associate the EIP. You can enter the ID of a NAT gateway, CLB instance, ECS instance, secondary ENI, HAVIP, or IP address.
- force Boolean
- Specifies whether to disassociate the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway. Valid values:
- instance
Type String The type of the instance with which you want to associate the EIP. Valid values:
Nat
: NAT gatewaySlbInstance
: CLB instanceEcsInstance
(default): ECS instanceNetworkInterface
: secondary ENIHaVip
: HAVIPIpAddress
: IP address
NOTE: The default value is
EcsInstance
. If the instance with which you want to associate the EIP is not an ECS instance, this parameter is required.- mode String
The association mode. Valid values:
NAT
(default): NAT modeMULTI_BINDED
: multi-EIP-to-ENI modeBINDED
: cut-network interface controller mode
NOTE: This parameter is required only when
instance_type
is set toNetworkInterface
.- private
Ip StringAddress The IP address in the CIDR block of the vSwitch.
If you leave this parameter empty, the system allocates a private IP address based on the VPC ID and vSwitch ID.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.- vpc
Id String The ID of the VPC in which an IPv4 gateway is created. The VPC and the EIP must be in the same region.
When you associate an EIP with an IP address, the system can enable the IP address to access the Internet based on VPC route configurations.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.
Outputs
All input properties are implicitly available as output properties. Additionally, the EipAssociation resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing EipAssociation Resource
Get an existing EipAssociation 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?: EipAssociationState, opts?: CustomResourceOptions): EipAssociation
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
allocation_id: Optional[str] = None,
force: Optional[bool] = None,
instance_id: Optional[str] = None,
instance_type: Optional[str] = None,
mode: Optional[str] = None,
private_ip_address: Optional[str] = None,
vpc_id: Optional[str] = None) -> EipAssociation
func GetEipAssociation(ctx *Context, name string, id IDInput, state *EipAssociationState, opts ...ResourceOption) (*EipAssociation, error)
public static EipAssociation Get(string name, Input<string> id, EipAssociationState? state, CustomResourceOptions? opts = null)
public static EipAssociation get(String name, Output<String> id, EipAssociationState 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.
- Allocation
Id string - The ID of the EIP instance.
- Force bool
- Specifies whether to disassociate the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway. Valid values:
- Instance
Id string - The ID of the instance with which you want to associate the EIP. You can enter the ID of a NAT gateway, CLB instance, ECS instance, secondary ENI, HAVIP, or IP address.
- Instance
Type string The type of the instance with which you want to associate the EIP. Valid values:
Nat
: NAT gatewaySlbInstance
: CLB instanceEcsInstance
(default): ECS instanceNetworkInterface
: secondary ENIHaVip
: HAVIPIpAddress
: IP address
NOTE: The default value is
EcsInstance
. If the instance with which you want to associate the EIP is not an ECS instance, this parameter is required.- Mode string
The association mode. Valid values:
NAT
(default): NAT modeMULTI_BINDED
: multi-EIP-to-ENI modeBINDED
: cut-network interface controller mode
NOTE: This parameter is required only when
instance_type
is set toNetworkInterface
.- Private
Ip stringAddress The IP address in the CIDR block of the vSwitch.
If you leave this parameter empty, the system allocates a private IP address based on the VPC ID and vSwitch ID.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.- Vpc
Id string The ID of the VPC in which an IPv4 gateway is created. The VPC and the EIP must be in the same region.
When you associate an EIP with an IP address, the system can enable the IP address to access the Internet based on VPC route configurations.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.
- Allocation
Id string - The ID of the EIP instance.
- Force bool
- Specifies whether to disassociate the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway. Valid values:
- Instance
Id string - The ID of the instance with which you want to associate the EIP. You can enter the ID of a NAT gateway, CLB instance, ECS instance, secondary ENI, HAVIP, or IP address.
- Instance
Type string The type of the instance with which you want to associate the EIP. Valid values:
Nat
: NAT gatewaySlbInstance
: CLB instanceEcsInstance
(default): ECS instanceNetworkInterface
: secondary ENIHaVip
: HAVIPIpAddress
: IP address
NOTE: The default value is
EcsInstance
. If the instance with which you want to associate the EIP is not an ECS instance, this parameter is required.- Mode string
The association mode. Valid values:
NAT
(default): NAT modeMULTI_BINDED
: multi-EIP-to-ENI modeBINDED
: cut-network interface controller mode
NOTE: This parameter is required only when
instance_type
is set toNetworkInterface
.- Private
Ip stringAddress The IP address in the CIDR block of the vSwitch.
If you leave this parameter empty, the system allocates a private IP address based on the VPC ID and vSwitch ID.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.- Vpc
Id string The ID of the VPC in which an IPv4 gateway is created. The VPC and the EIP must be in the same region.
When you associate an EIP with an IP address, the system can enable the IP address to access the Internet based on VPC route configurations.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.
- allocation
Id String - The ID of the EIP instance.
- force Boolean
- Specifies whether to disassociate the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway. Valid values:
- instance
Id String - The ID of the instance with which you want to associate the EIP. You can enter the ID of a NAT gateway, CLB instance, ECS instance, secondary ENI, HAVIP, or IP address.
- instance
Type String The type of the instance with which you want to associate the EIP. Valid values:
Nat
: NAT gatewaySlbInstance
: CLB instanceEcsInstance
(default): ECS instanceNetworkInterface
: secondary ENIHaVip
: HAVIPIpAddress
: IP address
NOTE: The default value is
EcsInstance
. If the instance with which you want to associate the EIP is not an ECS instance, this parameter is required.- mode String
The association mode. Valid values:
NAT
(default): NAT modeMULTI_BINDED
: multi-EIP-to-ENI modeBINDED
: cut-network interface controller mode
NOTE: This parameter is required only when
instance_type
is set toNetworkInterface
.- private
Ip StringAddress The IP address in the CIDR block of the vSwitch.
If you leave this parameter empty, the system allocates a private IP address based on the VPC ID and vSwitch ID.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.- vpc
Id String The ID of the VPC in which an IPv4 gateway is created. The VPC and the EIP must be in the same region.
When you associate an EIP with an IP address, the system can enable the IP address to access the Internet based on VPC route configurations.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.
- allocation
Id string - The ID of the EIP instance.
- force boolean
- Specifies whether to disassociate the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway. Valid values:
- instance
Id string - The ID of the instance with which you want to associate the EIP. You can enter the ID of a NAT gateway, CLB instance, ECS instance, secondary ENI, HAVIP, or IP address.
- instance
Type string The type of the instance with which you want to associate the EIP. Valid values:
Nat
: NAT gatewaySlbInstance
: CLB instanceEcsInstance
(default): ECS instanceNetworkInterface
: secondary ENIHaVip
: HAVIPIpAddress
: IP address
NOTE: The default value is
EcsInstance
. If the instance with which you want to associate the EIP is not an ECS instance, this parameter is required.- mode string
The association mode. Valid values:
NAT
(default): NAT modeMULTI_BINDED
: multi-EIP-to-ENI modeBINDED
: cut-network interface controller mode
NOTE: This parameter is required only when
instance_type
is set toNetworkInterface
.- private
Ip stringAddress The IP address in the CIDR block of the vSwitch.
If you leave this parameter empty, the system allocates a private IP address based on the VPC ID and vSwitch ID.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.- vpc
Id string The ID of the VPC in which an IPv4 gateway is created. The VPC and the EIP must be in the same region.
When you associate an EIP with an IP address, the system can enable the IP address to access the Internet based on VPC route configurations.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.
- allocation_
id str - The ID of the EIP instance.
- force bool
- Specifies whether to disassociate the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway. Valid values:
- instance_
id str - The ID of the instance with which you want to associate the EIP. You can enter the ID of a NAT gateway, CLB instance, ECS instance, secondary ENI, HAVIP, or IP address.
- instance_
type str The type of the instance with which you want to associate the EIP. Valid values:
Nat
: NAT gatewaySlbInstance
: CLB instanceEcsInstance
(default): ECS instanceNetworkInterface
: secondary ENIHaVip
: HAVIPIpAddress
: IP address
NOTE: The default value is
EcsInstance
. If the instance with which you want to associate the EIP is not an ECS instance, this parameter is required.- mode str
The association mode. Valid values:
NAT
(default): NAT modeMULTI_BINDED
: multi-EIP-to-ENI modeBINDED
: cut-network interface controller mode
NOTE: This parameter is required only when
instance_type
is set toNetworkInterface
.- private_
ip_ straddress The IP address in the CIDR block of the vSwitch.
If you leave this parameter empty, the system allocates a private IP address based on the VPC ID and vSwitch ID.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.- vpc_
id str The ID of the VPC in which an IPv4 gateway is created. The VPC and the EIP must be in the same region.
When you associate an EIP with an IP address, the system can enable the IP address to access the Internet based on VPC route configurations.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.
- allocation
Id String - The ID of the EIP instance.
- force Boolean
- Specifies whether to disassociate the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway. Valid values:
- instance
Id String - The ID of the instance with which you want to associate the EIP. You can enter the ID of a NAT gateway, CLB instance, ECS instance, secondary ENI, HAVIP, or IP address.
- instance
Type String The type of the instance with which you want to associate the EIP. Valid values:
Nat
: NAT gatewaySlbInstance
: CLB instanceEcsInstance
(default): ECS instanceNetworkInterface
: secondary ENIHaVip
: HAVIPIpAddress
: IP address
NOTE: The default value is
EcsInstance
. If the instance with which you want to associate the EIP is not an ECS instance, this parameter is required.- mode String
The association mode. Valid values:
NAT
(default): NAT modeMULTI_BINDED
: multi-EIP-to-ENI modeBINDED
: cut-network interface controller mode
NOTE: This parameter is required only when
instance_type
is set toNetworkInterface
.- private
Ip StringAddress The IP address in the CIDR block of the vSwitch.
If you leave this parameter empty, the system allocates a private IP address based on the VPC ID and vSwitch ID.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.- vpc
Id String The ID of the VPC in which an IPv4 gateway is created. The VPC and the EIP must be in the same region.
When you associate an EIP with an IP address, the system can enable the IP address to access the Internet based on VPC route configurations.
NOTE: This parameter is required if
instance_type
is set toIpAddress
, which indicates that the EIP is to be associated with an IP address.
Import
EIP Association can be imported using the id, e.g.
$ pulumi import alicloud:ecs/eipAssociation:EipAssociation example <allocation_id>:<instance_id>
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.