Alibaba Cloud

Pulumi Official
Package maintained by Pulumi
v3.19.0 published on Friday, Mar 18, 2022 by Pulumi

EcsKeyPair

Provides a ECS Key Pair resource.

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

NOTE: Available in v1.121.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var example = new AliCloud.Ecs.EcsKeyPair("example", new AliCloud.Ecs.EcsKeyPairArgs
        {
            KeyPairName = "key_pair_name",
        });
        // Using name prefix to build key pair
        var prefix = new AliCloud.Ecs.EcsKeyPair("prefix", new AliCloud.Ecs.EcsKeyPairArgs
        {
            KeyNamePrefix = "terraform-test-key-pair-prefix",
        });
        // Import an existing public key to build a alicloud key pair
        var publickey = new AliCloud.Ecs.EcsKeyPair("publickey", new AliCloud.Ecs.EcsKeyPairArgs
        {
            KeyPairName = "my_public_key",
            PublicKey = "ssh-rsa AAAAB3Nza12345678qwertyuudsfsg",
        });
    }

}
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.NewEcsKeyPair(ctx, "example", &ecs.EcsKeyPairArgs{
			KeyPairName: pulumi.String("key_pair_name"),
		})
		if err != nil {
			return err
		}
		_, err = ecs.NewEcsKeyPair(ctx, "prefix", &ecs.EcsKeyPairArgs{
			KeyNamePrefix: pulumi.String("terraform-test-key-pair-prefix"),
		})
		if err != nil {
			return err
		}
		_, err = ecs.NewEcsKeyPair(ctx, "publickey", &ecs.EcsKeyPairArgs{
			KeyPairName: pulumi.String("my_public_key"),
			PublicKey:   pulumi.String("ssh-rsa AAAAB3Nza12345678qwertyuudsfsg"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

example = alicloud.ecs.EcsKeyPair("example", key_pair_name="key_pair_name")
# Using name prefix to build key pair
prefix = alicloud.ecs.EcsKeyPair("prefix", key_name_prefix="terraform-test-key-pair-prefix")
# Import an existing public key to build a alicloud key pair
publickey = alicloud.ecs.EcsKeyPair("publickey",
    key_pair_name="my_public_key",
    public_key="ssh-rsa AAAAB3Nza12345678qwertyuudsfsg")
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const example = new alicloud.ecs.EcsKeyPair("example", {
    keyPairName: "key_pair_name",
});
// Using name prefix to build key pair
const prefix = new alicloud.ecs.EcsKeyPair("prefix", {
    keyNamePrefix: "terraform-test-key-pair-prefix",
});
// Import an existing public key to build a alicloud key pair
const publickey = new alicloud.ecs.EcsKeyPair("publickey", {
    keyPairName: "my_public_key",
    publicKey: "ssh-rsa AAAAB3Nza12345678qwertyuudsfsg",
});

Coming soon!

Create a EcsKeyPair Resource

new EcsKeyPair(name: string, args?: EcsKeyPairArgs, opts?: CustomResourceOptions);
@overload
def EcsKeyPair(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               key_file: Optional[str] = None,
               key_name: Optional[str] = None,
               key_name_prefix: Optional[str] = None,
               key_pair_name: Optional[str] = None,
               public_key: Optional[str] = None,
               resource_group_id: Optional[str] = None,
               tags: Optional[Mapping[str, Any]] = None)
@overload
def EcsKeyPair(resource_name: str,
               args: Optional[EcsKeyPairArgs] = None,
               opts: Optional[ResourceOptions] = None)
func NewEcsKeyPair(ctx *Context, name string, args *EcsKeyPairArgs, opts ...ResourceOption) (*EcsKeyPair, error)
public EcsKeyPair(string name, EcsKeyPairArgs? args = null, CustomResourceOptions? opts = null)
public EcsKeyPair(String name, EcsKeyPairArgs args)
public EcsKeyPair(String name, EcsKeyPairArgs args, CustomResourceOptions options)
type: alicloud:ecs:EcsKeyPair
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args EcsKeyPairArgs
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 EcsKeyPairArgs
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 EcsKeyPairArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args EcsKeyPairArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args EcsKeyPairArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

KeyFile string

The key file.

KeyName string

Field key_name has been deprecated from provider version 1.121.0. 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.

KeyNamePrefix string
KeyPairName string

The key pair's name. It is the only in one Alicloud account, the key pair's name. must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

PublicKey string

You can import an existing public key and using Alicloud key pair to manage it. If this parameter is specified, resource_group_id is the key pair belongs.

ResourceGroupId string

The Id of resource group which the key pair belongs.

Tags Dictionary<string, object>

A mapping of tags to assign to the resource.

KeyFile string

The key file.

KeyName string

Field key_name has been deprecated from provider version 1.121.0. 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.

KeyNamePrefix string
KeyPairName string

The key pair's name. It is the only in one Alicloud account, the key pair's name. must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

PublicKey string

You can import an existing public key and using Alicloud key pair to manage it. If this parameter is specified, resource_group_id is the key pair belongs.

ResourceGroupId string

The Id of resource group which the key pair belongs.

Tags map[string]interface{}

A mapping of tags to assign to the resource.

keyFile String

The key file.

keyName String

Field key_name has been deprecated from provider version 1.121.0. 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.

keyNamePrefix String
keyPairName String

The key pair's name. It is the only in one Alicloud account, the key pair's name. must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

publicKey String

You can import an existing public key and using Alicloud key pair to manage it. If this parameter is specified, resource_group_id is the key pair belongs.

resourceGroupId String

The Id of resource group which the key pair belongs.

tags Map

A mapping of tags to assign to the resource.

keyFile string

The key file.

keyName string

Field key_name has been deprecated from provider version 1.121.0. 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.

keyNamePrefix string
keyPairName string

The key pair's name. It is the only in one Alicloud account, the key pair's name. must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

publicKey string

You can import an existing public key and using Alicloud key pair to manage it. If this parameter is specified, resource_group_id is the key pair belongs.

resourceGroupId string

The Id of resource group which the key pair belongs.

tags {[key: string]: any}

A mapping of tags to assign to the resource.

key_file str

The key file.

key_name str

Field key_name has been deprecated from provider version 1.121.0. 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_name_prefix str
key_pair_name str

The key pair's name. It is the only in one Alicloud account, the key pair's name. must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

public_key str

You can import an existing public key and using Alicloud key pair to manage it. If this parameter is specified, resource_group_id is the key pair belongs.

resource_group_id str

The Id of resource group which the key pair belongs.

tags Mapping[str, Any]

A mapping of tags to assign to the resource.

keyFile String

The key file.

keyName String

Field key_name has been deprecated from provider version 1.121.0. 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.

keyNamePrefix String
keyPairName String

The key pair's name. It is the only in one Alicloud account, the key pair's name. must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

publicKey String

You can import an existing public key and using Alicloud key pair to manage it. If this parameter is specified, resource_group_id is the key pair belongs.

resourceGroupId String

The Id of resource group which the key pair belongs.

tags Map

A mapping of tags to assign to the resource.

Outputs

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

FingerPrint string
Id string

The provider-assigned unique ID for this managed resource.

FingerPrint string
Id string

The provider-assigned unique ID for this managed resource.

fingerPrint String
id String

The provider-assigned unique ID for this managed resource.

fingerPrint string
id string

The provider-assigned unique ID for this managed resource.

finger_print str
id str

The provider-assigned unique ID for this managed resource.

fingerPrint String
id String

The provider-assigned unique ID for this managed resource.

Look up an Existing EcsKeyPair Resource

Get an existing EcsKeyPair 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?: EcsKeyPairState, opts?: CustomResourceOptions): EcsKeyPair
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        finger_print: Optional[str] = None,
        key_file: Optional[str] = None,
        key_name: Optional[str] = None,
        key_name_prefix: Optional[str] = None,
        key_pair_name: Optional[str] = None,
        public_key: Optional[str] = None,
        resource_group_id: Optional[str] = None,
        tags: Optional[Mapping[str, Any]] = None) -> EcsKeyPair
func GetEcsKeyPair(ctx *Context, name string, id IDInput, state *EcsKeyPairState, opts ...ResourceOption) (*EcsKeyPair, error)
public static EcsKeyPair Get(string name, Input<string> id, EcsKeyPairState? state, CustomResourceOptions? opts = null)
public static EcsKeyPair get(String name, Output<String> id, EcsKeyPairState 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:
FingerPrint string
KeyFile string

The key file.

KeyName string

Field key_name has been deprecated from provider version 1.121.0. 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.

KeyNamePrefix string
KeyPairName string

The key pair's name. It is the only in one Alicloud account, the key pair's name. must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

PublicKey string

You can import an existing public key and using Alicloud key pair to manage it. If this parameter is specified, resource_group_id is the key pair belongs.

ResourceGroupId string

The Id of resource group which the key pair belongs.

Tags Dictionary<string, object>

A mapping of tags to assign to the resource.

FingerPrint string
KeyFile string

The key file.

KeyName string

Field key_name has been deprecated from provider version 1.121.0. 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.

KeyNamePrefix string
KeyPairName string

The key pair's name. It is the only in one Alicloud account, the key pair's name. must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

PublicKey string

You can import an existing public key and using Alicloud key pair to manage it. If this parameter is specified, resource_group_id is the key pair belongs.

ResourceGroupId string

The Id of resource group which the key pair belongs.

Tags map[string]interface{}

A mapping of tags to assign to the resource.

fingerPrint String
keyFile String

The key file.

keyName String

Field key_name has been deprecated from provider version 1.121.0. 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.

keyNamePrefix String
keyPairName String

The key pair's name. It is the only in one Alicloud account, the key pair's name. must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

publicKey String

You can import an existing public key and using Alicloud key pair to manage it. If this parameter is specified, resource_group_id is the key pair belongs.

resourceGroupId String

The Id of resource group which the key pair belongs.

tags Map

A mapping of tags to assign to the resource.

fingerPrint string
keyFile string

The key file.

keyName string

Field key_name has been deprecated from provider version 1.121.0. 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.

keyNamePrefix string
keyPairName string

The key pair's name. It is the only in one Alicloud account, the key pair's name. must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

publicKey string

You can import an existing public key and using Alicloud key pair to manage it. If this parameter is specified, resource_group_id is the key pair belongs.

resourceGroupId string

The Id of resource group which the key pair belongs.

tags {[key: string]: any}

A mapping of tags to assign to the resource.

finger_print str
key_file str

The key file.

key_name str

Field key_name has been deprecated from provider version 1.121.0. 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_name_prefix str
key_pair_name str

The key pair's name. It is the only in one Alicloud account, the key pair's name. must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

public_key str

You can import an existing public key and using Alicloud key pair to manage it. If this parameter is specified, resource_group_id is the key pair belongs.

resource_group_id str

The Id of resource group which the key pair belongs.

tags Mapping[str, Any]

A mapping of tags to assign to the resource.

fingerPrint String
keyFile String

The key file.

keyName String

Field key_name has been deprecated from provider version 1.121.0. 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.

keyNamePrefix String
keyPairName String

The key pair's name. It is the only in one Alicloud account, the key pair's name. must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

publicKey String

You can import an existing public key and using Alicloud key pair to manage it. If this parameter is specified, resource_group_id is the key pair belongs.

resourceGroupId String

The Id of resource group which the key pair belongs.

tags Map

A mapping of tags to assign to the resource.

Import

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

 $ pulumi import alicloud:ecs/ecsKeyPair:EcsKeyPair example <key_name>

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.