Key Pair
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
The MD5 public key fingerprint for the encrypted private key
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
The MD5 public key fingerprint as specified in section 4 of RFC 4716.
the private key, base64 encoded. This is only populated when creating a new key, and when no pgp_key
is provided