Class KeyPair
Provides a Lightsail Key Pair, for use with Lightsail Instances. These key pairs are separate from EC2 Key Pairs, and must be created or imported for use with Lightsail.
Note: Lightsail is currently only supported in a limited number of AWS Regions, please see "Regions and Availability Zones in Amazon Lightsail" for more details
Example Usage, creating a new Key Pair
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
// Create a new Lightsail Key Pair
var lgKeyPair = new Aws.LightSail.KeyPair("lgKeyPair", new Aws.LightSail.KeyPairArgs
{
});
}
}
Create new Key Pair, encrypting the private key with a PGP Key
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var lgKeyPair = new Aws.LightSail.KeyPair("lgKeyPair", new Aws.LightSail.KeyPairArgs
{
PgpKey = "keybase:keybaseusername",
});
}
}
Import an existing public key
using System.IO;
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var lgKeyPair = new Aws.LightSail.KeyPair("lgKeyPair", new Aws.LightSail.KeyPairArgs
{
PublicKey = File.ReadAllText("~/.ssh/id_rsa.pub"),
});
}
}
Inherited Members
Namespace: Pulumi.Aws.LightSail
Assembly: Pulumi.Aws.dll
Syntax
public class KeyPair : CustomResource
Constructors
View SourceKeyPair(String, KeyPairArgs, CustomResourceOptions)
Create a KeyPair resource with the given unique name, arguments, and options.
Declaration
public KeyPair(string name, KeyPairArgs args = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| KeyPairArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceArn
The ARN of the Lightsail key pair
Declaration
public Output<string> Arn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
EncryptedFingerprint
The MD5 public key fingerprint for the encrypted private key
Declaration
public Output<string> EncryptedFingerprint { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
EncryptedPrivateKey
the private key material, base 64 encoded and
encrypted with the given pgp_key. This is only populated when creating a new
key and pgp_key is supplied
Declaration
public Output<string> EncryptedPrivateKey { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Fingerprint
The MD5 public key fingerprint as specified in section 4 of RFC 4716.
Declaration
public Output<string> Fingerprint { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Name
The name of the Lightsail Key Pair. If omitted, a unique name will be generated by this provider
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
NamePrefix
Declaration
public Output<string> NamePrefix { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PgpKey
An optional PGP key to encrypt the resulting private key material. Only used when creating a new key pair
Declaration
public Output<string> PgpKey { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PrivateKey
the private key, base64 encoded. This is only populated
when creating a new key, and when no pgp_key is provided
Declaration
public Output<string> PrivateKey { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PublicKey
The public key material. This public key will be imported into Lightsail
Declaration
public Output<string> PublicKey { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, KeyPairState, CustomResourceOptions)
Get an existing KeyPair resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static KeyPair Get(string name, Input<string> id, KeyPairState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| KeyPairState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| KeyPair |