alicloud logo
Alibaba Cloud v3.34.0, Mar 17 23

alicloud.ecs.EcsKeyPairAttachment

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 in v1.121.0+.

Example Usage

Basic Usage

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var example = new AliCloud.Ecs.EcsKeyPairAttachment("example", new()
    {
        KeyPairName = "key_pair_name",
        InstanceIds = new[]
        {
            i_gw80pxxxxxxxxxx,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ecs.NewEcsKeyPairAttachment(ctx, "example", &ecs.EcsKeyPairAttachmentArgs{
			KeyPairName: pulumi.String("key_pair_name"),
			InstanceIds: pulumi.StringArray{
				i_gw80pxxxxxxxxxx,
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
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) {
        var example = new EcsKeyPairAttachment("example", EcsKeyPairAttachmentArgs.builder()        
            .keyPairName("key_pair_name")
            .instanceIds(i_gw80pxxxxxxxxxx)
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

example = alicloud.ecs.EcsKeyPairAttachment("example",
    key_pair_name="key_pair_name",
    instance_ids=[i_gw80pxxxxxxxxxx])
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const example = new alicloud.ecs.EcsKeyPairAttachment("example", {
    keyPairName: "key_pair_name",
    instanceIds: [i_gw80pxxxxxxxxxx],
});
resources:
  example:
    type: alicloud:ecs:EcsKeyPairAttachment
    properties:
      keyPairName: key_pair_name
      instanceIds:
        - ${["i-gw80pxxxxxxxxxx"]}

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

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

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

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

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

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

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

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

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

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

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

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

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.