KeyPair

class KeyPair : KotlinCustomResource

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

Create New Key Pair

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lightsail.KeyPair;
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 lgKeyPair = new KeyPair("lgKeyPair");
}
}

Create New Key Pair with PGP Encrypted Private Key

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lightsail.KeyPair;
import com.pulumi.aws.lightsail.KeyPairArgs;
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 lgKeyPair = new KeyPair("lgKeyPair", KeyPairArgs.builder()
.pgpKey("keybase:keybaseusername")
.build());
}
}

Existing Public Key Import

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lightsail.KeyPair;
import com.pulumi.aws.lightsail.KeyPairArgs;
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 lgKeyPair = new KeyPair("lgKeyPair", KeyPairArgs.builder()
.publicKey(Files.readString(Paths.get("~/.ssh/id_rsa.pub")))
.build());
}
}

Import

Lightsail Key Pairs cannot be imported, because the private and public key are only available on initial creation.

Properties

Link copied to clipboard
val arn: Output<String>

The ARN of the Lightsail key pair

Link copied to clipboard

The MD5 public key fingerprint for the encrypted private key

Link copied to clipboard

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

Link copied to clipboard
val fingerprint: Output<String>

The MD5 public key fingerprint as specified in section 4 of RFC 4716.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val name: Output<String>

The name of the Lightsail Key Pair. If omitted, a unique name will be generated by this provider

Link copied to clipboard
val namePrefix: Output<String>?
Link copied to clipboard
val pgpKey: Output<String>?

An optional PGP key to encrypt the resulting private key material. Only used when creating a new key pair

Link copied to clipboard
val privateKey: Output<String>

the private key, base64 encoded. This is only populated when creating a new key, and when no pgp_key is provided

Link copied to clipboard
val publicKey: Output<String>

The public key material. This public key will be imported into Lightsail

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val urn: Output<String>