@pulumi/aws-native
Version:
The Pulumi AWS Cloud Control Provider enables you to build, deploy, and manage [any AWS resource that's supported by the AWS Cloud Control API](https://github.com/pulumi/pulumi-aws-native/blob/master/provider/cmd/pulumi-gen-aws-native/supported-types.txt)
167 lines (166 loc) • 7.38 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
import * as enums from "../types/enums";
/**
* Specifies a key pair for use with an EC2long instance as follows:
* + To import an existing key pair, include the ``PublicKeyMaterial`` property.
* + To create a new key pair, omit the ``PublicKeyMaterial`` property.
*
* When you import an existing key pair, you specify the public key material for the key. We assume that you have the private key material for the key. CFNlong does not create or return the private key material when you import a key pair.
* When you create a new key pair, the private key is saved to SYSlong Parameter Store, using a parameter with the following name: ``/ec2/keypair/{key_pair_id}``. For more information about retrieving private key, and the required permissions, see [Create a key pair using](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-key-pairs.html#create-key-pair-cloudformation) in the *User Guide*.
* When CFN deletes a key pair that was created or imported by a stack, it also deletes the parameter that was used to store the private key material in Parameter Store.
*
* ## Example Usage
* ### Example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws_native from "@pulumi/aws-native";
*
* const newKeyPair = new aws_native.ec2.KeyPair("newKeyPair", {keyName: "MyKeyPair"});
* const ec2Instance = new aws_native.ec2.Instance("ec2Instance", {
* imageId: "ami-02b92c281a4d3dc79",
* keyName: newKeyPair.id,
* });
*
* ```
* ### Example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws_native from "@pulumi/aws-native";
*
* const newKeyPair = new aws_native.ec2.KeyPair("newKeyPair", {keyName: "MyKeyPair"});
* const ec2Instance = new aws_native.ec2.Instance("ec2Instance", {
* imageId: "ami-02b92c281a4d3dc79",
* keyName: newKeyPair.id,
* });
*
* ```
* ### Example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws_native from "@pulumi/aws-native";
*
* const importedKeyPair = new aws_native.ec2.KeyPair("importedKeyPair", {
* keyName: "NameForMyImportedKeyPair",
* publicKeyMaterial: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICfp1F7DhdWZdqkYAUGCzcBsLmJeu9izpIyGpmmg7eCz example",
* });
* const ec2Instance = new aws_native.ec2.Instance("ec2Instance", {
* imageId: "ami-02b92c281a4d3dc79",
* keyName: importedKeyPair.id,
* });
*
* ```
* ### Example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws_native from "@pulumi/aws-native";
*
* const importedKeyPair = new aws_native.ec2.KeyPair("importedKeyPair", {
* keyName: "NameForMyImportedKeyPair",
* publicKeyMaterial: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICfp1F7DhdWZdqkYAUGCzcBsLmJeu9izpIyGpmmg7eCz example",
* });
* const ec2Instance = new aws_native.ec2.Instance("ec2Instance", {
* imageId: "ami-02b92c281a4d3dc79",
* keyName: importedKeyPair.id,
* });
*
* ```
*/
export declare class KeyPair extends pulumi.CustomResource {
/**
* Get an existing KeyPair resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): KeyPair;
/**
* Returns true if the given object is an instance of KeyPair. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is KeyPair;
/**
* If you created the key pair using Amazon EC2:
*
* - For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key.
* - For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with [OpenSSH 6.8](https://docs.aws.amazon.com/http://www.openssh.com/txt/release-6.8) .
*
* If you imported the key pair to Amazon EC2:
*
* - For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of RFC 4716.
* - For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with [OpenSSH 6.8](https://docs.aws.amazon.com/http://www.openssh.com/txt/release-6.8) .
*/
readonly keyFingerprint: pulumi.Output<string>;
/**
* The format of the key pair.
* Default: ``pem``
*/
readonly keyFormat: pulumi.Output<enums.ec2.KeyPairKeyFormat | undefined>;
/**
* A unique name for the key pair.
* Constraints: Up to 255 ASCII characters
*/
readonly keyName: pulumi.Output<string>;
/**
* The ID of the key pair.
*/
readonly keyPairId: pulumi.Output<string>;
/**
* The type of key pair. Note that ED25519 keys are not supported for Windows instances.
* If the ``PublicKeyMaterial`` property is specified, the ``KeyType`` property is ignored, and the key type is inferred from the ``PublicKeyMaterial`` value.
* Default: ``rsa``
*/
readonly keyType: pulumi.Output<enums.ec2.KeyPairKeyType | undefined>;
/**
* The public key material. The ``PublicKeyMaterial`` property is used to import a key pair. If this property is not specified, then a new key pair will be created.
*/
readonly publicKeyMaterial: pulumi.Output<string | undefined>;
/**
* The tags to apply to the key pair.
*/
readonly tags: pulumi.Output<outputs.CreateOnlyTag[] | undefined>;
/**
* Create a KeyPair resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: KeyPairArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* The set of arguments for constructing a KeyPair resource.
*/
export interface KeyPairArgs {
/**
* The format of the key pair.
* Default: ``pem``
*/
keyFormat?: pulumi.Input<enums.ec2.KeyPairKeyFormat>;
/**
* A unique name for the key pair.
* Constraints: Up to 255 ASCII characters
*/
keyName: pulumi.Input<string>;
/**
* The type of key pair. Note that ED25519 keys are not supported for Windows instances.
* If the ``PublicKeyMaterial`` property is specified, the ``KeyType`` property is ignored, and the key type is inferred from the ``PublicKeyMaterial`` value.
* Default: ``rsa``
*/
keyType?: pulumi.Input<enums.ec2.KeyPairKeyType>;
/**
* The public key material. The ``PublicKeyMaterial`` property is used to import a key pair. If this property is not specified, then a new key pair will be created.
*/
publicKeyMaterial?: pulumi.Input<string>;
/**
* The tags to apply to the key pair.
*/
tags?: pulumi.Input<pulumi.Input<inputs.CreateOnlyTagArgs>[]>;
}