1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. ecs
  5. EcsKeyPairAttachment
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

alicloud.ecs.EcsKeyPairAttachment

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

    Provides a ECS Key Pair Attachment resource.

    For information about ECS Key Pair Attachment and how to use it, see What is Key Pair Attachment.

    NOTE: Available since v1.121.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const exampleZones = alicloud.getZones({
        availableResourceCreation: "Instance",
    });
    const exampleInstanceTypes = exampleZones.then(exampleZones => alicloud.ecs.getInstanceTypes({
        availabilityZone: exampleZones.zones?.[0]?.id,
        cpuCoreCount: 1,
        memorySize: 2,
    }));
    const exampleImages = alicloud.ecs.getImages({
        nameRegex: "^ubuntu_[0-9]+_[0-9]+_x64*",
        owners: "system",
    });
    const exampleNetwork = new alicloud.vpc.Network("exampleNetwork", {
        vpcName: "terraform-example",
        cidrBlock: "172.17.3.0/24",
    });
    const exampleSwitch = new alicloud.vpc.Switch("exampleSwitch", {
        vswitchName: "terraform-example",
        cidrBlock: "172.17.3.0/24",
        vpcId: exampleNetwork.id,
        zoneId: exampleZones.then(exampleZones => exampleZones.zones?.[0]?.id),
    });
    const exampleSecurityGroup = new alicloud.ecs.SecurityGroup("exampleSecurityGroup", {vpcId: exampleNetwork.id});
    const exampleInstance = new alicloud.ecs.Instance("exampleInstance", {
        imageId: exampleImages.then(exampleImages => exampleImages.images?.[0]?.id),
        instanceType: exampleInstanceTypes.then(exampleInstanceTypes => exampleInstanceTypes.instanceTypes?.[0]?.id),
        availabilityZone: exampleZones.then(exampleZones => exampleZones.zones?.[0]?.id),
        securityGroups: [exampleSecurityGroup.id],
        instanceName: "terraform-example",
        internetChargeType: "PayByBandwidth",
        vswitchId: exampleSwitch.id,
    });
    const _default = new random.RandomInteger("default", {
        min: 10000,
        max: 99999,
    });
    const exampleEcsKeyPair = new alicloud.ecs.EcsKeyPair("exampleEcsKeyPair", {keyPairName: pulumi.interpolate`tf-example-${_default.result}`});
    const exampleEcsKeyPairAttachment = new alicloud.ecs.EcsKeyPairAttachment("exampleEcsKeyPairAttachment", {
        keyPairName: exampleEcsKeyPair.keyPairName,
        instanceIds: [exampleInstance.id],
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    example_zones = alicloud.get_zones(available_resource_creation="Instance")
    example_instance_types = alicloud.ecs.get_instance_types(availability_zone=example_zones.zones[0].id,
        cpu_core_count=1,
        memory_size=2)
    example_images = alicloud.ecs.get_images(name_regex="^ubuntu_[0-9]+_[0-9]+_x64*",
        owners="system")
    example_network = alicloud.vpc.Network("exampleNetwork",
        vpc_name="terraform-example",
        cidr_block="172.17.3.0/24")
    example_switch = alicloud.vpc.Switch("exampleSwitch",
        vswitch_name="terraform-example",
        cidr_block="172.17.3.0/24",
        vpc_id=example_network.id,
        zone_id=example_zones.zones[0].id)
    example_security_group = alicloud.ecs.SecurityGroup("exampleSecurityGroup", vpc_id=example_network.id)
    example_instance = alicloud.ecs.Instance("exampleInstance",
        image_id=example_images.images[0].id,
        instance_type=example_instance_types.instance_types[0].id,
        availability_zone=example_zones.zones[0].id,
        security_groups=[example_security_group.id],
        instance_name="terraform-example",
        internet_charge_type="PayByBandwidth",
        vswitch_id=example_switch.id)
    default = random.RandomInteger("default",
        min=10000,
        max=99999)
    example_ecs_key_pair = alicloud.ecs.EcsKeyPair("exampleEcsKeyPair", key_pair_name=default.result.apply(lambda result: f"tf-example-{result}"))
    example_ecs_key_pair_attachment = alicloud.ecs.EcsKeyPairAttachment("exampleEcsKeyPairAttachment",
        key_pair_name=example_ecs_key_pair.key_pair_name,
        instance_ids=[example_instance.id])
    
    package main
    
    import (
    	"fmt"
    
    	"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-random/sdk/v4/go/random"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleZones, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
    			AvailableResourceCreation: pulumi.StringRef("Instance"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleInstanceTypes, err := ecs.GetInstanceTypes(ctx, &ecs.GetInstanceTypesArgs{
    			AvailabilityZone: pulumi.StringRef(exampleZones.Zones[0].Id),
    			CpuCoreCount:     pulumi.IntRef(1),
    			MemorySize:       pulumi.Float64Ref(2),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleImages, err := ecs.GetImages(ctx, &ecs.GetImagesArgs{
    			NameRegex: pulumi.StringRef("^ubuntu_[0-9]+_[0-9]+_x64*"),
    			Owners:    pulumi.StringRef("system"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleNetwork, err := vpc.NewNetwork(ctx, "exampleNetwork", &vpc.NetworkArgs{
    			VpcName:   pulumi.String("terraform-example"),
    			CidrBlock: pulumi.String("172.17.3.0/24"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleSwitch, err := vpc.NewSwitch(ctx, "exampleSwitch", &vpc.SwitchArgs{
    			VswitchName: pulumi.String("terraform-example"),
    			CidrBlock:   pulumi.String("172.17.3.0/24"),
    			VpcId:       exampleNetwork.ID(),
    			ZoneId:      pulumi.String(exampleZones.Zones[0].Id),
    		})
    		if err != nil {
    			return err
    		}
    		exampleSecurityGroup, err := ecs.NewSecurityGroup(ctx, "exampleSecurityGroup", &ecs.SecurityGroupArgs{
    			VpcId: exampleNetwork.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		exampleInstance, err := ecs.NewInstance(ctx, "exampleInstance", &ecs.InstanceArgs{
    			ImageId:          pulumi.String(exampleImages.Images[0].Id),
    			InstanceType:     pulumi.String(exampleInstanceTypes.InstanceTypes[0].Id),
    			AvailabilityZone: pulumi.String(exampleZones.Zones[0].Id),
    			SecurityGroups: pulumi.StringArray{
    				exampleSecurityGroup.ID(),
    			},
    			InstanceName:       pulumi.String("terraform-example"),
    			InternetChargeType: pulumi.String("PayByBandwidth"),
    			VswitchId:          exampleSwitch.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = random.NewRandomInteger(ctx, "default", &random.RandomIntegerArgs{
    			Min: pulumi.Int(10000),
    			Max: pulumi.Int(99999),
    		})
    		if err != nil {
    			return err
    		}
    		exampleEcsKeyPair, err := ecs.NewEcsKeyPair(ctx, "exampleEcsKeyPair", &ecs.EcsKeyPairArgs{
    			KeyPairName: _default.Result.ApplyT(func(result int) (string, error) {
    				return fmt.Sprintf("tf-example-%v", result), nil
    			}).(pulumi.StringOutput),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ecs.NewEcsKeyPairAttachment(ctx, "exampleEcsKeyPairAttachment", &ecs.EcsKeyPairAttachmentArgs{
    			KeyPairName: exampleEcsKeyPair.KeyPairName,
    			InstanceIds: pulumi.StringArray{
    				exampleInstance.ID(),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleZones = AliCloud.GetZones.Invoke(new()
        {
            AvailableResourceCreation = "Instance",
        });
    
        var exampleInstanceTypes = AliCloud.Ecs.GetInstanceTypes.Invoke(new()
        {
            AvailabilityZone = exampleZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
            CpuCoreCount = 1,
            MemorySize = 2,
        });
    
        var exampleImages = AliCloud.Ecs.GetImages.Invoke(new()
        {
            NameRegex = "^ubuntu_[0-9]+_[0-9]+_x64*",
            Owners = "system",
        });
    
        var exampleNetwork = new AliCloud.Vpc.Network("exampleNetwork", new()
        {
            VpcName = "terraform-example",
            CidrBlock = "172.17.3.0/24",
        });
    
        var exampleSwitch = new AliCloud.Vpc.Switch("exampleSwitch", new()
        {
            VswitchName = "terraform-example",
            CidrBlock = "172.17.3.0/24",
            VpcId = exampleNetwork.Id,
            ZoneId = exampleZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
        });
    
        var exampleSecurityGroup = new AliCloud.Ecs.SecurityGroup("exampleSecurityGroup", new()
        {
            VpcId = exampleNetwork.Id,
        });
    
        var exampleInstance = new AliCloud.Ecs.Instance("exampleInstance", new()
        {
            ImageId = exampleImages.Apply(getImagesResult => getImagesResult.Images[0]?.Id),
            InstanceType = exampleInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes[0]?.Id),
            AvailabilityZone = exampleZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
            SecurityGroups = new[]
            {
                exampleSecurityGroup.Id,
            },
            InstanceName = "terraform-example",
            InternetChargeType = "PayByBandwidth",
            VswitchId = exampleSwitch.Id,
        });
    
        var @default = new Random.RandomInteger("default", new()
        {
            Min = 10000,
            Max = 99999,
        });
    
        var exampleEcsKeyPair = new AliCloud.Ecs.EcsKeyPair("exampleEcsKeyPair", new()
        {
            KeyPairName = @default.Result.Apply(result => $"tf-example-{result}"),
        });
    
        var exampleEcsKeyPairAttachment = new AliCloud.Ecs.EcsKeyPairAttachment("exampleEcsKeyPairAttachment", new()
        {
            KeyPairName = exampleEcsKeyPair.KeyPairName,
            InstanceIds = new[]
            {
                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.random.RandomInteger;
    import com.pulumi.random.RandomIntegerArgs;
    import com.pulumi.alicloud.ecs.EcsKeyPair;
    import com.pulumi.alicloud.ecs.EcsKeyPairArgs;
    import com.pulumi.alicloud.ecs.EcsKeyPairAttachment;
    import com.pulumi.alicloud.ecs.EcsKeyPairAttachmentArgs;
    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 exampleZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
                .availableResourceCreation("Instance")
                .build());
    
            final var exampleInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
                .availabilityZone(exampleZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
                .cpuCoreCount(1)
                .memorySize(2)
                .build());
    
            final var exampleImages = EcsFunctions.getImages(GetImagesArgs.builder()
                .nameRegex("^ubuntu_[0-9]+_[0-9]+_x64*")
                .owners("system")
                .build());
    
            var exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()        
                .vpcName("terraform-example")
                .cidrBlock("172.17.3.0/24")
                .build());
    
            var exampleSwitch = new Switch("exampleSwitch", SwitchArgs.builder()        
                .vswitchName("terraform-example")
                .cidrBlock("172.17.3.0/24")
                .vpcId(exampleNetwork.id())
                .zoneId(exampleZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
                .build());
    
            var exampleSecurityGroup = new SecurityGroup("exampleSecurityGroup", SecurityGroupArgs.builder()        
                .vpcId(exampleNetwork.id())
                .build());
    
            var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()        
                .imageId(exampleImages.applyValue(getImagesResult -> getImagesResult.images()[0].id()))
                .instanceType(exampleInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].id()))
                .availabilityZone(exampleZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
                .securityGroups(exampleSecurityGroup.id())
                .instanceName("terraform-example")
                .internetChargeType("PayByBandwidth")
                .vswitchId(exampleSwitch.id())
                .build());
    
            var default_ = new RandomInteger("default", RandomIntegerArgs.builder()        
                .min(10000)
                .max(99999)
                .build());
    
            var exampleEcsKeyPair = new EcsKeyPair("exampleEcsKeyPair", EcsKeyPairArgs.builder()        
                .keyPairName(default_.result().applyValue(result -> String.format("tf-example-%s", result)))
                .build());
    
            var exampleEcsKeyPairAttachment = new EcsKeyPairAttachment("exampleEcsKeyPairAttachment", EcsKeyPairAttachmentArgs.builder()        
                .keyPairName(exampleEcsKeyPair.keyPairName())
                .instanceIds(exampleInstance.id())
                .build());
    
        }
    }
    
    resources:
      exampleNetwork:
        type: alicloud:vpc:Network
        properties:
          vpcName: terraform-example
          cidrBlock: 172.17.3.0/24
      exampleSwitch:
        type: alicloud:vpc:Switch
        properties:
          vswitchName: terraform-example
          cidrBlock: 172.17.3.0/24
          vpcId: ${exampleNetwork.id}
          zoneId: ${exampleZones.zones[0].id}
      exampleSecurityGroup:
        type: alicloud:ecs:SecurityGroup
        properties:
          vpcId: ${exampleNetwork.id}
      exampleInstance:
        type: alicloud:ecs:Instance
        properties:
          imageId: ${exampleImages.images[0].id}
          instanceType: ${exampleInstanceTypes.instanceTypes[0].id}
          availabilityZone: ${exampleZones.zones[0].id}
          securityGroups:
            - ${exampleSecurityGroup.id}
          instanceName: terraform-example
          internetChargeType: PayByBandwidth
          vswitchId: ${exampleSwitch.id}
      default:
        type: random:RandomInteger
        properties:
          min: 10000
          max: 99999
      exampleEcsKeyPair:
        type: alicloud:ecs:EcsKeyPair
        properties:
          keyPairName: tf-example-${default.result}
      exampleEcsKeyPairAttachment:
        type: alicloud:ecs:EcsKeyPairAttachment
        properties:
          keyPairName: ${exampleEcsKeyPair.keyPairName}
          instanceIds:
            - ${exampleInstance.id}
    variables:
      exampleZones:
        fn::invoke:
          Function: alicloud:getZones
          Arguments:
            availableResourceCreation: Instance
      exampleInstanceTypes:
        fn::invoke:
          Function: alicloud:ecs:getInstanceTypes
          Arguments:
            availabilityZone: ${exampleZones.zones[0].id}
            cpuCoreCount: 1
            memorySize: 2
      exampleImages:
        fn::invoke:
          Function: alicloud:ecs:getImages
          Arguments:
            nameRegex: ^ubuntu_[0-9]+_[0-9]+_x64*
            owners: system
    

    Create EcsKeyPairAttachment Resource

    new EcsKeyPairAttachment(name: string, args: EcsKeyPairAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def EcsKeyPairAttachment(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             force: Optional[bool] = None,
                             instance_ids: Optional[Sequence[str]] = None,
                             key_name: Optional[str] = None,
                             key_pair_name: Optional[str] = None)
    @overload
    def EcsKeyPairAttachment(resource_name: str,
                             args: EcsKeyPairAttachmentArgs,
                             opts: Optional[ResourceOptions] = None)
    func NewEcsKeyPairAttachment(ctx *Context, name string, args EcsKeyPairAttachmentArgs, opts ...ResourceOption) (*EcsKeyPairAttachment, error)
    public EcsKeyPairAttachment(string name, EcsKeyPairAttachmentArgs args, CustomResourceOptions? opts = null)
    public EcsKeyPairAttachment(String name, EcsKeyPairAttachmentArgs args)
    public EcsKeyPairAttachment(String name, EcsKeyPairAttachmentArgs args, CustomResourceOptions options)
    
    type: alicloud:ecs:EcsKeyPairAttachment
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args EcsKeyPairAttachmentArgs
    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 EcsKeyPairAttachmentArgs
    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 EcsKeyPairAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EcsKeyPairAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EcsKeyPairAttachmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    EcsKeyPairAttachment 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 EcsKeyPairAttachment resource accepts the following input properties:

    InstanceIds List<string>
    The list of ECS instance's IDs.
    Force bool
    Set it to true and it will reboot instances which attached with the key pair to make key pair affect immediately.
    KeyName string
    New field 'key_pair_name' instead.

    Deprecated:Field 'key_name' has been deprecated from provider version 1.121.0. New field 'key_pair_name' instead.

    KeyPairName string
    The name of key pair used to bind.
    InstanceIds []string
    The list of ECS instance's IDs.
    Force bool
    Set it to true and it will reboot instances which attached with the key pair to make key pair affect immediately.
    KeyName string
    New field 'key_pair_name' instead.

    Deprecated:Field 'key_name' has been deprecated from provider version 1.121.0. New field 'key_pair_name' instead.

    KeyPairName string
    The name of key pair used to bind.
    instanceIds List<String>
    The list of ECS instance's IDs.
    force Boolean
    Set it to true and it will reboot instances which attached with the key pair to make key pair affect immediately.
    keyName String
    New field 'key_pair_name' instead.

    Deprecated:Field 'key_name' has been deprecated from provider version 1.121.0. New field 'key_pair_name' instead.

    keyPairName String
    The name of key pair used to bind.
    instanceIds string[]
    The list of ECS instance's IDs.
    force boolean
    Set it to true and it will reboot instances which attached with the key pair to make key pair affect immediately.
    keyName string
    New field 'key_pair_name' instead.

    Deprecated:Field 'key_name' has been deprecated from provider version 1.121.0. New field 'key_pair_name' instead.

    keyPairName string
    The name of key pair used to bind.
    instance_ids Sequence[str]
    The list of ECS instance's IDs.
    force bool
    Set it to true and it will reboot instances which attached with the key pair to make key pair affect immediately.
    key_name str
    New field 'key_pair_name' instead.

    Deprecated:Field 'key_name' has been deprecated from provider version 1.121.0. New field 'key_pair_name' instead.

    key_pair_name str
    The name of key pair used to bind.
    instanceIds List<String>
    The list of ECS instance's IDs.
    force Boolean
    Set it to true and it will reboot instances which attached with the key pair to make key pair affect immediately.
    keyName String
    New field 'key_pair_name' instead.

    Deprecated:Field 'key_name' has been deprecated from provider version 1.121.0. New field 'key_pair_name' instead.

    keyPairName String
    The name of key pair used to bind.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the EcsKeyPairAttachment 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 EcsKeyPairAttachment Resource

    Get an existing EcsKeyPairAttachment 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?: EcsKeyPairAttachmentState, opts?: CustomResourceOptions): EcsKeyPairAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            force: Optional[bool] = None,
            instance_ids: Optional[Sequence[str]] = None,
            key_name: Optional[str] = None,
            key_pair_name: Optional[str] = None) -> EcsKeyPairAttachment
    func GetEcsKeyPairAttachment(ctx *Context, name string, id IDInput, state *EcsKeyPairAttachmentState, opts ...ResourceOption) (*EcsKeyPairAttachment, error)
    public static EcsKeyPairAttachment Get(string name, Input<string> id, EcsKeyPairAttachmentState? state, CustomResourceOptions? opts = null)
    public static EcsKeyPairAttachment get(String name, Output<String> id, EcsKeyPairAttachmentState 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:
    Force bool
    Set it to true and it will reboot instances which attached with the key pair to make key pair affect immediately.
    InstanceIds List<string>
    The list of ECS instance's IDs.
    KeyName string
    New field 'key_pair_name' instead.

    Deprecated:Field 'key_name' has been deprecated from provider version 1.121.0. New field 'key_pair_name' instead.

    KeyPairName string
    The name of key pair used to bind.
    Force bool
    Set it to true and it will reboot instances which attached with the key pair to make key pair affect immediately.
    InstanceIds []string
    The list of ECS instance's IDs.
    KeyName string
    New field 'key_pair_name' instead.

    Deprecated:Field 'key_name' has been deprecated from provider version 1.121.0. New field 'key_pair_name' instead.

    KeyPairName string
    The name of key pair used to bind.
    force Boolean
    Set it to true and it will reboot instances which attached with the key pair to make key pair affect immediately.
    instanceIds List<String>
    The list of ECS instance's IDs.
    keyName String
    New field 'key_pair_name' instead.

    Deprecated:Field 'key_name' has been deprecated from provider version 1.121.0. New field 'key_pair_name' instead.

    keyPairName String
    The name of key pair used to bind.
    force boolean
    Set it to true and it will reboot instances which attached with the key pair to make key pair affect immediately.
    instanceIds string[]
    The list of ECS instance's IDs.
    keyName string
    New field 'key_pair_name' instead.

    Deprecated:Field 'key_name' has been deprecated from provider version 1.121.0. New field 'key_pair_name' instead.

    keyPairName string
    The name of key pair used to bind.
    force bool
    Set it to true and it will reboot instances which attached with the key pair to make key pair affect immediately.
    instance_ids Sequence[str]
    The list of ECS instance's IDs.
    key_name str
    New field 'key_pair_name' instead.

    Deprecated:Field 'key_name' has been deprecated from provider version 1.121.0. New field 'key_pair_name' instead.

    key_pair_name str
    The name of key pair used to bind.
    force Boolean
    Set it to true and it will reboot instances which attached with the key pair to make key pair affect immediately.
    instanceIds List<String>
    The list of ECS instance's IDs.
    keyName String
    New field 'key_pair_name' instead.

    Deprecated:Field 'key_name' has been deprecated from provider version 1.121.0. New field 'key_pair_name' instead.

    keyPairName String
    The name of key pair used to bind.

    Import

    ECS Key Pair Attachment can be imported using the id, e.g.

    $ pulumi import alicloud:ecs/ecsKeyPairAttachment:EcsKeyPairAttachment example <key_pair_name>:<instance_ids>
    

    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.51.0 published on Saturday, Mar 23, 2024 by Pulumi